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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on February 5, 2019 by texi2html 1.82
texi2html was written by:
Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>Gambit, a portable implementation of Scheme</title>
<meta name="description" content="Gambit, a portable implementation of Scheme">
<meta name="keywords" content="Gambit, a portable implementation of Scheme">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
a:link {color: #0000e0}
a:visited {color: #0000e0}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Top"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Gambit"></a>
<h1 class="settitle">Gambit</h1>
<a name="index-Gambit"></a>
<a name="index-Scheme_002c-implementation-of"></a>
<p>This manual documents Gambit. It covers release v4.9.3.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#The-Gambit-system">1. The Gambit system</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Accessing-the-system-files">1.1 Accessing the system files</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#GSI">2. The Gambit Scheme interpreter</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#GSC">3. The Gambit Scheme compiler</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Runtime-options">4. Runtime options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Debugging">5. Debugging</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Scheme-extensions">6. Scheme extensions</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Namespaces">7. Namespaces</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Characters-and-strings">8. Characters and strings</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Numbers">9. Numbers</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Hashing-and-weak-references">11. Hashing and weak references</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Records">12. Records</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Threads">13. Threads</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Dynamic-environment">14. Dynamic environment</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Exceptions">15. Exceptions</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Host-environment">16. Host environment</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#I_002fO-and-ports">17. I/O and ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Lexical-syntax-and-readtables">18. Lexical syntax and readtables</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#C_002dinterface">19. C-interface</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#System-limitations">20. System limitations</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Copyright-and-license">21. Copyright and license</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#General-index">General index</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="1">
<a name="The-Gambit-system"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Accessing-the-system-files" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSI" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-Gambit-system-1"></a>
<h1 class="chapter">1. The Gambit system</h1>
<a name="index-Gambit-1"></a>
<a name="index-Scheme"></a>
<a name="index-gsi"></a>
<a name="index-gsc"></a>
<p>The Gambit programming system is a full implementation of the Scheme
language which conforms to the R4RS, R5RS and IEEE Scheme standards. It
consists of two main programs: <code>gsi</code>, the Gambit Scheme
interpreter, and <code>gsc</code>, the Gambit Scheme compiler.
</p>
<p>The Gambit
compiler generates portable C code, making the whole Gambit system and
the programs compiled with it easily portable to many computer
architectures for which a C compiler is available. With appropriate
declarations in the source code the executable programs generated by
the compiler run roughly as fast as equivalent C programs.
</p>
<p>For the most up to date information on Gambit and add-on packages
please check the Gambit web page at
<a href="http://gambitscheme.org">http://gambitscheme.org</a>. The web page has links to the
Gambit mailing list, the bug reporting system, and the source code
repository.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Accessing-the-system-files">1.1 Accessing the system files</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Accessing-the-system-files"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#The-Gambit-system" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GSI" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#The-Gambit-system" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#The-Gambit-system" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSI" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Accessing-the-system-files-1"></a>
<h2 class="section">1.1 Accessing the system files</h2>
<p>Files related to Gambit, such as executables, libraries and header files,
are stored in multiple <em>Gambit installation directories</em>.
Gambit may be installed on a system according to two different
installation models.
</p>
<p>In the first model there is a single directory where all the Gambit
installation directories are stored. This <em>central installation
directory</em> is typically <code>/usr/local/Gambit</code> under UNIX,
<code>/Library/Gambit</code> under Mac OS X and <code>C:/Program
Files/Gambit</code> under Microsoft Windows. This may have been
overridden when the system was built with the command ‘<samp>configure
--prefix=/my/Gambit</samp>’. If the system was built with the command
‘<samp>configure --enable-multiple-versions</samp>’ then the central
installation directory is <code><span class="roman"><i>prefix</i></span>/<span class="roman"><i>version</i></span></code>, where
<code><span class="roman"><i>version</i></span></code> is the system version string
(e.g. <code>v4.9.3</code> for Gambit v4.9.3). Moreover,
<code><span class="roman"><i>prefix</i></span>/current</code> will be a symbolic link which points to
the central installation directory. In this model, the Gambit
installation directory named <var>X</var> is simply the subdirectory
<var>X</var> of the central installation directory.
</p>
<p>In the second model some or all of the Gambit installation directories
are stored in installation specific directories. The location of
these directories is assigned when the system is built using the
command ‘<samp>configure --bindir=/my/bin --includedir=/my/include
--libdir=/my/lib</samp>’.
</p>
<p>The advantage of the first model is that it is easy to have multiple
versions of Gambit coexist and to remove all the files of a given
version. However, the second model may be necessary to conform to the
package installation conventions of some operating systems.
</p>
<p>Executable programs such as the interpreter <code>gsi</code> and compiler
<code>gsc</code> can be found in the <code>bin</code> installation directory.
Adding this directory to the <code>PATH</code> environment variable allows
these programs to be started by simply entering their name. This is
done automatically by the Mac OS X and Microsoft Windows installers.
</p>
<p>The runtime library is located in the <code>lib</code> installation
directory. When the system’s runtime library is built as a
shared-library (with the command ‘<samp>configure --enable-shared</samp>’) all
programs built with Gambit, including the interpreter and compiler,
need to find this library when they are executed and consequently this
directory must be in the path searched by the system for
shared-libraries. This path is normally specified through an
environment variable which is <code>LD_LIBRARY_PATH</code> on most versions
of UNIX, <code>LIBPATH</code> on AIX, <code>SHLIB_PATH</code> on HPUX,
<code>DYLD_LIBRARY_PATH</code> on Mac OS X, and <code>PATH</code> on Microsoft
Windows. If the shell is <code>sh</code>, the setting of the path can be
made for a single execution by prefixing the program name with the
environment variable assignment, as in:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>$ <b>LD_LIBRARY_PATH=/usr/local/Gambit/lib gsi</b>
</pre></td></tr></table>
<p>A similar problem exists with the Gambit header file <code>gambit.h</code>,
located in the <code>include</code> installation directory. This header
file is needed for compiling Scheme programs with the Gambit
compiler. When the C compiler is being called explicitly it may be
necessary to use a <code>-I<var><dir></var></code> command line option to
indicate where to find header files and a <code>-L<var><dir></var></code> command
line option to indicate where to find libraries.
</p>
<p>Access to both of these files can be simplified by creating a link to
them in the appropriate system directories (special privileges may
however be required):
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>$ <b>ln -s /usr/local/Gambit/lib/libgambit.a /usr/lib</b> <span class="roman"><i># name may vary</i></span>
$ <b>ln -s /usr/local/Gambit/include/gambit.h /usr/include</b>
</pre></td></tr></table>
<p>Alternatively these files can be copied or linked in the directory
where the C compiler is invoked (this requires no special privileges).
</p>
<p>Another approach is to set some environment variables which
are used to tell the C compiler where to find header files
and libraries. For example, the following settings can be
used for the <code>gcc</code> C compiler:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>$ <b>export LIBRARY_PATH=/usr/local/Gambit/lib</b>
$ <b>export CPATH=/usr/local/Gambit/include</b>
</pre></td></tr></table>
<p>Note that this may have been done by the installation process. In
particular, the Mac OS X and Microsoft Windows prebuilt installers set
up the environment so that the <code>gcc</code> compiler finds these files
automatically.
</p>
<hr size="6">
<a name="GSI"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Accessing-the-system-files" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GSI-interactive-mode" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#The-Gambit-system" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-Gambit-Scheme-interpreter"></a>
<h1 class="chapter">2. The Gambit Scheme interpreter</h1>
<a name="index-interpreter"></a>
<p>Synopsis:
</p>
<table><tr><td> </td><td><pre class="example"><b></b>gsi <span class="roman">[</span>-:<span class="roman"><var>runtimeoption</var></span>,…<span class="roman">]</span> <span class="roman">[</span>-i<span class="roman">]</span> <span class="roman">[</span>-f<span class="roman">]</span> <span class="roman">[</span>-v<span class="roman">]</span> <span class="roman">[</span><span class="roman">[</span>-<span class="roman">]</span> <span class="roman">[</span>-e <span class="roman"><var>expressions</var></span><span class="roman">]</span> <span class="roman">[</span><span class="roman"><var>file</var></span><span class="roman">]</span><span class="roman">]</span>…
</pre></td></tr></table>
<a name="index-gsi-1"></a>
<p>The interpreter is executed in <em>interactive mode</em> when no file or
‘<samp>-</samp>’ or ‘<samp>-e</samp>’ option is given on the command line. Otherwise
the interpreter is executed in <em>batch mode</em>. The ‘<samp>-i</samp>’ option
is ignored by the interpreter. The initialization file will be
examined unless the ‘<samp>-f</samp>’ option is present (see section <a href="#GSI-customization">Customization</a>). The ‘<samp>-v</samp>’ option prints the system version
string, system time stamp, operating system type, and configure script
options on standard output and exits. Runtime options are explained
in <a href="#Runtime-options">Runtime options</a>.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#GSI-interactive-mode">2.1 Interactive mode</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#GSI-batch-mode">2.2 Batch mode</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#GSI-customization">2.3 Customization</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#GSI-exit-status">2.4 Process exit status</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="GSI-interactive-mode"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GSI" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GSI-batch-mode" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSI" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSI" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Interactive-mode-1"></a>
<h2 class="section">2.1 Interactive mode</h2>
<p>In interactive mode a read-eval-print loop (REPL) is started for the
user to interact with the interpreter. At each iteration of this loop
the interpreter displays a prompt, reads a command and executes it.
The commands can be expressions to evaluate (the typical case)
or special commands related to debugging, for example ‘<samp>,q</samp>’ to
terminate the process (for a complete list of commands see
<a href="#Debugging">Debugging</a>). Most commands produce some output, such as the
value or error message resulting from an evaluation.
</p>
<p>The input and output of the interaction is done on the
<em>interaction channel</em>. The interaction channel can be specified
through the runtime options but if none is specified the system uses a
reasonable default that depends on the system’s configuration. When
the system’s runtime library was built with support for GUIDE, the
Gambit Universal IDE (with the command ‘<samp>configure
--enable-guide</samp>’) the interaction channel corresponds to the
<em>console window</em> of the primordial thread (for details see
<a href="#GUIDE">GUIDE</a>), otherwise the interaction channel is the user’s
<em>console</em>, also known as the <em>controlling terminal</em> in the
UNIX world. When the REPL starts, the ports associated with
‘<samp>(current-input-port)</samp>’, ‘<samp>(current-output-port)</samp>’ and
‘<samp>(current-error-port)</samp>’ all refer to the interaction channel.
</p>
<p>Expressions are evaluated in the global <em>interaction environment</em>.
The interpreter adds to this environment any definition entered using
the <code>define</code> and <code>define-macro</code>
special forms. Once the evaluation of an expression is completed, the
value or values resulting from the evaluation are output to the
interaction channel by the pretty printer. The special “void”
object is not output. This object is returned by most procedures and
special forms which the Scheme standard defines as returning an
unspecified value (e.g. <code>write</code>, <code>set!</code>, <code>define</code>).
</p>
<p>Here is a sample interaction with <code>gsi</code>:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi</b>
Gambit v4.9.3
> <b>(define (fact n) (if (< n 2) 1 (* n (fact (- n 1)))))</b>
> <b>(map fact '(1 2 3 4 5 6))</b>
(1 2 6 24 120 720)
> <b>(values (fact 10) (fact 40))</b>
3628800
815915283247897734345611269596115894272000000000
> <b>,q</b>
</pre></td></tr></table>
<p>What happens when errors occur is explained in <a href="#Debugging">Debugging</a>.
</p>
<hr size="6">
<a name="GSI-batch-mode"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GSI-interactive-mode" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GSI-customization" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSI" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSI" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Batch-mode-1"></a>
<h2 class="section">2.2 Batch mode</h2>
<p>In batch mode the command line arguments denote files to be loaded,
REPL interactions to start (‘<samp>-</samp>’ option), and expressions to be
evaluated (‘<samp>-e</samp>’ option). Note that the ‘<samp>-</samp>’ and ‘<samp>-e</samp>’
options can be interspersed with the files on the command line and can
occur multiple times. The interpreter processes the command line
arguments from left to right, loading files with the <code>load</code>
procedure and evaluating expressions with the <code>eval</code> procedure in
the global interaction environment. After this processing the
interpreter exits.
</p>
<p>When the file name has no extension the <code>load</code> procedure first
attempts to load the file with no extension as a Scheme source file.
If that file doesn’t exist it will search for both a source file and
an object file. The object file’s name is obtained by adding to the
file name a ‘<samp>.o<var>n</var></samp>’ extension with the highest consecutive
version number starting with 1. The source file’s name is obtained by
adding to the file name the file extensions ‘<samp>.scm</samp>’ and
‘<samp>.six</samp>’ (the first found is the source file). If both a source
file and an object file exist, then the one with the latest
modification time is loaded. Otherwise the file that is found is
loaded. When the file name has an extension, the <code>load</code>
procedure will only attempt to load the file with that specific name.
</p>
<p>When the extension of the file loaded is ‘<samp>.scm</samp>’ the content of
the file will be parsed using the normal Scheme prefix syntax. When
the extension of the file loaded is ‘<samp>.six</samp>’ the content of the
file will be parsed using the Scheme infix syntax extension (see
<a href="#Scheme-infix-syntax-extension">Scheme infix syntax extension</a>). Otherwise, <code>gsi</code> will
parse the file using the normal Scheme prefix syntax.
</p>
<p>The ports associated with ‘<samp>(current-input-port)</samp>’,
‘<samp>(current-output-port)</samp>’ and ‘<samp>(current-error-port)</samp>’ initially
refer respectively to the standard input (‘<samp>stdin</samp>’), standard
output (‘<samp>stdout</samp>’) and the standard error (‘<samp>stderr</samp>’) of the
interpreter. This is true even in REPLs started with the ‘<samp>-</samp>’
option. The usual interaction channel (console or IDE’s console
window) is still used to read expressions and commands and to display
results. This makes it possible to use REPLs to debug programs which
read the standard input and write to the standard output, even when
these have been redirected.
</p>
<p>Here is a sample use of the interpreter in batch mode, under UNIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat h.scm</b>
(display "hello") (newline)
$ <b>cat w.six</b>
display("world"); newline();
$ <b>gsi h.scm - w.six -e "(pretty-print 1)(pretty-print 2)"</b>
hello
> <b>(define (display x) (write (reverse (string->list x))))</b>
> <b>,(c 0)</b>
(#\d #\l #\r #\o #\w)
1
2
</pre></td></tr></table>
<hr size="6">
<a name="GSI-customization"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GSI-batch-mode" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GSI-exit-status" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSI" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSI" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Customization"></a>
<h2 class="section">2.3 Customization</h2>
<p>There are two ways to customize the interpreter. When the interpreter
starts off it tries to execute a ‘<samp>(load "~~lib/gambext")</samp>’ (for an
explanation of how file names are interpreted see <a href="#Host-environment">Host environment</a>).
An error is not signaled when the file does not exist. Interpreter
extensions and patches that are meant to apply to all users and all
modes should go in that file.
</p>
<p>Extensions which are meant to apply to a single user or to a specific
working directory are best placed in the <em>initialization file</em>,
which is a file containing Scheme code. In all modes, the interpreter
first tries to locate the initialization file by searching the following
locations: ‘<tt>.gambini</tt>’ and ‘<tt>~/.gambini</tt>’ (with no extension, a
‘<samp>.scm</samp>’ extension, and a ‘<samp>.six</samp>’ extension in that order). The
first file that is found is examined as though the expression
<code>(include <var>initialization-file</var>)</code> had been entered at the
read-eval-print loop where <var>initialization-file</var> is the file that
was found. Note that by using an <code>include</code> the macros defined in
the initialization file will be visible from the read-eval-print loop
(this would not have been the case if <code>load</code> had been used). The
initialization file is not searched for or examined when the ‘<samp>-f</samp>’
option is specified.
</p>
<hr size="6">
<a name="GSI-exit-status"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GSI-customization" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-scripts" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSI" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSI" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Process-exit-status"></a>
<h2 class="section">2.4 Process exit status</h2>
<p>The status is zero when the interpreter exits normally and is nonzero
when the interpreter exits due to an error. Here is the meaning of
the exit statuses:
</p>
<dl compact="compact">
<dt> <code>0</code></dt>
<dd><p>The execution of the primordial thread (i.e. the main thread) did not
encounter any error. It is however possible that other threads
terminated abnormally (by default threads other than the primordial
thread terminate silently when they raise an exception that is not
handled).
</p>
</dd>
<dt> <code>64</code></dt>
<dd><p>The runtime options or the environment variable ‘<samp>GAMBOPT</samp>’
contained a syntax error or were invalid.
</p>
</dd>
<dt> <code>70</code></dt>
<dd><p>This normally indicates that an exception was raised in the primordial
thread and the exception was not handled.
</p>
</dd>
<dt> <code>71</code></dt>
<dd><p>There was a problem initializing the runtime system, for example
insufficient memory to allocate critical tables.
</p>
</dd>
</dl>
<p>For example, if the shell is <code>sh</code>:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi -:d0 -e "(pretty-print (expt 2 100))"</b>
1267650600228229401496703205376
$ <b>echo $?</b>
0
$ <b>gsi -:d0,unknown <span class="roman"><i># try to use an unknown runtime option</i></span></b>
$ <b>echo $?</b>
64
$ <b>gsi -:d0 nonexistent.scm <span class="roman"><i># try to load a file that does not exist</i></span></b>
$ <b>echo $?</b>
70
$ <b>gsi nonexistent.scm</b>
*** ERROR IN ##main -- No such file or directory
(load "nonexistent.scm")
$ <b>echo $?</b>
70
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b>$ <b>gsi -:m4000000 <span class="roman"><i># ask for a 4 gigabyte heap</i></span></b>
*** malloc: vm_allocate(size=528384) failed (error code=3)
*** malloc[15068]: error: Can't allocate region
$ <b>echo $?</b>
71
</pre></td></tr></table>
<p>Note the use of the runtime option ‘<samp>-:d0</samp>’ that prevents error
messages from being output, and the runtime option ‘<samp>-:m4000000</samp>’
which sets the minimum heap size to 4 gigabytes.
</p>
<hr size="6">
<a name="Scheme-scripts"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GSI-exit-status" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Scripts-under-UNIX-and-Mac-OS-X" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSI" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSI" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Scheme-scripts-1"></a>
<h2 class="section">2.5 Scheme scripts</h2>
<p>The <code>load</code> procedure treats specially files that begin with the
two characters ‘<samp>#!</samp>’ and ‘<samp>@;</samp>’. Such files are called
<em>script files</em> and the first line is called the <em>script line</em>.
In addition to indicating that the file is a script, the script line
provides information about the source code language to be used by the
<code>load</code> procedure. After the two characters ‘<samp>#!</samp>’ and
‘<samp>@;</samp>’ the system will search for the first substring matching one
of the following language specifying tokens:
</p>
<dl compact="compact">
<dt> <code>scheme-r4rs</code></dt>
<dd><a name="index-scheme_002dr4rs"></a>
<p>R4RS language with prefix syntax, case-insensitivity, keyword syntax
not supported
</p>
</dd>
<dt> <code>scheme-r5rs</code></dt>
<dd><a name="index-scheme_002dr5rs"></a>
<p>R5RS language with prefix syntax, case-insensitivity, keyword syntax
not supported
</p>
</dd>
<dt> <code>scheme-ieee-1178-1990</code></dt>
<dd><a name="index-scheme_002dieee_002d1178_002d1990"></a>
<p>IEEE 1178-1990 language with prefix syntax, case-insensitivity, keyword
syntax not supported
</p>
</dd>
<dt> <code>scheme-srfi-0</code></dt>
<dd><a name="index-scheme_002dsrfi_002d0"></a>
<p>R5RS language with prefix syntax and SRFI 0 support
(i.e. <code>cond-expand</code> special form), case-insensitivity, keyword
syntax not supported
</p>
</dd>
<dt> <code>gsi-script</code></dt>
<dd><a name="index-gsi_002dscript"></a>
<p>Full Gambit Scheme language with prefix syntax, case-sensitivity, keyword
syntax supported
</p>
</dd>
<dt> <code>gsc-script</code></dt>
<dd><a name="index-gsc_002dscript"></a>
<p>Full Gambit Scheme language with prefix syntax, case-sensitivity, keyword
syntax supported
</p>
</dd>
<dt> <code>six-script</code></dt>
<dd><a name="index-six_002dscript"></a>
<p>Full Gambit Scheme language with infix syntax, case-sensitivity, keyword
syntax supported
</p>
</dd>
</dl>
<p>If a language specifying token is not found, <code>load</code> will use the
same language as a nonscript file (i.e. it uses the file extension and
runtime system options to determine the language).
</p>
<p>After processing the script line, <code>load</code> will parse the rest of
the file (using the syntax of the language indicated) and then execute
it. When the file is being loaded because it is an argument on the
interpreter’s command line, the interpreter will:
</p>
<ul>
<li>
<a name="index-command_002dline"></a>
Setup the <code>command-line</code> procedure so that it returns a list
containing the expanded file name of the script file and the
arguments following the script file on the command line.
This is done before the script is executed. The expanded file name
of the script file can be used to determine the directory that
contains the script (i.e. <code>(path-directory (car (command-line)))</code>).
</li><li>
After the script is loaded the procedure <code>main</code> is called with
the command-line arguments. The way this is done depends on the
language specifying token. For <code>scheme-r4rs</code>,
<code>scheme-r5rs</code>, <code>scheme-ieee-1178-1990</code>, and
<code>scheme-srfi-0</code>, the <code>main</code> procedure is called with the
equivalent of <code>(main (cdr (command-line)))</code> and <code>main</code> is
expected to return a process exit status code in the range 0 to 255.
This conforms to the “Running Scheme Scripts on Unix SRFI” (SRFI
22). For <code>gsi-script</code> and <code>six-script</code> the <code>main</code>
procedure is called with the equivalent of <code>(apply main (cdr
(command-line)))</code> and the process exit status code is 0 (<code>main</code>’s
result is ignored). The Gambit system has a predefined <code>main</code>
procedure which accepts any number of arguments and returns 0, so it
is perfectly valid for a script to not define <code>main</code> and to do
all its processing with top-level expressions (examples are given in
the next section).
</li><li>
When <code>main</code> returns, the interpreter exits. The command-line
arguments after a script file are consequently not processed (however
they do appear in the list returned by the <code>command-line</code>
procedure, after the script file’s expanded file name, so it is up to
the script to process them).
</li></ul>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Scripts-under-UNIX-and-Mac-OS-X">2.5.1 Scripts under UNIX and Mac OS X</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Scripts-under-Microsoft-Windows">2.5.2 Scripts under Microsoft Windows</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Compiling-scripts">2.5.3 Compiling scripts</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Scripts-under-UNIX-and-Mac-OS-X"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Scheme-scripts" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Scripts-under-Microsoft-Windows" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSI" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-scripts" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Scripts-under-UNIX-and-Mac-OS-X-1"></a>
<h3 class="subsection">2.5.1 Scripts under UNIX and Mac OS X</h3>
<p>Under UNIX and Mac OS X, the Gambit installation process creates the
executable ‘<samp>gsi</samp>’ and also the executables ‘<samp>six</samp>’,
‘<samp>gsi-script</samp>’, ‘<samp>six-script</samp>’, ‘<samp>scheme-r5rs</samp>’,
‘<samp>scheme-srfi-0</samp>’, etc as links to ‘<samp>gsi</samp>’. A Scheme script
need only start with the name of the desired Scheme language variant
prefixed with ‘<samp>#!</samp>’ and the directory where the Gambit
executables are stored. This script should be made executable by
setting the execute permission bits (with a ‘<samp>chmod +x
<var>script</var></samp>’). Here is an example of a script which lists on standard
output the files in the current directory:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>#!/usr/local/Gambit/bin/gsi-script
(for-each pretty-print (directory-files))
</pre></td></tr></table>
<p>Here is another UNIX script, using the Scheme infix syntax extension,
which takes a single integer argument and prints on standard output the
numbers from 1 to that integer:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>#!/usr/local/Gambit/bin/six-script
void main (obj n_str)
{
int n = \string->number(n_str);
for (int i=1; i<=n; i++)
\pretty-print(i);
}
</pre></td></tr></table>
<p>For maximal portability it is a good idea to start scripts indirectly
through the ‘<samp>/usr/bin/env</samp>’ program, so that the executable of the
interpreter will be searched in the user’s ‘<samp>PATH</samp>’. This is what
SRFI 22 recommends. For example here is a script that mimics the UNIX
‘<samp>cat</samp>’ utility for text files:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>#!/usr/bin/env gsi-script
(define (display-file filename)
(display (call-with-input-file filename
(lambda (port)
(read-line port #f)))))
(for-each display-file (cdr (command-line)))
</pre></td></tr></table>
<hr size="6">
<a name="Scripts-under-Microsoft-Windows"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Scripts-under-UNIX-and-Mac-OS-X" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Compiling-scripts" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSI" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-scripts" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Scripts-under-Microsoft-Windows-1"></a>
<h3 class="subsection">2.5.2 Scripts under Microsoft Windows</h3>
<p>Under Microsoft Windows, the Gambit installation process creates the
executable ‘<samp>gsi.exe</samp>’ and ‘<samp>six.exe</samp>’ and also the batch files
‘<samp>gsi-script.bat</samp>’, ‘<samp>six-script.bat</samp>’, ‘<samp>scheme-r5rs.bat</samp>’,
‘<samp>scheme-srfi-0.bat</samp>’, etc which simply invoke ‘<samp>gsi.exe</samp>’ with
the same command line arguments. A Scheme script need only start with
the name of the desired Scheme language variant prefixed with
‘<samp>@;</samp>’. A UNIX script can be converted to a Microsoft Windows
script simply by changing the script line and storing the script in a
file whose name has a ‘<samp>.bat</samp>’ or ‘<samp>.cmd</samp>’ extension:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>@;gsi-script %~f0 %*
(display "files:\n")
(pretty-print (directory-files))
</pre></td></tr></table>
<p>Note that Microsoft Windows always searches executables in the user’s
‘<samp>PATH</samp>’, so there is no need for an indirection such as the UNIX
‘<samp>/usr/bin/env</samp>’. However the script line must end with ‘<samp>%~f0
%*</samp>’ to pass the expanded filename of the script and command line
arguments to the interpreter.
</p>
<hr size="6">
<a name="Compiling-scripts"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Scripts-under-Microsoft-Windows" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSI" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-scripts" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Compiling-scripts-1"></a>
<h3 class="subsection">2.5.3 Compiling scripts</h3>
<p>A script file can be compiled using the Gambit Scheme compiler
(see section <a href="#GSC">The Gambit Scheme compiler</a>) into a standalone executable. The script line will
provide information to the compiler on which language to use. The
script line also provides information on which runtime options to use
when executing the compiled script. This is useful to set the default
runtime options of an executable program.
</p>
<p>The compiled script will be executed similarly to an interpreted
script (i.e. the list of command line arguments returned by the
<code>command-line</code> procedure and the invocation of the <code>main</code>
procedure).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat square.scm</b>
#!/usr/local/Gambit/bin/gsi-script -:d0
(define (main arg)
(pretty-print (expt (string->number arg) 2)))
$ <b>gsi square 30 <span class="roman"><i># gsi will load square.scm</i></span></b>
900
$ <b>gsc -exe square <span class="roman"><i># compile the script to a standalone program</i></span></b>
$ <b>./square 30</b>
900
$ <b>./square 1 2 3 <span class="roman"><i># too many arguments to main</i></span></b>
$ <b>echo $?</b>
70
$ <b>./square -:d1 1 2 3 <span class="roman"><i># ask for error message</i></span></b>
*** ERROR -- Wrong number of arguments passed to procedure
(main "1" "2" "3")
</pre></td></tr></table>
<hr size="6">
<a name="GSC"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Compiling-scripts" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GSC-interactive-mode" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSI" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-Gambit-Scheme-compiler"></a>
<h1 class="chapter">3. The Gambit Scheme compiler</h1>
<a name="index-compiler"></a>
<a name="index-interpreter-1"></a>
<p>Synopsis:
</p>
<table><tr><td> </td><td><pre class="example"><b></b>gsc <span class="roman">[</span>-:<span class="roman"><var>runtimeoption</var></span>,…<span class="roman">]</span> <span class="roman">[</span>-i<span class="roman">]</span> <span class="roman">[</span>-f<span class="roman">]</span> <span class="roman">[</span>-v<span class="roman">]</span>
<span class="roman">[</span>-prelude <span class="roman"><var>expressions</var></span><span class="roman">]</span> <span class="roman">[</span>-postlude <span class="roman"><var>expressions</var></span><span class="roman">]</span>
<span class="roman">[</span>-dynamic<span class="roman">]</span> <span class="roman">[</span>-exe<span class="roman">]</span> <span class="roman">[</span>-obj<span class="roman">]</span> <span class="roman">[</span>-cc-options <span class="roman"><var>options</var></span><span class="roman">]</span>
<span class="roman">[</span>-ld-options-prelude <span class="roman"><var>options</var></span><span class="roman">]</span> <span class="roman">[</span>-ld-options <span class="roman"><var>options</var></span><span class="roman">]</span>
<span class="roman">[</span>-warnings<span class="roman">]</span> <span class="roman">[</span>-verbose<span class="roman">]</span> <span class="roman">[</span>-report<span class="roman">]</span> <span class="roman">[</span>-expansion<span class="roman">]</span> <span class="roman">[</span>-gvm<span class="roman">]</span> <span class="roman">[</span>-cfg<span class="roman">]</span> <span class="roman">[</span>-dg<span class="roman">]</span>
<span class="roman">[</span>-debug<span class="roman">]</span> <span class="roman">[</span>-debug-location<span class="roman">]</span> <span class="roman">[</span>-debug-source<span class="roman">]</span>
<span class="roman">[</span>-debug-environments<span class="roman">]</span> <span class="roman">[</span>-track-scheme<span class="roman">]</span>
<span class="roman">[</span>-o <span class="roman"><var>output</var></span><span class="roman">]</span> <span class="roman">[</span>-c<span class="roman">]</span> <span class="roman">[</span>-keep-c<span class="roman">]</span> <span class="roman">[</span>-link<span class="roman">]</span> <span class="roman">[</span>-flat<span class="roman">]</span> <span class="roman">[</span>-l <span class="roman"><var>base</var></span><span class="roman">]</span>
<span class="roman">[</span>-module-name <span class="roman"><var>module-name</var></span><span class="roman">]</span> <span class="roman">[</span>-linker-name <span class="roman"><var>linker-name</var></span><span class="roman">]</span>
<span class="roman">[</span><span class="roman">[</span>-<span class="roman">]</span> <span class="roman">[</span>-e <span class="roman"><var>expressions</var></span><span class="roman">]</span> <span class="roman">[</span><span class="roman"><var>file</var></span><span class="roman">]</span><span class="roman">]</span>…
</pre></td></tr></table>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#GSC-interactive-mode">3.1 Interactive mode</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#GSC-customization">3.2 Customization</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Link-files">3.4 Link files</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="GSC-interactive-mode"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GSC" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GSC-customization" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Interactive-mode"></a>
<h2 class="section">3.1 Interactive mode</h2>
<p>When no command line argument is present other than options the
compiler behaves like the interpreter in interactive mode. The only
difference with the interpreter is that the compilation related
procedures listed in this chapter are also available
(i.e. <code>compile-file</code>, <code>compile-file-to-target</code>, etc).
</p>
<hr size="6">
<a name="GSC-customization"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GSC-interactive-mode" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GSC-batch-mode" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Customization-1"></a>
<h2 class="section">3.2 Customization</h2>
<p>Like the interpreter, the compiler will examine the initialization
file unless the ‘<samp>-f</samp>’ option is specified.
</p>
<hr size="6">
<a name="GSC-batch-mode"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GSC-customization" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Link-files" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Batch-mode"></a>
<h2 class="section">3.3 Batch mode</h2>
<a name="index-gsc-1"></a>
<a name="index-_002escm"></a>
<a name="index-_002esix"></a>
<a name="index-_002ec"></a>
<a name="index-file_002escm"></a>
<a name="index-file_002esix"></a>
<a name="index-file_002ec"></a>
<p>In batch mode <code>gsc</code> takes a set of file names (with either no
extension, or a C file extension, or some other extension) on the
command line and compiles each Scheme file into a C file.
The recognized C file extensions are ‘<samp>.c</samp>’, ‘<samp>.C</samp>’, ‘<samp>.cc</samp>’,
‘<samp>.cp</samp>’, ‘<samp>.cpp</samp>’, ‘<samp>.CPP</samp>’, ‘<samp>.cxx</samp>’, ‘<samp>.c++</samp>’,
‘<samp>.m</samp>’, ‘<samp>.M</samp>’, and ‘<samp>.mm</samp>’.
The extension can be omitted from <var>file</var> when the Scheme file has a
‘<samp>.scm</samp>’ or ‘<samp>.six</samp>’ extension. When the extension of the
Scheme file is ‘<samp>.six</samp>’ the content of the file will be parsed
using the Scheme infix syntax extension (see <a href="#Scheme-infix-syntax-extension">Scheme infix syntax extension</a>). Otherwise, <code>gsc</code> will parse the Scheme file using the
normal Scheme prefix syntax. Files with a C file extension must
have been previously produced by <code>gsc</code>, with the ‘<samp>-c</samp>’ option,
and are used by Gambit’s linker.
</p>
<p>For each Scheme file a C file ‘<samp><var>file</var>.c</samp>’ will be produced.
The C file’s name is the same as the Scheme file, but the extension is
changed to ‘<samp>.c</samp>’. By default the C file is created in the same
directory as the Scheme file. This default can be overridden with the
compiler’s ‘<samp>-o</samp>’ option.
</p>
<p>The C files produced by the compiler serve two purposes. They will be
processed by a C compiler to generate object files, and they also
contain information to be read by Gambit’s linker to generate a
<em>link file</em>. The link file is a C file that collects various
linking information for a group of modules, such as the set of all
symbols and global variables used by the modules.
<a name="index-_002dlink"></a>
<a name="index-_002dexe"></a>
The linker is only invoked when the ‘<samp>-link</samp>’ or ‘<samp>-exe</samp>’
options appear on the command line.
</p>
<p>Compiler options must be specified before the first file name and
after the ‘<samp>-:</samp>’ runtime option (see section <a href="#Runtime-options">Runtime options</a>). If
present, the ‘<samp>-i</samp>’, ‘<samp>-f</samp>’, and ‘<samp>-v</samp>’ compiler options
must come first. The available options are:
</p>
<a name="index-compiler-options"></a>
<a name="index-options_002c-compiler"></a>
<dl compact="compact">
<dt> <code>-i</code></dt>
<dd><p>Force interpreter mode.
</p></dd>
<dt> <code>-f</code></dt>
<dd><p>Do not examine the initialization file.
</p></dd>
<dt> <code>-v</code></dt>
<dd><p>Print the system version string, system time stamp, operating system
type, and configure script options on standard output and exit.
</p></dd>
<dt> <code>-prelude <var>expressions</var></code></dt>
<dd><p>Add expressions to the top of the source code being compiled.
</p></dd>
<dt> <code>-postlude <var>expressions</var></code></dt>
<dd><p>Add expressions to the bottom of the source code being compiled.
</p></dd>
<dt> <code>-cc-options <var>options</var></code></dt>
<dd><p>Add options to the command that invokes the C compiler.
</p></dd>
<dt> <code>-ld-options-prelude <var>options</var></code></dt>
<dd><p>Add options to the command that invokes the C linker.
</p></dd>
<dt> <code>-ld-options <var>options</var></code></dt>
<dd><p>Add options to the command that invokes the C linker.
</p></dd>
<dt> <code>-warnings</code></dt>
<dd><p>Display warnings.
</p></dd>
<dt> <code>-verbose</code></dt>
<dd><p>Display a trace of the compiler’s activity.
</p></dd>
<dt> <code>-report</code></dt>
<dd><p>Display a global variable usage report.
</p></dd>
<dt> <code>-expansion</code></dt>
<dd><p>Display the source code after expansion.
</p></dd>
<dt> <code>-gvm</code></dt>
<dd><p>Generate a listing of the GVM code.
</p></dd>
<dt> <code>-cfg</code></dt>
<dd><p>Generate a control flow graph of the GVM code.
</p></dd>
<dt> <code>-dg</code></dt>
<dd><p>Generate a dependency graph.
</p></dd>
<dt> <code>-debug</code></dt>
<dd><p>Include all debugging information in the code generated.
</p></dd>
<dt> <code>-debug-location</code></dt>
<dd><p>Include source code location debugging information in the code generated.
</p></dd>
<dt> <code>-debug-source</code></dt>
<dd><p>Include the source code debugging information in the code generated.
</p></dd>
<dt> <code>-debug-environments</code></dt>
<dd><p>Include environment debugging information in the code generated.
</p></dd>
<dt> <code>-track-scheme</code></dt>
<dd><p>Generate ‘<samp>#line</samp>’ directives referring back to the Scheme code.
</p></dd>
<dt> <code>-o <var>output</var></code></dt>
<dd><p>Set name of output file or directory where output file(s) are written.
</p></dd>
<dt> <code>-dynamic</code></dt>
<dd><p>Compile Scheme source files to dynamically loadable object
files (this is the default).
</p></dd>
<dt> <code>-exe</code></dt>
<dd><p>Compile Scheme source files into an executable program.
</p></dd>
<dt> <code>-obj</code></dt>
<dd><p>Compile Scheme source files to object files.
</p></dd>
<dt> <code>-keep-c</code></dt>
<dd><p>Keep any intermediate ‘<samp>.c</samp>’ files that are generated.
</p></dd>
<dt> <code>-c</code></dt>
<dd><p>Compile Scheme source files to C without generating link file.
</p></dd>
<dt> <code>-link</code></dt>
<dd><p>Compile Scheme source files to C and generate a link file.
</p></dd>
<dt> <code>-flat</code></dt>
<dd><p>Generate a flat link file instead of the default incremental link file.
</p></dd>
<dt> <code>-l <var>base</var></code></dt>
<dd><p>Specify the link file of the base library to use for the link.
</p></dd>
<dt> <code>-module-name <var>module-name</var></code></dt>
<dd><p>Specify the name of the generated module.
</p></dd>
<dt> <code>-linker-name <var>linker-name</var></code></dt>
<dd><p>Specify the name of the low-level initialization function exported
by the module.
</p></dd>
<dt> <code>-</code></dt>
<dd><p>Start REPL interaction.
</p></dd>
<dt> <code>-e <var>expressions</var></code></dt>
<dd><p>Evaluate expressions in the interaction environment.
</p></dd>
</dl>
<a name="index-_002di"></a>
<p>The ‘<samp>-i</samp>’ option forces the compiler to process the remaining
command line arguments like the interpreter.
</p>
<a name="index-_002dprelude"></a>
<p>The ‘<samp>-prelude</samp>’ option adds the specified expressions to the top of
the source code being compiled. The main use of this option is to
supply declarations on the command line. For example the following
invocation of the compiler will compile the file ‘<samp>bench.scm</samp>’ in
unsafe mode:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -prelude "(declare (not safe))" bench.scm</b>
</pre></td></tr></table>
<a name="index-_002dpostlude"></a>
<p>The ‘<samp>-postlude</samp>’ option adds the specified expressions to the bottom
of the source code being compiled. The main use of this option is to
supply the expression that will start the execution of the program. For
example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -postlude "(start-bench)" bench.scm</b>
</pre></td></tr></table>
<a name="index-_002dcc_002doptions"></a>
<p>The ‘<samp>-cc-options</samp>’ option is only meaningful when a dynamically
loadable object file is being generated (neither the ‘<samp>-c</samp>’ or
‘<samp>-link</samp>’ options are used). The ‘<samp>-cc-options</samp>’ option adds
the specified options to the command that invokes the C compiler. The
main use of this option is to specify the include path, some symbols
to define or undefine, the optimization level, or any C compiler
option that is different from the default. For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -cc-options "-U___SINGLE_HOST -O2 -I../include" bench.scm</b>
</pre></td></tr></table>
<a name="index-_002dld_002doptions_002dprelude"></a>
<a name="index-_002dld_002doptions"></a>
<p>The ‘<samp>-ld-options-prelude</samp>’ and ‘<samp>-ld-options</samp>’ options are only
meaningful when a dynamically loadable object file is being generated
(neither the ‘<samp>-c</samp>’ or ‘<samp>-link</samp>’ options are used). The
‘<samp>-ld-options-prelude</samp>’ and ‘<samp>-ld-options</samp>’ options add the
specified options to the command that invokes the C linker (the
options in <var>ld-options-prelude</var> are passed to the C linker before
the input file and the options in <var>ld-options</var> are passed after).
The main use of this option is to specify additional object files or
libraries that need to be linked, or any C linker option that is
different from the default (such as the library search path and flags
to select between static and dynamic linking). For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -ld-options "-L/usr/X11R6/lib -lX11 -dynamic" bench.scm</b>
</pre></td></tr></table>
<a name="index-_002dwarnings"></a>
<p>The ‘<samp>-warnings</samp>’ option displays on standard output all warnings
that the compiler may have.
</p>
<a name="index-_002dverbose"></a>
<p>The ‘<samp>-verbose</samp>’ option displays on standard output a trace of the
compiler’s activity.
</p>
<a name="index-_002dreport"></a>
<p>The ‘<samp>-report</samp>’ option displays on standard output a global
variable usage report. Each global variable used in the program is
listed with 4 flags that indicate whether the global variable is
defined, referenced, mutated and called.
</p>
<a name="index-_002dexpansion"></a>
<p>The ‘<samp>-expansion</samp>’ option displays on standard output the source code
after expansion and inlining by the front end.
</p>
<a name="index-_002dgvm"></a>
<p>The ‘<samp>-gvm</samp>’ option generates a listing of the intermediate code
for the “Gambit Virtual Machine” (GVM) of each Scheme file on
‘<samp><var>file</var>.gvm</samp>’.
</p>
<a name="index-_002dcfg"></a>
<p>The ‘<samp>-cfg</samp>’ option generates a visual representation of the
control flow graph of the intermediate code for the “Gambit Virtual
Machine” (GVM) of each Scheme file on ‘<samp><var>file</var>.cfg</samp>’.
The file is suitable for processing with the “dot” program.
For example, to generate the PDF file ‘<samp><var>file</var>.cfg.pdf</samp>’
from ‘<samp><var>file</var>.cfg</samp>’ the following command can be used:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>dot -O -Tpdf <var>file</var>.cfg</b>
</pre></td></tr></table>
<a name="index-_002ddg"></a>
<p>The ‘<samp>-dg</samp>’ option generates a visual representation of the
dependency graph of each Scheme file on ‘<samp><var>file</var>.dg</samp>’.
The file is suitable for processing with the “dot” program.
For example, to generate the PDF file ‘<samp><var>file</var>.dg.pdf</samp>’
from ‘<samp><var>file</var>.dg</samp>’ the following command can be used:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>dot -O -Tpdf <var>file</var>.dg</b>
</pre></td></tr></table>
<a name="index-_002ddebug"></a>
<a name="index-debug"></a>
<p>The ‘<samp>-debug</samp>’ option causes all kinds of debugging information to
be saved in the code generated. See the documentation of the
‘<samp>debug</samp>’ declaration for details.
</p>
<a name="index-_002ddebug_002dlocation"></a>
<a name="index-debug_002dlocation"></a>
<p>The ‘<samp>-debug-location</samp>’ option causes source code location
debugging information to be saved in the code generated. See the
documentation of the ‘<samp>debug-location</samp>’ declaration for details.
</p>
<a name="index-_002ddebug_002dsource"></a>
<a name="index-debug_002dsource"></a>
<p>The ‘<samp>-debug-source</samp>’ option causes source code debugging
information to be saved in the code generated. See the documentation
of the ‘<samp>debug-source</samp>’ declaration for details.
</p>
<a name="index-_002ddebug_002denvironments"></a>
<a name="index-debug_002denvironments"></a>
<p>The ‘<samp>-debug-environments</samp>’ option causes environment debugging
information to be saved in the code generated. See the documentation
of the ‘<samp>debug-environments</samp>’ declaration for details.
</p>
<a name="index-_002dtrack_002dscheme"></a>
<p>The ‘<samp>-track-scheme</samp>’ options causes the generation of ‘<samp>#line</samp>’
directives that refer back to the Scheme source code. This allows the
use of a C debugger or profiler to debug Scheme code.
</p>
<a name="index-_002do-output"></a>
<p>The ‘<samp>-o</samp>’ option sets the filename of the output file, or the
directory in which the output file(s) generated by the compiler are
written.
</p>
<a name="index-_002dc"></a>
<a name="index-_002ddynamic"></a>
<a name="index-_002dexe-1"></a>
<a name="index-_002dobj"></a>
<a name="index-_002dlink-1"></a>
<a name="index-_002dkeep_002dc"></a>
<a name="index-last_005f_002ec"></a>
<p>If the ‘<samp>-link</samp>’ or ‘<samp>-exe</samp>’ options appear on the command line,
the Gambit linker is invoked to generate the link file from the set of
C files specified on the command line or produced by the Gambit
compiler. By default the link file is ‘<samp><var>last</var>_.c</samp>’, where
‘<samp><var>last</var>.c</samp>’ is the last file in the set of C files. When the
‘<samp>-c</samp>’ option is specified, the Scheme source files are compiled to
C files. When the ‘<samp>-exe</samp>’ option is specified, the generated C
files and link file are compiled and linked using the C compiler to
produce an executable program whose name defaults to
‘<samp><var>last</var>.exe</samp>’. When the ‘<samp>-obj</samp>’ option is specified, the
generated C files are compiled using the C compiler to produce object
files (‘<samp>.o</samp>’ or ‘<samp>.obj</samp>’ extensions). If neither the
‘<samp>-link</samp>’, ‘<samp>-c</samp>’, ‘<samp>-exe</samp>’, ‘<samp>-obj</samp>’ options appear on
the command line, the Scheme source files are compiled to dynamically
loadable object files (‘<samp>.o<var>n</var></samp>’ extension). The
‘<samp>-keep-c</samp>’ option will prevent the deletion of any intermediate
‘<samp>.c</samp>’ file that is generated. Note that in this case the
intermediate ‘<samp>.c</samp>’ file will be generated in the same directory as
the Scheme source file even if the ‘<samp>-o</samp>’ option is used.
</p>
<a name="index-_002dflat"></a>
<p>The ‘<samp>-flat</samp>’ option is only meaningful when a link file is being
generated (i.e. the ‘<samp>-link</samp>’ or ‘<samp>-exe</samp>’ options also appear on
the command line). The ‘<samp>-flat</samp>’ option directs the Gambit linker
to generate a flat link file. By default, the linker generates an
incremental link file (see the next section for a description of the
two types of link files).
</p>
<a name="index-_002dl-base"></a>
<p>The ‘<samp>-l</samp>’ option is only meaningful when an incremental link file
is being generated (i.e. the ‘<samp>-link</samp>’ or ‘<samp>-exe</samp>’ options
appear on the command line and the ‘<samp>-flat</samp>’ option is absent).
The ‘<samp>-l</samp>’ option specifies the link file (without the ‘<samp>.c</samp>’
extension) of the base library to use for the incremental link. By
default the link file of the Gambit runtime library is used
(i.e. ‘<samp>~~lib/_gambit.c</samp>’).
</p>
<a name="index-_002d"></a>
<p>The ‘<samp>-</samp>’ option starts a REPL interaction.
</p>
<a name="index-_002de"></a>
<p>The ‘<samp>-e</samp>’ option evaluates the specified expressions in the
interaction environment.
</p>
<hr size="6">
<a name="Link-files"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GSC-batch-mode" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Building-an-executable-program" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Link-files-1"></a>
<h2 class="section">3.4 Link files</h2>
<p>Gambit can be used to create programs and libraries of Scheme
modules. This section explains the steps required to do so and the role
played by the link files.
</p>
<p>In general, a program is composed of a set of Scheme modules and C
modules. Some of the modules are part of the Gambit runtime library and
the other modules are supplied by the user. When the program is
started it must setup various global tables (including the symbol table
and the global variable table) and then sequentially execute the Scheme
modules (more or less as though they were being loaded one after another).
The information required for this is contained in one or more <em>link
files</em> generated by the Gambit linker from the C files produced by the
Gambit compiler.
</p>
<p>The order of execution of the Scheme modules corresponds to the order of
the modules on the command line which produced the link file. The order
is usually important because most modules define variables and
procedures which are used by other modules (for this reason the
program’s main computation is normally started by the last module).
</p>
<p>When a single link file is used to contain the linking information of
all the Scheme modules it is called a <em>flat link file</em>. Thus a
program built with a flat link file contains in its link file both
information on the user modules and on the runtime library. This is
fine if the program is to be statically linked but is wasteful in
a shared-library context because the linking information of the
runtime library can’t be shared and will be duplicated in all
programs (this linking information typically takes hundreds of kilobytes).
</p>
<p>Flat link files are mainly useful to bundle multiple Scheme modules to
make a runtime library (such as the Gambit runtime library) or to make a
single file that can be loaded with the <code>load</code> procedure.
</p>
<p>An <em>incremental link file</em> contains only the linking information
that is not already contained in a second link file (the “base” link
file). Assuming that a flat link file was produced when the runtime
library was linked, a program can be built by linking the user
modules with the runtime library’s link file, producing an incremental
link file. This allows the creation of a shared-library which
contains the modules of the runtime library and its flat link file.
The program is dynamically linked with this shared-library and
only contains the user modules and the incremental link file. For
small programs this approach greatly reduces the size of the
program because the incremental link file is small. A “hello
world” program built this way can be as small as 5 Kbytes. Note that
it is perfectly fine to use an incremental link file for statically
linked programs (there is very little loss compared to a single flat
link file).
</p>
<p>Incremental link files may be built from other incremental link files.
This allows the creation of shared-libraries which extend the
functionality of the Gambit runtime library.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Building-an-executable-program">3.4.1 Building an executable program</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Building-a-loadable-library">3.4.2 Building a loadable library</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Building-an-executable-program"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Link-files" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Building-a-loadable-library" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Link-files" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Building-an-executable-program-1"></a>
<h3 class="subsection">3.4.1 Building an executable program</h3>
<p>The simplest way to create an executable program is to invoke
<code>gsc</code> with the ‘<samp>-exe</samp>’ option. The compiler will
transparently perform all the steps necessary, including compiling
Scheme source files to C files, generating the link file, compiling
the C files generated to object files, and creating the final
executable file using the C linker. The following example shows how
to build the executable program ‘<samp>hello.exe</samp>’ which contains the
two Scheme modules ‘<samp>h.scm</samp>’ and ‘<samp>w.six</samp>’.
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat h.scm</b>
(display "hello") (newline)
$ <b>cat w.six</b>
display("world"); newline();
$ <b>gsc -o hello.exe -exe h.scm w.six</b>
h.scm:
/Users/feeley/gambit/doc/h.c:
w.six:
/Users/feeley/gambit/doc/w.c:
/Users/feeley/gambit/doc/w_.c:
$ <b>./hello.exe</b>
hello
world
</pre></td></tr></table>
<p>The detailed steps which are performed can be viewed by setting the
‘<samp>GAMBCOMP_VERBOSE</samp>’ environment variable to a nonnull value. For
example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>export GAMBCOMP_VERBOSE=yes</b>
$ <b>gsc -o hello.exe -exe h.scm w.six</b>
h.scm:
/Users/feeley/gambit/doc/h.c:
gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2
-fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer
-fPIC -fno-common -I"/usr/local/Gambit/include" -c -o "h.o" h.c
w.six:
/Users/feeley/gambit/doc/w.c:
gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2
-fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer
-fPIC -fno-common -I"/usr/local/Gambit/include" -c -o "w.o" w.c
/Users/feeley/gambit/doc/w_.c:
gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2
-fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer
-fPIC -fno-common -I"/usr/local/Gambit/include" -c -o "w_.o" w_.c
gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2
-fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer
-fPIC -fno-common -I"/usr/local/Gambit/include"
-o "hello.exe" h.o w.o w_.o "/usr/local/Gambit/lib/libgambit.a"
</pre></td></tr></table>
<p>Using a single invocation of <code>gsc</code> with the ‘<samp>-exe</samp>’ option is
sometimes inappropriate when the build process is more complex, for
example when the program is composed of several seperately compiled
modules. In such a case it is useful to decompose the build process
into smaller compilation steps. The ‘<samp>hello.exe</samp>’ executable
program could have been built by seperating the generation of C files
from the C compilation and linking:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -c h.scm</b>
$ <b>gsc -c w.six</b>
$ <b>gsc -o hello.exe -exe h.c w.c</b>
</pre></td></tr></table>
<p>When even finer control is desired the build process can be decomposed
into smaller steps that invoke the C compiler and linker explicitly.
This is described in the rest of this section.
</p>
<p>The <code>gsc</code> compiler can be invoked to compile each Scheme module
into a C file and to create an incremental link file. The C files and
the link file must then be compiled with a C compiler and linked (at
the object file level) with the Gambit runtime library and possibly
other libraries (such as the math library and the dynamic loading
library).
</p>
<p>Here is for example how a program with three modules (one in C and two
in Scheme) can be built. The content of the three source files (‘<samp>m1.c</samp>’,
‘<samp>m2.scm</samp>’ and ‘<samp>m3.scm</samp>’) is:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>/* File: "m1.c" */
int power_of_2 (int x) { return 1<<x; }
; File: "m2.scm"
(c-declare "extern int power_of_2 ();")
(define pow2 (c-lambda (int) int "power_of_2"))
(define (twice x) (cons x x))
; File: "m3.scm"
(write (map twice (map pow2 '(1 2 3 4)))) (newline)
</pre></td></tr></table>
<p>The compilation of the two Scheme source files can be done with
three invocations of <code>gsc</code>:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -c m2.scm <span class="roman"><i># create m2.c (note: .scm is optional)</i></span></b>
$ <b>gsc -c m3.scm <span class="roman"><i># create m3.c (note: .scm is optional)</i></span></b>
$ <b>gsc -link m2.c m3.c <span class="roman"><i># create the incremental link file m3_.c</i></span></b>
</pre></td></tr></table>
<p>Alternatively, the three invocations of <code>gsc</code> can be replaced by a
single invocation:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -link m2 m3</b>
m2:
m3:
</pre></td></tr></table>
<p>At this point there will be 4 C files: ‘<samp>m1.c</samp>’, ‘<samp>m2.c</samp>’,
‘<samp>m3.c</samp>’, and ‘<samp>m3_.c</samp>’. To produce an executable program these
files must be compiled with a C compiler and linked with the Gambit
runtime library. The C compiler options needed will depend on the C
compiler and the operating system (in particular it may be necessary
to add the options ‘<samp>-I/usr/local/Gambit/include
-L/usr/local/Gambit/lib</samp>’ to access the ‘<samp>gambit.h</samp>’ header file
and the Gambit runtime library).
</p>
<p>Here is an example under Mac OS X:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b>
Darwin 8.1.0 Power Macintosh powerpc
$ <b>gsc -obj m1.c m2.c m3.c m3_.c</b>
m1.c:
m2.c:
m3.c:
m3_.c:
$ <b>gcc m1.o m2.o m3.o m3_.o -lgambit</b>
$ <b>./a.out</b>
((2 . 2) (4 . 4) (8 . 8) (16 . 16))
</pre></td></tr></table>
<p>Here is an example under Linux:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b>
Linux 2.6.8-1.521 i686 athlon
$ <b>gsc -obj m1.c m2.c m3.c m3_.c</b>
m1.c:
m2.c:
m3.c:
m3_.c:
$ <b>gcc m1.o m2.o m3.o m3_.o -lgambit -lm -ldl -lutil</b>
$ <b>./a.out</b>
((2 . 2) (4 . 4) (8 . 8) (16 . 16))
</pre></td></tr></table>
<hr size="6">
<a name="Building-a-loadable-library"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Building-an-executable-program" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Building-a-shared_002dlibrary" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Link-files" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Building-a-loadable-library-1"></a>
<h3 class="subsection">3.4.2 Building a loadable library</h3>
<a name="index-_002dD_005f_005f_005fDYNAMIC"></a>
<p>To bundle multiple modules into a single object file that can be
dynamically loaded with the <code>load</code> procedure, a flat link file is
needed. The compiler’s ‘<samp>-o</samp>’ option must be used to name the C
file generated as follows. If the dynamically loadable object file is
to be named ‘<samp><var>myfile</var>.o<var>n</var></samp>’ then the ‘<samp>-o</samp>’ option
must set the name of the link file generated to
‘<samp><var>myfile</var>.o<var>n</var>.c</samp>’ (note that the ‘<samp>.c</samp>’ extension
could also be ‘<samp>.cc</samp>’, ‘<samp>.cpp</samp>’ or whatever extension is
appropriate for C/C++ source files). The three modules of the
previous example can be bundled by generating a link file in this way:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -link -flat -o foo.o1.c m2 m3</b>
m2:
m3:
*** WARNING -- "cons" is not defined,
*** referenced in: ("m2.c")
*** WARNING -- "map" is not defined,
*** referenced in: ("m3.c")
*** WARNING -- "newline" is not defined,
*** referenced in: ("m3.c")
*** WARNING -- "write" is not defined,
*** referenced in: ("m3.c")
</pre></td></tr></table>
<p>The warnings indicate that there are no definitions (<code>define</code>s or
<code>set!</code>s) of the variables <code>cons</code>, <code>map</code>, <code>newline</code>
and <code>write</code> in the set of modules being linked. Before
‘<samp>foo.o1</samp>’ is loaded, these variables will have to be bound; either
implicitly (by the runtime library) or explicitly.
</p>
<p>When compiling the C files and link file generated, the flag
‘<samp>-D___DYNAMIC</samp>’ must be passed to the C compiler and the C
compiler and linker must be told to generate a dynamically loadable
shared library.
</p>
<p>Here is an example under Mac OS X:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b>
Darwin 10.5.0 i386 i386
$ <b>gsc -link -flat -o foo.o1.c m2 m3 > /dev/null</b>
m2:
m3:
$ <b>gsc -cc-options "-D___DYNAMIC" -obj m1.c m2.c m3.c foo.o1.c</b>
m1.c:
m2.c:
m3.c:
foo.o1.c:
$ <b>gcc -bundle m1.o m2.o m3.o foo.o1.o -o foo.o1</b>
$ <b>gsi foo.o1</b>
((2 . 2) (4 . 4) (8 . 8) (16 . 16))
</pre></td></tr></table>
<p>Here is an example under Linux:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b>
Linux 2.6.8-1.521 i686 athlon
$ <b>gsc -link -flat -o foo.o1.c m2 m3 > /dev/null</b>
m2:
m3:
$ <b>gsc -cc-options "-D___DYNAMIC" -obj m1.c m2.c m3.c foo.o1.c</b>
m1.c:
m2.c:
m3.c:
foo.o1.c:
$ <b>gcc -shared m1.o m2.o m3.o foo.o1.o -o foo.o1</b>
$ <b>gsi foo.o1</b>
((2 . 2) (4 . 4) (8 . 8) (16 . 16))
</pre></td></tr></table>
<p>Here is a more complex example, under Solaris, which shows how to build
a loadable library ‘<samp>mymod.o1</samp>’ composed of the files ‘<samp>m4.scm</samp>’,
‘<samp>m5.scm</samp>’ and ‘<samp>x.c</samp>’ that links to system shared libraries (for
X-windows):
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b>
SunOS ungava 5.6 Generic_105181-05 sun4m sparc SUNW,SPARCstation-20
$ <b>gsc -link -flat -o mymod.o1.c m4 m5</b>
m4:
m5:
*** WARNING -- "*" is not defined,
*** referenced in: ("m4.c")
*** WARNING -- "+" is not defined,
*** referenced in: ("m5.c")
*** WARNING -- "display" is not defined,
*** referenced in: ("m5.c" "m4.c")
*** WARNING -- "newline" is not defined,
*** referenced in: ("m5.c" "m4.c")
*** WARNING -- "write" is not defined,
*** referenced in: ("m5.c")
$ <b>gsc -cc-options "-D___DYNAMIC" -obj m4.c m5.c x.c mymod.o1.c</b>
m4.c:
m5.c:
x.c:
mymod.o1.c:
$ <b>/usr/ccs/bin/ld -G -o mymod.o1 mymod.o1.o m4.o m5.o x.o -lX11 -lsocket</b>
$ <b>gsi mymod.o1</b>
hello from m4
hello from m5
(f1 10) = 22
$ <b>cat m4.scm</b>
(define (f1 x) (* 2 (f2 x)))
(display "hello from m4")
(newline)
(c-declare #<<c-declare-end
#include "x.h"
c-declare-end
)
(define x-initialize (c-lambda (char-string) bool "x_initialize"))
(define x-display-name (c-lambda () char-string "x_display_name"))
(define x-bell (c-lambda (int) void "x_bell"))
$ <b>cat m5.scm</b>
(define (f2 x) (+ x 1))
(display "hello from m5")
(newline)
(display "(f1 10) = ")
(write (f1 10))
(newline)
(x-initialize (x-display-name))
(x-bell 50) ; sound the bell at 50%
$ <b>cat x.c</b>
#include <X11/Xlib.h>
static Display *display;
int x_initialize (char *display_name)
{
display = XOpenDisplay (display_name);
return display != NULL;
}
char *x_display_name (void)
{
return XDisplayName (NULL);
}
void x_bell (int volume)
{
XBell (display, volume);
XFlush (display);
}
$ <b>cat x.h</b>
int x_initialize (char *display_name);
char *x_display_name (void);
void x_bell (int);
</pre></td></tr></table>
<hr size="6">
<a name="Building-a-shared_002dlibrary"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Building-a-loadable-library" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Other-compilation-options" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Link-files" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Building-a-shared_002dlibrary-1"></a>
<h3 class="subsection">3.4.3 Building a shared-library</h3>
<a name="index-_002dD_005f_005f_005fPRIMAL"></a>
<a name="index-_002dD_005f_005f_005fLIBRARY"></a>
<a name="index-_002dD_005f_005f_005fSHARED"></a>
<p>A shared-library can be built using an incremental link file or a flat
link file. An incremental link file is normally used when the Gambit
runtime library (or some other library) is to be extended with new
procedures. A flat link file is mainly useful when building a
“primal” runtime library, which is a library (such as the Gambit
runtime library) that does not extend another library. When compiling
the C files and link file generated, the flags ‘<samp>-D___LIBRARY</samp>’ and
‘<samp>-D___SHARED</samp>’ must be passed to the C compiler. The flag
‘<samp>-D___PRIMAL</samp>’ must also be passed to the C compiler when a primal
library is being built.
</p>
<p>A shared-library ‘<samp>mylib.so</samp>’ containing the two first modules of
the previous example can be built this way:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b>
Linux bailey 1.2.13 #2 Wed Aug 28 16:29:41 GMT 1996 i586
$ <b>gsc -link -o mylib.c m2</b>
$ <b>gsc -obj -cc-options "-D___SHARED" m1.c m2.c mylib.c</b>
m1.c:
m2.c:
mylib.c:
$ <b>gcc -shared m1.o m2.o mylib.o -o mylib.so</b>
</pre></td></tr></table>
<p>Note that this shared-library is built using an incremental link file
(it extends the Gambit runtime library with the procedures <code>pow2</code>
and <code>twice</code>). This shared-library can in turn be used to build
an executable program from the third module of the previous example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -link -l mylib m3</b>
$ <b>gsc -obj m3.c m3_.c</b>
m3.c:
m3_.c:
$ <b>gcc m3.o m3_.o mylib.so -lgambit</b>
$ <b>LD_LIBRARY_PATH=.:/usr/local/lib ./a.out</b>
((2 . 2) (4 . 4) (8 . 8) (16 . 16))
</pre></td></tr></table>
<hr size="6">
<a name="Other-compilation-options"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Building-a-shared_002dlibrary" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Procedures-specific-to-compiler" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Link-files" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Other-compilation-options-1"></a>
<h3 class="subsection">3.4.4 Other compilation options</h3>
<a name="index-_002dD_005f_005f_005fSINGLE_005fHOST"></a>
<a name="index-_002dO"></a>
<p>The performance of the code can be increased by passing the
‘<samp>-D___SINGLE_HOST</samp>’ flag to the C compiler. This will merge all
the procedures of a module into a single C procedure, which reduces
the cost of intra-module procedure calls. In addition the ‘<samp>-O</samp>’
option can be passed to the C compiler. For large modules, it will
not be practical to specify both ‘<samp>-O</samp>’ and ‘<samp>-D___SINGLE_HOST</samp>’
for typical C compilers because the compile time will be high and the
C compiler might even fail to compile the program for lack of memory.
It has been observed that lower levels of optimization (e.g. ‘<samp>-O1</samp>’)
often give faster compilation and also generate faster code. It is
a good idea to experiment.
</p>
<a name="index-_002dI_002fusr_002flocal_002fGambit_002finclude"></a>
<a name="index-_002dL_002fusr_002flocal_002fGambit_002flib"></a>
<p>Normally C compilers will not automatically search
‘<samp>/usr/local/Gambit/include</samp>’ for header files so the flag
‘<samp>-I/usr/local/Gambit/include</samp>’ should be passed to the C
compiler. Similarly, C compilers/linkers will not automatically
search ‘<samp>/usr/local/Gambit/lib</samp>’ for libraries so the flag
‘<samp>-L/usr/local/Gambit/lib</samp>’ should be passed to the C
compiler/linker. Alternatives are given in <a href="#Accessing-the-system-files">Accessing the system files</a>.
</p>
<a name="index-_002dshared"></a>
<a name="index-_002dcall_005fshared"></a>
<a name="index-_002drdynamic"></a>
<a name="index-_002dfpic"></a>
<a name="index-_002dfPIC"></a>
<a name="index-_002dKpic"></a>
<a name="index-_002dKPIC"></a>
<a name="index-_002dpic"></a>
<a name="index-_002bz"></a>
<a name="index-_002dG"></a>
<p>A variety of flags are needed by some C compilers when compiling a
shared-library or a dynamically loadable library. Some of these flags
are: ‘<samp>-shared</samp>’, ‘<samp>-call_shared</samp>’, ‘<samp>-rdynamic</samp>’,
‘<samp>-fpic</samp>’, ‘<samp>-fPIC</samp>’, ‘<samp>-Kpic</samp>’, ‘<samp>-KPIC</samp>’, ‘<samp>-pic</samp>’,
‘<samp>+z</samp>’, ‘<samp>-G</samp>’. Check your compiler’s documentation to see
which flag you need.
</p>
<hr size="6">
<a name="Procedures-specific-to-compiler"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Other-compilation-options" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#GSC" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Procedures-specific-to-compiler-1"></a>
<h2 class="section">3.5 Procedures specific to compiler</h2>
<p>The Gambit Scheme compiler features the following procedures that
are not available in the Gambit Scheme interpreter.
</p>
<a name="Definition_of_compile-file-to-target"></a><a name="Procedure_compile-file-to-target"></a><a name="index-compile_002dfile_002dto_002dtarget"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_compile-file-to-target">compile-file-to-target</a></b></code><i> <var>file</var> <span class="roman">[</span><code>options:</code> <var>options</var><span class="roman">]</span> <span class="roman">[</span><code>output:</code> <var>output</var><span class="roman">]</span> <span class="roman">[</span><code>module-name:</code> <var>module-name</var><span class="roman">]</span> <span class="roman">[</span><code>linker-name:</code> <var>linker-name</var><span class="roman">]</span> <span class="roman">[</span><code>expression:</code> <var>expression</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-gsc-2"></a>
<p>The <var>file</var> parameter must be a string. If <var>expression</var> is not
specified, <var>file</var> must name an existing file
containing Scheme source code. The extension can be omitted from
<var>file</var> when the Scheme file has a ‘<samp>.scm</samp>’ or ‘<samp>.six</samp>’
extension. By default, this procedure compiles the source file into a file
containing C code. A different target language can be selected in
the <var>options</var>. The generated file is named after <var>file</var>
with the extension replaced with ‘<samp>.c</samp>’, or an appropriate extension
for the target selected. The name of the generated
file can also be specified directly with the <var>output</var> parameter. If
<var>output</var> is a string naming a directory then the generated file is created
in that directory. Otherwise the name of the generated file is <var>output</var>.
</p>
<p>The name of the generated module can be specified with the
<var>module-name</var> parameter. If <var>module-name</var> is <code>#f</code> or is
not specified, then the name of the module is derived from the name of
the file generated, without the extension.
</p>
<p>The name of the low-level initialization function exported by the
module can be specified with the <var>linker-name</var> parameter. If
<var>linker-name</var> is <code>#f</code> or is not specified, then the name of
the function is derived from the name of the module.
</p>
<p>Compilation options are specified through the <var>options</var> parameter
which must be a list of symbols. Any combination of the following
options can be used: ‘<samp>target</samp>’, ‘<samp>verbose</samp>’, ‘<samp>report</samp>’, ‘<samp>expansion</samp>’,
‘<samp>gvm</samp>’, and ‘<samp>debug</samp>’.
</p>
<p>When <var>expression</var> is specified, the <var>file</var> parameter is not
open or read. Instead, <var>expression</var> is used as though it was the
content of the file. This makes it possible to compile source code
without having to create a file to contain the code. Note that
<var>file</var> is used in error messages and to determine the output file
name if <var>output</var> is not specified.
</p>
<p>When the compilation is successful, <code>compile-file-to-target</code> returns
the name of the file generated. When there is a compilation error,
<code>#f</code> is returned.
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat h.scm</b>
(display "hello") (newline)
$ <b>gsc</b>
Gambit v4.9.3
> <b>(compile-file-to-target "h")</b>
"/Users/feeley/gambit/doc/h.c"
</pre></td></tr></table>
<a name="Definition_of_compile-file"></a><a name="Procedure_compile-file"></a><a name="index-compile_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_compile-file">compile-file</a></b></code><i> <var>file</var> <span class="roman">[</span><code>options:</code> <var>options</var><span class="roman">]</span> <span class="roman">[</span><code>output:</code> <var>output</var><span class="roman">]</span> <span class="roman">[</span><code>module-name:</code> <var>module-name</var><span class="roman">]</span> <span class="roman">[</span><code>linker-name:</code> <var>linker-name</var><span class="roman">]</span> <span class="roman">[</span><code>expression:</code> <var>expression</var><span class="roman">]</span> <span class="roman">[</span><code>cc-options:</code> <var>cc-options</var><span class="roman">]</span> <span class="roman">[</span><code>ld-options-prelude:</code> <var>ld-options-prelude</var><span class="roman">]</span> <span class="roman">[</span><code>ld-options:</code> <var>ld-options</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-gsc-3"></a>
<a name="index-load"></a>
<a name="index-object-file"></a>
<p>The <var>file</var>, <var>options</var>, <var>output</var>, <var>module-name</var>, <var>linker-name</var>, and <var>expression</var> parameters have the
same meaning as for the <code>compile-file-to-target</code> procedure, except that
<var>file</var> may be a Scheme source file or a
file possibly generated by the Gambit Scheme compiler (for example
with the <code>compile-file-to-target</code> procedure). The
<var>cc-options</var> parameter is a string containing the options to pass
to the C compiler and the <var>ld-options-prelude</var> and
<var>ld-options</var> parameters are strings containing the options to pass
to the C linker (the options in <var>ld-options-prelude</var> are passed to
the C linker before the input file and the options in <var>ld-options</var>
are passed after).
</p>
<p>The <code>compile-file</code> procedure compiles the source file <var>file</var>
into an object file, which is either a file dynamically loadable using
the <code>load</code> procedure, or a C linkable object file destined to be
linked with the C linker (for example to create a standalone
executable program). The presence of the
<code>obj</code> option in <var>options</var> will cause the creation of a C
linkable object file and therefore the options
<var>ld-options-prelude</var> and <var>ld-options</var> are ignored, otherwise a
dynamically loadable file is created. In both cases, if <var>file</var> is
a Scheme source file, the compiler first compiles <var>file</var> to a C
file which is created in the same directory as <var>file</var> regardless
of the <var>output</var> parameter. Then the C file is compiled with the C
compiler.
</p>
<p>When the compilation is successful, <code>compile-file</code> returns the
name of the object file generated. When there is a compilation error,
<code>#f</code> is returned.
</p>
<p>The name of the object file can be specified with the <var>output</var>
parameter. If <var>output</var> is a string naming a directory then the
object file is created in that directory. Otherwise the name of the
object file is <var>output</var>.
</p>
<p>In the case of a dynamically loadable object file, by default the
object file is named after <var>file</var> with the extension replaced with
‘<samp>.o<var>n</var></samp>’, where <var>n</var> is a positive integer that acts as a
version number. The next available version number is generated
automatically by <code>compile-file</code>.
</p>
<p>When dynamically loaded object files are loaded using the <code>load</code>
procedure, the ‘<samp>.o<var>n</var></samp>’ extension can be specified (to select
a particular version) or omitted (to load the file with a
‘<samp>.o<var>n</var></samp>’ extension with the highest <var>n</var> consecutively from
1). When the ‘<samp>.o<var>n</var></samp>’ extension is not specified and older
versions are no longer needed, all versions must be deleted and the
compilation must be repeated (this is necessary because the file name,
including the extension, is used to name some of the exported symbols
of the object file).
</p>
<p>Note that dynamically loadable object files can only be generated on
host operating systems that support dynamic loading.
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat h.scm</b>
(display "hello") (newline)
$ <b>gsc</b>
Gambit v4.9.3
> <b>(compile-file "h")</b>
"/Users/feeley/gambit/doc/h.o1"
> <b>(load "h")</b>
hello
"/Users/feeley/gambit/doc/h.o1"
> <b>(compile-file-to-target "h" output: "h.o99.c")</b>
"/Users/feeley/gambit/doc/h.o99.c"
> <b>(compile-file "h.o99.c")</b>
"/Users/feeley/gambit/doc/h.o99"
> <b>(load "h.o99")</b>
hello
"/Users/feeley/gambit/doc/h.o99"
> <b>(compile-file-to-target "h")</b>
"/Users/feeley/gambit/doc/h.c"
> <b>(compile-file "h.c" options: '(obj))</b>
"/Users/feeley/gambit/doc/h.o"
</pre></td></tr></table>
<a name="Definition_of_link-incremental"></a><a name="Procedure_link-incremental"></a><a name="index-link_002dincremental"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_link-incremental">link-incremental</a></b></code><i> <var>module-list</var> <span class="roman">[</span><code>output:</code> <var>output</var><span class="roman">]</span> <span class="roman">[</span><code>linker-name:</code> <var>linker-name</var><span class="roman">]</span> <span class="roman">[</span><code>base:</code> <var>base</var><span class="roman">]</span> <span class="roman">[</span><code>warnings?:</code> <var>warnings?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-gsc-4"></a>
<p>The first parameter must be a non empty list of strings naming Scheme
modules to link (the file extension may be omitted). An incremental link
file is generated for the modules specified in <var>module-list</var>. By
default the link file generated is named ‘<samp><var>last</var>_.c</samp>’, where
<var>last</var> is the name of the last module, without the file extension.
The name of the generated
link file can be specified with the <var>output</var> parameter. If
<var>output</var> is a string naming a directory then the link file is
created in that directory. Otherwise the name of the link file is
<var>output</var>.
</p>
<p>The base link file is specified by the <var>base</var> parameter, which
must be a string. By default the base link file is the Gambit runtime
library link file ‘<samp>~~lib/_gambit.c</samp>’. However, when <var>base</var> is
supplied it is the name of the base link file (the file extension
may be omitted).
</p>
<p>The <var>warnings?</var> parameter controls whether warnings are
generated for undefined references.
</p>
<p>The following example shows how to build the executable program
‘<samp>hello</samp>’ which contains the two Scheme modules ‘<samp>h.scm</samp>’ and
‘<samp>w.six</samp>’.
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b>
Darwin 8.1.0 Power Macintosh powerpc
$ <b>cat h.scm</b>
(display "hello") (newline)
$ <b>cat w.six</b>
display("world"); newline();
$ <b>gsc</b>
Gambit v4.9.3
> <b>(compile-file-to-target "h")</b>
"/Users/feeley/gambit/doc/h.c"
> <b>(compile-file-to-target "w")</b>
"/Users/feeley/gambit/doc/w.c"
> <b>(link-incremental '("h" "w") output: "hello.c")</b>
"/Users/feeley/gambit/doc/hello_.c"
> <b>,q</b>
$ <b>gsc -obj h.c w.c hello.c</b>
h.c:
w.c:
hello.c:
$ <b>gcc h.o w.o hello.o -lgambit -o hello</b>
$ <b>./hello</b>
hello
world
</pre></td></tr></table>
<a name="Definition_of_link-flat"></a><a name="Procedure_link-flat"></a><a name="index-link_002dflat"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_link-flat">link-flat</a></b></code><i> <var>module-list</var> <span class="roman">[</span><code>output:</code> <var>output</var><span class="roman">]</span> <span class="roman">[</span><code>linker-name:</code> <var>linker-name</var><span class="roman">]</span> <span class="roman">[</span><code>warnings?:</code> <var>warnings?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-gsc-5"></a>
<p>The first parameter must be a non empty list of strings naming Scheme
modules to link (the file extension may be omitted). The first string
must be the name of a Scheme module
or the name of a link file and the remaining strings must name Scheme
modules. A flat link file
is generated for the modules specified in <var>module-list</var>. By
default the link file generated is named ‘<samp><var>last</var>_.c</samp>’, where
<var>last</var> is the name of the last module. The name of the generated
link file can be specified with the <var>output</var> parameter. If
<var>output</var> is a string naming a directory then the link file is
created in that directory. Otherwise the name of the link file is
<var>output</var>. If a dynamically loadable object file is produced from
the link file ‘<samp><var>output</var></samp>’, then the name of the dynamically
loadable object file must be ‘<samp><var>output</var></samp>’ stripped of its file
extension.
</p>
<p>The <var>warnings?</var> parameter controls whether warnings are
generated for undefined references.
</p>
<p>The following example shows how to build the dynamically loadable object
file ‘<samp>lib.o1</samp>’ which contains the two Scheme modules
‘<samp>m6.scm</samp>’ and ‘<samp>m7.scm</samp>’.
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b>
Darwin 8.1.0 Power Macintosh powerpc
$ <b>cat m6.scm</b>
(define (f x) (g (* x x)))
$ <b>cat m7.scm</b>
(define (g y) (+ n y))
$ <b>gsc</b>
Gambit v4.9.3
> <b>(compile-file-to-target "m6")</b>
"/Users/feeley/gambit/doc/m6.c"
> <b>(compile-file-to-target "m7")</b>
"/Users/feeley/gambit/doc/m7.c"
> <b>(link-flat '("m6" "m7") output: "lib.o1.c")</b>
*** WARNING -- "*" is not defined,
*** referenced in: ("m6.c")
*** WARNING -- "+" is not defined,
*** referenced in: ("m7.c")
*** WARNING -- "n" is not defined,
*** referenced in: ("m7.c")
"/Users/feeley/gambit/doc/lib.o1.c"
> <b>,q</b>
$ <b>gcc -bundle -D___DYNAMIC m6.c m7.c lib.o1.c -o lib.o1</b>
$ <b>gsc</b>
Gambit v4.9.3
> <b>(load "lib")</b>
*** WARNING -- Variable "n" used in module "m7" is undefined
"/Users/feeley/gambit/doc/lib.o1"
> <b>(define n 10)</b>
> <b>(f 5)</b>
35
> <b>,q</b>
</pre></td></tr></table>
<p>The warnings indicate that there are no definitions (<code>define</code>s or
<code>set!</code>s) of the variables <code>*</code>, <code>+</code> and <code>n</code> in the
modules contained in the library. Before the library is used, these
variables will have to be bound; either implicitly (by the runtime
library) or explicitly.
</p>
<hr size="6">
<a name="Runtime-options"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Procedures-specific-to-compiler" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#GSC" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Runtime-options-1"></a>
<h1 class="chapter">4. Runtime options</h1>
<a name="index-runtime-options"></a>
<a name="index-options_002c-runtime"></a>
<a name="index-gsc-6"></a>
<a name="index-gsi-2"></a>
<p>Both <code>gsi</code> and <code>gsc</code> as well as executable programs compiled
and linked using <code>gsc</code> take a ‘<samp>-:</samp>’ option which supplies
parameters to the runtime system. This option must appear first on
the command line. The colon is followed by a comma separated list of
options with no intervening spaces. The available options are:
</p>
<dl compact="compact">
<dt> <code>m<var>HEAPSIZE</var></code></dt>
<dd><p>Set minimum heap size in kilobytes.
</p></dd>
<dt> <code>h<var>HEAPSIZE</var></code></dt>
<dd><p>Set maximum heap size in kilobytes.
</p></dd>
<dt> <code>l<var>LIVEPERCENT</var></code></dt>
<dd><p>Set heap occupation after garbage collection.
</p></dd>
<dt> <code>s</code></dt>
<dd><p>Select standard Scheme mode.
</p></dd>
<dt> <code>S</code></dt>
<dd><p>Select Gambit Scheme mode.
</p></dd>
<dt> <code>d<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt>
<dd><p>Set debugging options.
</p></dd>
<dt> <code>@<span class="roman">[</span><var>INTF</var><span class="roman">]</span><span class="roman">[</span>:<var>PORT</var><span class="roman">]</span></code></dt>
<dd><p>Override the configuration of the main RPC server.
</p></dd>
<dt> <code>=<var>DIRECTORY</var></code></dt>
<dd><p>Override the central installation directory.
</p></dd>
<dt> <code>~~<var>DIR</var>=<var>DIRECTORY</var></code></dt>
<dd><p>Override the <var>DIR</var> installation directory.
</p></dd>
<dt> <code>+<var>ARGUMENT</var></code></dt>
<dd><p>Add <var>ARGUMENT</var> to the command line before other arguments.
</p></dd>
<dt> <code>f<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt>
<dd><p>Set file options.
</p></dd>
<dt> <code>t<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt>
<dd><p>Set terminal options.
</p></dd>
<dt> <code>-<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt>
<dd><p>Set standard input and output options.
</p></dd>
</dl>
<a name="index-_002d_003am"></a>
<p>The ‘<samp>m</samp>’ option specifies the minimum size of the heap. The
‘<samp>m</samp>’ is immediately followed by an integer indicating the number
of kilobytes of memory. The heap will not shrink lower than this
size. By default, the minimum size is 0.
</p>
<a name="index-_002d_003ah"></a>
<p>The ‘<samp>h</samp>’ option specifies the maximum size of the heap. The
‘<samp>h</samp>’ is immediately followed by an integer indicating the number
of kilobytes of memory. The heap will not grow larger than this size.
By default, there is no limit (i.e. the heap will grow until the
virtual memory is exhausted).
</p>
<a name="index-_002d_003al"></a>
<p>The ‘<samp>l</samp>’ option specifies the percentage of the heap that will be
occupied with live objects after the heap is resized at the end of a
garbage collection. The ‘<samp>l</samp>’ is immediately followed by an
integer between 1 and 100 inclusively indicating the desired
percentage. The garbage collector resizes the heap to reach this
percentage occupation. By default, the percentage is 50.
</p>
<a name="index-_002d_003as"></a>
<a name="index-_002d_003aS"></a>
<p>The ‘<samp>s</samp>’ option selects standard Scheme mode. In this mode the
reader is case-insensitive and keywords are not recognized. The
‘<samp>S</samp>’ option selects Gambit Scheme mode (the reader is case-sensitive
and recognizes keywords which end with a colon). By default Gambit
Scheme mode is used.
</p>
<a name="index-_002d_003ad"></a>
<p>The ‘<samp>d</samp>’ option sets various debugging options. The letter
‘<samp>d</samp>’ is followed by a sequence of letters indicating suboptions.
</p>
<dl compact="compact">
<dt> <code>p</code></dt>
<dd><a name="index-_002d_003adp"></a>
<p>Uncaught exceptions will be treated as “errors” in the primordial thread
only.
</p>
</dd>
<dt> <code>a</code></dt>
<dd><a name="index-_002d_003ada"></a>
<p>Uncaught exceptions will be treated as “errors” in all threads.
</p>
</dd>
<dt> <code>r</code></dt>
<dd><a name="index-_002d_003adr"></a>
<p>When an “error” occurs a new REPL will be started.
</p>
</dd>
<dt> <code>s</code></dt>
<dd><a name="index-_002d_003ads"></a>
<p>When an “error” occurs a new REPL will be started.
Moreover the program starts in single-stepping mode.
</p>
</dd>
<dt> <code>q</code></dt>
<dd><a name="index-_002d_003adq"></a>
<p>When an “error” occurs the program will terminate with a nonzero
exit status.
</p>
</dd>
<dt> <code>R</code></dt>
<dd><a name="index-_002d_003adR"></a>
<a name="index-_005eC"></a>
<p>When a user interrupt occurs a new REPL will be started. User
interrupts are typically obtained by typing <^C>. Note that with
some system configurations <^C> abruptly terminates the process.
For example, under Microsoft Windows, <^C> works fine with the
standard console but with the MSYS terminal window it terminates the
process.
</p>
</dd>
<dt> <code>D</code></dt>
<dd><a name="index-_002d_003adD"></a>
<p>When a user interrupt occurs it will be deferred until the parameter
<code>current-user-interrupt-handler</code> is bound.
</p>
</dd>
<dt> <code>Q</code></dt>
<dd><a name="index-_002d_003adQ"></a>
<p>When a user interrupt occurs the program will terminate with a nonzero
exit status.
</p>
</dd>
<dt> <code><var>LEVEL</var></code></dt>
<dd><a name="index-_002d_003adLEVEL"></a>
<p>The verbosity level is set to <var>LEVEL</var> (a digit from 0 to 9).
At level 0 the runtime system will not display error messages
and warnings.
</p>
</dd>
<dt> <code>i</code></dt>
<dd><a name="index-_002d_003adi"></a>
<p>The REPL interaction channel will be the IDE REPL window (if the IDE
is available).
</p>
</dd>
<dt> <code>c</code></dt>
<dd><a name="index-_002d_003adc"></a>
<p>The REPL interaction channel will be the console.
</p>
</dd>
<dt> <code>-</code></dt>
<dd><a name="index-_002d_003ad_002d"></a>
<p>The REPL interaction channel will be standard input and standard output.
</p>
</dd>
<dt> <code>@<span class="roman">[</span><var>HOST</var><span class="roman">]</span><span class="roman">[</span>:<var>PORT</var><span class="roman">]</span></code></dt>
<dd><a name="index-_002d_003ad_0040_005bHOST_005d_005b_003aPORT_005d"></a>
<p>The REPL interaction channel will be connected to the remote debugger
at address <var>HOST</var>:<var>PORT</var> (if there is a remote debugger at
that address). The default <var>HOST</var> is 127.0.0.1 and the default
<var>PORT</var> is 44555.
THIS OPTION IS NOT YET IMPLEMENTED!
</p>
</dd>
</dl>
<p>The default debugging options are equivalent to <code>-:dpqQ1i</code>
(i.e. an uncaught exception in the primordial thread terminates the
program after displaying an error message). When the letter ‘<samp>d</samp>’
is not followed by suboptions, it is equivalent to <code>-:dprR1i</code>
(i.e. a new REPL is started only when an uncaught exception occurs in
the primordial thread). When <code>gsi</code> and <code>gsc</code> are running
the main REPL, the debugging options are changed to cause errors in
the primordial thread and user interrupts to start a nested REPL.
</p>
<a name="index-_002d_003a_0040"></a>
<p>The ‘<samp>@<span class="roman">[</span><var>INTF</var><span class="roman">]</span><span class="roman">[</span>:<var>PORT</var><span class="roman">]</span></samp>’ option
overrides the configuration of the main RPC server. The default
<var>INTF</var> is 127.0.0.1 and the default <var>PORT</var> is 44556.
THIS OPTION IS NOT YET IMPLEMENTED!
</p>
<a name="index-_002d_003a_003d"></a>
<p>The ‘<samp>=<var>DIRECTORY</var></samp>’ option overrides the setting of the
central installation directory.
</p>
<a name="index-_002d_003a_007e_007e"></a>
<p>The ‘<samp>~~<var>DIR</var>=<var>DIRECTORY</var></samp>’ option overrides the setting of
the <var>DIR</var> installation directory.
</p>
<a name="index-_002d_003a_002b"></a>
<p>The ‘<samp>+</samp>’ option adds the text that follows to the command line
before other arguments.
</p>
<a name="index-_002d_003af"></a>
<a name="index-_002d_003at"></a>
<a name="index-_002d_003a_002d"></a>
<p>The ‘<samp>f</samp>’, ‘<samp>t</samp>’ and ‘<samp>-</samp>’ options specify the default
settings of the ports created for files, terminals and standard input
and output respectively. The default character encoding, end-of-line
encoding and buffering can be set. Moreover, for terminals the
line-editing feature can be enabled or disabled. The ‘<samp>f</samp>’,
‘<samp>t</samp>’ and ‘<samp>-</samp>’ must be followed by a sequence of these options:
</p>
<dl compact="compact">
<dt> <code>A</code></dt>
<dd><p>ASCII character encoding.
</p></dd>
<dt> <code>1</code></dt>
<dd><p>ISO-8859-1 character encoding.
</p></dd>
<dt> <code>2</code></dt>
<dd><p>UCS-2 character encoding.
</p></dd>
<dt> <code>4</code></dt>
<dd><p>UCS-4 character encoding.
</p></dd>
<dt> <code>6</code></dt>
<dd><p>UTF-16 character encoding.
</p></dd>
<dt> <code>8</code></dt>
<dd><p>UTF-8 character encoding.
</p></dd>
<dt> <code>U</code></dt>
<dd><p>UTF character encoding with fallback to UTF-8 on input if no BOM is present.
</p></dd>
<dt> <code>UA</code></dt>
<dd><p>UTF character encoding with fallback to ASCII on input if no BOM is present.
</p></dd>
<dt> <code>U1</code></dt>
<dd><p>UTF character encoding with fallback to ISO-8859-1 on input if no BOM is present.
</p></dd>
<dt> <code>U6</code></dt>
<dd><p>UTF character encoding with fallback to UTF-16 on input if no BOM is present.
</p></dd>
<dt> <code>U8</code></dt>
<dd><p>UTF character encoding with fallback to UTF-8 on input if no BOM is present.
</p></dd>
<dt> <code>c</code></dt>
<dd><p>End-of-line is encoded as CR (carriage-return).
</p></dd>
<dt> <code>l</code></dt>
<dd><p>End-of-line is encoded as LF (linefeed)
</p></dd>
<dt> <code>cl</code></dt>
<dd><p>End-of-line is encoded as CR-LF.
</p></dd>
<dt> <code>u</code></dt>
<dd><p>Unbuffered I/O.
</p></dd>
<dt> <code>n</code></dt>
<dd><p>Line buffered I/O (‘<samp>n</samp>’ for “at newline”).
</p></dd>
<dt> <code>f</code></dt>
<dd><p>Fully buffered I/O.
</p></dd>
<dt> <code>r</code></dt>
<dd><p>Illegal character encoding is treated as an error (exception raised).
</p></dd>
<dt> <code>R</code></dt>
<dd><p>Silently replace illegal character encodings with Unicode character #xfffd
(replacement character).
</p></dd>
<dt> <code>e</code></dt>
<dd><p>Enable line-editing (applies to terminals only).
</p></dd>
<dt> <code>E</code></dt>
<dd><p>Disable line-editing (applies to terminals only).
</p></dd>
</dl>
<a name="index-_002d_003a_003a"></a>
<a name="index-GAMBOPT_002c-environment-variable"></a>
<p>When a program’s execution starts, the runtime system obtains the
runtime options by processing in turn various sources of runtime options:
the defaults, the environment variable ‘<samp>GAMBOPT</samp>’, the script
line of the source code, and, unless the program is an interpreted
script, the first command line argument of the
program. Any runtime option can be overriden by a subsequent source
of runtime options. It is sometimes useful to prevent overriding
the runtime options of the script line. This can be achieved by
starting the script line runtime options with ‘<samp>-::</samp>’. In
this case the environment variable ‘<samp>GAMBOPT</samp>’ is ignored,
and the first command line argument of the program is
not used for runtime options (it is treated like a normal
command line argument even if it starts with ‘<samp>-:</samp>’).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>GAMBOPT=d0,=~/my-gambit2</b>
$ <b>export GAMBOPT</b>
$ <b>gsi -e '(pretty-print (path-expand "~~")) (/ 1 0)'</b>
"/Users/feeley/my-gambit2/"
$ <b>echo $?</b>
70
$ <b>gsi -:d1 -e '(pretty-print (path-expand "~~")) (/ 1 0)'</b>
"/Users/feeley/my-gambit2/"
*** ERROR IN (string)@1.3 -- Divide by zero
(/ 1 0)
</pre></td></tr></table>
<hr size="6">
<a name="Debugging"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Runtime-options" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging-model" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Runtime-options" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Debugging-1"></a>
<h1 class="chapter">5. Debugging</h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Debugging-model">5.1 Debugging model</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Debugging-example">5.3 Debugging example</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Console-line_002dediting">5.5 Console line-editing</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Emacs-interface">5.6 Emacs interface</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#GUIDE">5.7 GUIDE</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Debugging-model"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Debugging" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging-commands" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugging" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Debugging-model-1"></a>
<h2 class="section">5.1 Debugging model</h2>
<p>The evaluation of an expression may stop before it is completed for the
following reasons:
</p>
<ol>
<li> An evaluation error has occured, such as attempting to
divide by zero.
<a name="index-_005eC-1"></a>
</li><li> The user has interrupted the evaluation (usually by typing <^C>).
</li><li> A breakpoint has been reached or <code>(step)</code> was evaluated.
</li><li> Single-stepping mode is enabled.
</li></ol>
<p>When an evaluation stops, a message is displayed indicating the reason
and location where the evaluation was stopped. The location
information includes, if known, the name of the procedure where the
evaluation was stopped and the source code location in the format
‘<samp><var>stream</var>@<var>line</var>.<var>column</var></samp>’, where <var>stream</var> is
either a string naming a file or a symbol within parentheses, such as
‘<samp>(console)</samp>’.
</p>
<p>A <em>nested REPL</em> is then initiated in the context of the point of
execution where the evaluation was stopped. The nested REPL’s
continuation and evaluation environment are the same as the point where
the evaluation was stopped. For example when evaluating the expression
‘<samp>(let ((y (- 1 1))) (* (/ x y) 2))</samp>’, a “divide by zero” error is
reported and the nested REPL’s continuation is the one that takes the
result and multiplies it by two. The REPL’s lexical environment
includes the lexical variable ‘<samp>y</samp>’. This allows the inspection of
the evaluation context (i.e. the lexical and dynamic environments and
continuation), which is particularly useful to determine the exact
location and cause of an error.
</p>
<a name="index-_005eD"></a>
<p>The prompt of nested REPLs includes the nesting level; ‘<samp>1></samp>’ is the
prompt at the first nesting level, ‘<samp>2></samp>’ at the second nesting
level, and so on. An end of file (usually <^D>) will cause the
current REPL to be terminated and the enclosing REPL (one nesting level
less) to be resumed.
</p>
<p>At any time the user can examine the frames in the REPL’s
continuation, which is useful to determine which chain of procedure
calls lead to an error. A backtrace that lists the chain of active
continuation frames in the REPL’s continuation can be obtained with
the ‘<samp>,b</samp>’ command. The frames are numbered from 0, that is frame
0 is the most recent frame of the continuation where execution
stopped, frame 1 is the parent frame of frame 0, and so on. It is
also possible to move the REPL to a specific parent continuation
(i.e. a specific frame of the continuation where execution stopped)
with the ‘<samp>,<var>N</var></samp>’, ‘<samp>,<var>N</var>+</samp>’, ‘<samp>,<var>N</var>-</samp>’,
‘<samp>,+</samp>’, ‘<samp>,-</samp>’, ‘<samp>,++</samp>’, and ‘<samp>,--</samp>’ commands. When the
frame number of the frame being examined is not zero, it is shown in
the prompt after the nesting level, for example ‘<samp>1\5></samp>’ is the
prompt when the REPL nesting level is 1 and the frame number is 5.
</p>
<p>Expressions entered at a nested REPL are evaluated in the environment
(both lexical and dynamic) of the continuation frame currently being
examined if that frame was created by interpreted Scheme code. If the
frame was created by compiled Scheme code then expressions get evaluated
in the global interaction environment. This feature may be used in
interpreted code to fetch the value of a variable in the current frame
or to change its value with <code>set!</code>. Note that some special forms
(<code>define</code> in particular) can only be evaluated in the global
interaction environment.
</p>
<hr size="6">
<a name="Debugging-commands"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Debugging-model" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging-example" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugging" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Debugging-commands-1"></a>
<h2 class="section">5.2 Debugging commands</h2>
<p>In addition to expressions, the REPL accepts the following special
“comma” commands:
</p>
<dl compact="compact">
<dt> <code>,?</code></dt>
<dd><a name="index-_002c_003f"></a>
<p>Give a summary of the REPL commands.
</p>
</dd>
<dt> <code>,(h <var>subject</var>)</code></dt>
<dd><a name="index-_002c_0028h-subject_0029"></a>
<p>This command will show the section of the Gambit manual with the
definition of the procedure or special form <var>subject</var>, which must
be a symbol. For example ‘<samp>,(h time)</samp>’ will show the section
documenting the <code>time</code> special form. Please see the <code>help</code>
procedure for additional information.
</p>
</dd>
<dt> <code>,h</code></dt>
<dd><a name="index-_002ch"></a>
<p>This command will show the section of the Gambit manual with the
definition of the procedure which raised the exception for which this
REPL was started.
</p>
</dd>
<dt> <code>,q</code></dt>
<dd><a name="index-_002cq"></a>
<p>Terminate the process with exit status 0. This is equivalent to
calling <code>(exit 0)</code>.
</p>
</dd>
<dt> <code>,qt</code></dt>
<dd><a name="index-_002cqt"></a>
<p>Terminate the current thread (note that terminating the primordial
thread terminates the process).
</p>
</dd>
<dt> <code>,t</code></dt>
<dd><a name="index-_002ct"></a>
<p>Return to the outermost REPL, also known as the “top-level REPL”.
</p>
</dd>
<dt> <code>,d</code></dt>
<dd><a name="index-_002cd"></a>
<p>Leave the current REPL and resume the enclosing REPL. This command does
nothing in the top-level REPL.
</p>
</dd>
<dt> <code>,(c <var>expr</var>)</code></dt>
<dd><a name="index-_002c_0028c-expr_0029"></a>
<p>Leave the current REPL and continue the computation that initiated the
REPL with a specific value. This command can only be used to continue
a computation that signaled an error. The expression <var>expr</var> is
evaluated in the current context and the resulting value is returned
as the value of the expression which signaled the error. For example,
if the evaluation of the expression ‘<samp>(* (/ x y) 2)</samp>’ signaled an
error because ‘<samp>y</samp>’ is zero, then in the nested REPL a ‘<samp>,(c (+
4 y))</samp>’ will resume the computation of ‘<samp>(* (/ x y) 2)</samp>’ as though
the value of ‘<samp>(/ x y)</samp>’ was 4. This command must be used
carefully because the context where the error occured may rely on the
result being of a particular type. For instance a ‘<samp>,(c #f)</samp>’ in
the previous example will cause ‘<samp>*</samp>’ to signal a type error (this
problem is the most troublesome when debugging Scheme code that was
compiled with type checking turned off so be careful).
</p>
</dd>
<dt> <code>,c</code></dt>
<dd><a name="index-_002cc"></a>
<p>Leave the current REPL and continue the computation that initiated the
REPL. This command can only be used to continue a computation that was
stopped due to a user interrupt, breakpoint or a single-step.
</p>
</dd>
<dt> <code>,s</code></dt>
<dd><a name="index-_002cs"></a>
<p>Leave the current REPL and continue the computation that initiated the
REPL in single-stepping mode. The computation will perform an
evaluation step (as defined by <code>step-level-set!</code>) and then stop,
causing a nested REPL to be entered. Just before the evaluation step is
performed, a line is displayed (in the same format as <code>trace</code>)
which indicates the expression that is being evaluated. If the
evaluation step produces a result, the result is also displayed on
another line. A nested REPL is then entered after displaying a message
which describes the next step of the computation. This command can
only be used to continue a computation that was stopped due to a user
interrupt, breakpoint or a single-step.
</p>
</dd>
<dt> <code>,l</code></dt>
<dd><a name="index-_002cl"></a>
<p>This command is similar to ‘<samp>,s</samp>’ except that it “leaps” over
procedure calls, that is procedure calls are treated like a single step.
Single-stepping mode will resume when the procedure call returns, or if
and when the execution of the called procedure encounters a breakpoint.
</p>
</dd>
<dt> <code>,<var>N</var></code></dt>
<dd><a name="index-_002cN"></a>
<p>Move to frame number <var>N</var> of the continuation. After changing the
current frame, a one-line summary of the frame is displayed as if the
‘<samp>,y</samp>’ command was entered.
</p>
</dd>
<dt> <code>,<var>N</var>+</code></dt>
<dd><a name="index-_002cN_002b"></a>
<p>Move forward by <var>N</var> frames in the chain of continuation frames
(i.e. towards older continuation frames). After changing the current
frame, a one-line summary of the frame is displayed as if the
‘<samp>,y</samp>’ command was entered.
</p>
</dd>
<dt> <code>,<var>N</var>-</code></dt>
<dd><a name="index-_002cN_002d"></a>
<p>Move backward by <var>N</var> frames in the chain of continuation frames
(i.e. towards more recent continuation frames). After changing the
current frame, a one-line summary of the frame is displayed as if the
‘<samp>,y</samp>’ command was entered.
</p>
</dd>
<dt> <code>,+</code></dt>
<dd><a name="index-_002c_002b"></a>
<p>Equivalent to ‘<samp>,1+</samp>’.
</p>
</dd>
<dt> <code>,-</code></dt>
<dd><a name="index-_002c_002d"></a>
<p>Equivalent to ‘<samp>,1-</samp>’.
</p>
</dd>
<dt> <code>,++</code></dt>
<dd><a name="index-_002c_002b_002b"></a>
<p>Equivalent to ‘<samp>,<var>N</var>+</samp>’ where <var>N</var> is the number of
continuation frames displayed at the head of a backtrace.
</p>
</dd>
<dt> <code>,--</code></dt>
<dd><a name="index-_002c_002d_002d"></a>
<p>Equivalent to ‘<samp>,<var>N</var>-</samp>’ where <var>N</var> is the number of
continuation frames displayed at the head of a backtrace.
</p>
</dd>
<dt> <code>,y</code></dt>
<dd><a name="index-_002cy"></a>
<p>Display a one-line summary of the current frame. The information is
displayed in four fields. The first field is the frame number. The
second field is the procedure that created the frame or
‘<samp>(interaction)</samp>’ if the frame was created by an expression entered
at the REPL. The remaining fields describe the subproblem associated
with the frame, that is the expression whose value is being computed.
The third field is the location of the subproblem’s source code and
the fourth field is a reproduction of the source code, possibly
truncated to fit on the line. The last two fields may be missing if
that information is not available. In particular, the third field is
missing when the frame was created by a user call to the ‘<samp>eval</samp>’
procedure or by a compiled procedure not compiled with the declaration
‘<samp>debug-location</samp>’, and the last field is missing when the frame
was created by a compiled procedure not compiled with the declaration
‘<samp>debug-source</samp>’.
</p>
</dd>
<dt> <code>,b</code></dt>
<dd><a name="index-_002cb"></a>
<p>Display a backtrace summarizing each frame in the chain of continuation
frames starting with the current frame. For each frame, the same
information as for the ‘<samp>,y</samp>’ command is displayed (except that
location information is displayed in the format
‘<samp><var>stream</var>@<var>line</var>:<var>column</var></samp>’). If there are more than 15
frames in the chain of continuation frames, some of the middle frames
will be omitted.
</p>
</dd>
<dt> <code>,be</code></dt>
<dd><a name="index-_002cbe"></a>
<p>Like the ‘<samp>,b</samp>’ command but also display the environment.
</p>
</dd>
<dt> <code>,bed</code></dt>
<dd><a name="index-_002cbed"></a>
<p>Like the ‘<samp>,be</samp>’ command but also display the dynamic environment.
</p>
</dd>
<dt> <code>,(b <var>expr</var>)</code></dt>
<dd><a name="index-_002c_0028b-expr_0029"></a>
<p>Display the backtrace of <var>expr</var>’s value, <var>X</var>, which is
obtained by evaluating <var>expr</var> in the current frame. <var>X</var> must
be a continuation or a thread. When <var>X</var> is a continuation, the
frames in that continuation are displayed. When <var>X</var> is a thread,
the backtrace of the current continuation of that thread is displayed.
</p>
</dd>
<dt> <code>,(be <var>expr</var>)</code></dt>
<dd><a name="index-_002c_0028be-expr_0029"></a>
<p>Like the ‘<samp>,(b <var>expr</var>)</samp>’ command but also display the
environment.
</p>
</dd>
<dt> <code>,(bed <var>expr</var>)</code></dt>
<dd><a name="index-_002c_0028bed-expr_0029"></a>
<p>Like the ‘<samp>,(be <var>expr</var>)</samp>’ command but also display the dynamic
environment.
</p>
</dd>
<dt> <code>,i</code></dt>
<dd><a name="index-_002ci"></a>
<p>Pretty print the procedure that created the current frame or
‘<samp>(interaction)</samp>’ if the frame was created by an expression entered
at the REPL. Compiled procedures will only be pretty printed when
they are compiled with the declaration ‘<samp>debug-source</samp>’.
</p>
</dd>
<dt> <code>,e</code></dt>
<dd><a name="index-_002ce"></a>
<p>Display the environment which is accessible from the current frame.
The lexical environment is displayed, followed by the dynamic
environment if the parameter object
<code>repl-display-dynamic-environment?</code> is not false. Global lexical
variables are not displayed. Moreover the frame must have been
created by interpreted code or code compiled with the declaration
‘<samp>debug-environments</samp>’. Due to space safety
considerations and compiler optimizations, some of the lexical
variable bindings may be missing. Lexical variable bindings are
displayed using the format ‘<samp><var>variable</var> = <var>expression</var></samp>’
(when <var>variable</var> is mutable) or ‘<samp><var>variable</var> == <var>expression</var></samp>’
(when <var>variable</var> is immutable, which may happen in compiled code
due to compiler optimization)
and dynamically-bound parameter bindings are displayed using the
format ‘<samp>(<var>parameter</var>) = <var>expression</var></samp>’. Note that
<var>expression</var> can be a self-evaluating expression (number, string,
boolean, character, ...), a quoted expression, a lambda expression or
a global variable (the last two cases, which are only used when the
value of the variable or parameter is a procedure, simplifies the
debugging of higher-order procedures). A <var>parameter</var> can be a
quoted expression or a global variable. Lexical bindings are
displayed in inverse binding order (most deeply nested first) and
shadowed variables are included in the list.
</p>
</dd>
<dt> <code>,ed</code></dt>
<dd><a name="index-_002ced"></a>
<p>Like the ‘<samp>,e</samp>’ command but the dynamic environment is always
displayed.
</p>
</dd>
<dt> <code>,(e <var>expr</var>)</code></dt>
<dd><a name="index-_002c_0028e-expr_0029"></a>
<p>Display the environment of <var>expr</var>’s value, <var>X</var>, which is
obtained by evaluating <var>expr</var> in the current frame. <var>X</var> must
be a continuation, a thread, a procedure, or a nonnegative integer.
When <var>X</var> is a continuation, the environment at that point in the
code is displayed. When <var>X</var> is a thread, the environment of the
current continuation of that thread is displayed. When <var>X</var> is a
procedure, the lexical environment where <var>X</var> was created is
combined with the current continuation and this combined environment
is displayed. When <var>X</var> is an integer, the environment at frame
number <var>X</var> of the continuation is displayed.
</p>
</dd>
<dt> <code>,(ed <var>expr</var>)</code></dt>
<dd><a name="index-_002c_0028ed-expr_0029"></a>
<p>Like the ‘<samp>,(e <var>expr</var>)</samp>’ command but the dynamic environment is
always displayed.
</p>
</dd>
<dt> <code>,st</code></dt>
<dd><a name="index-_002cst"></a>
<p>Display the state of the threads in the current thread’s thread group.
A thread can be: uninitialized, initialized, active, and
terminated (normally or abnormally). Active threads can be
running, sleeping and waiting on a synchronization object
(mutex, condition variable or port) possibly with a timeout.
</p>
</dd>
<dt> <code>,(st <var>expr</var>)</code></dt>
<dd><a name="index-_002c_0028st-expr_0029"></a>
<p>Display the state of a specific thread or thread group.
The value of <var>expr</var> must be a thread or thread group.
</p>
</dd>
<dt> <code>,(v <var>expr</var>)</code></dt>
<dd><a name="index-_002c_0028v-expr_0029"></a>
<p>Start a new REPL visiting <var>expr</var>’s value, <var>X</var>, which is
obtained by evaluating <var>expr</var> in the current frame. <var>X</var> must
be a continuation, a thread, a procedure, or a nonnegative integer.
When <var>X</var> is a continuation, the new REPL’s continuation is <var>X</var>
and evaluations are done in the environment at that point in the code.
When <var>X</var> is a thread, the thread is interrupted and the new REPL’s
continuation is the point where the thread was interrupted. When
<var>X</var> is a procedure, the lexical environment where <var>X</var> was
created is combined with the current continuation and evaluations are
done in this combined environment. When <var>X</var> is an integer, the
REPL is started in frame number <var>X</var> of the continuation.
</p>
</dd>
</dl>
<hr size="6">
<a name="Debugging-example"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Debugging-commands" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Procedures-related-to-debugging" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugging" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Debugging-example-1"></a>
<h2 class="section">5.3 Debugging example</h2>
<p>Here is a sample interaction with <code>gsi</code>:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi</b>
Gambit v4.9.3
> <b>(define (invsqr x) (/ 1 (expt x 2)))</b>
> <b>(define (mymap fn lst)
(define (mm in)
(if (null? in)
'()
(cons (fn (car in)) (mm (cdr in)))))
(mm lst))</b>
> <b>(mymap invsqr '(5 2 hello 9 1))</b>
*** ERROR IN invsqr, (console)@1.25 -- (Argument 1) NUMBER expected
(expt 'hello 2)
1> <b>,i</b>
#<procedure #2 invsqr> =
(lambda (x) (/ 1 (expt x 2)))
1> <b>,e</b>
x = 'hello
1> <b>,b</b>
0 invsqr (console)@1:25 (expt x 2)
1 #<procedure #4> (console)@6:17 (fn (car in))
2 #<procedure #4> (console)@6:31 (mm (cdr in))
3 #<procedure #4> (console)@6:31 (mm (cdr in))
4 (interaction) (console)@8:1 (mymap invsqr '(5 2 hel...
1> <b>,+</b>
1 #<procedure #4> (console)@6.17 (fn (car in))
1\1> <b>(pp #4)</b>
(lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in)))))
1\1> <b>,e</b>
in = '(hello 9 1)
mm = (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in)))))
fn = invsqr
lst = '(5 2 hello 9 1)
1\1> <b>,(e mm)</b>
mm = (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in)))))
fn = invsqr
lst = '(5 2 hello 9 1)
1\1> <b>fn</b>
#<procedure #2 invsqr>
1\1> <b>(pp fn)</b>
(lambda (x) (/ 1 (expt x 2)))
1\1> <b>,+</b>
2 #<procedure #4> (console)@6.31 (mm (cdr in))
1\2> <b>,e</b>
in = '(2 hello 9 1)
mm = (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in)))))
fn = invsqr
lst = '(5 2 hello 9 1)
1\2> <b>,(c (list 3 4 5))</b>
(1/25 1/4 3 4 5)
> <b>,q</b>
</pre></td></tr></table>
<hr size="6">
<a name="Procedures-related-to-debugging"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Debugging-example" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Console-line_002dediting" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugging" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Procedures-related-to-debugging-1"></a>
<h2 class="section">5.4 Procedures related to debugging</h2>
<a name="Definition_of_help"></a><a name="Procedure_help"></a><a name="index-help"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_help">help</a></b></code><i> <var>subject</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_help-browser"></a><a name="Procedure_help-browser"></a><a name="index-help_002dbrowser"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_help-browser">help-browser</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>help</code> procedure displays the section of the Gambit manual
with the definition of the procedure or special form <var>subject</var>,
which must be a procedure or symbol. For example the call <code>(help
gensym)</code> will show the section documenting the <code>gensym</code> procedure
and the call <code>(help 'time)</code> will show the section documenting the
<code>time</code> special form. The <code>help</code> procedure returns the void
object.
</p>
<p>The parameter object <code>help-browser</code> is bound to a string naming
the external program that is used by the <code>help</code> procedure to view
the documentation. Initially it is bound to the empty string. In
normal circumstances when <code>help-browser</code> is bound to an empty
string the <code>help</code> procedure runs the script
<code>~~bin/gambdoc.bat</code> which searches for a suitable web browser
to open the documentation in HTML format. Unless the system was built
with the command ‘<samp>configure --enable-help-browser=...</samp>’, the
text-only browser ‘<samp>lynx</samp>’ (see <a href="http://lynx.isc.org/">http://lynx.isc.org/</a>) will
be used by default if it is available. We highly recommend that you
install this browser if you are interested in viewing the
documentation within the console in which the REPL is running. You
can exit ‘<samp>lynx</samp>’ conveniently by typing an end of file (usually
<^D>).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(help-browser "firefox")</b> <span class="roman"><i>; use firefox instead of lynx</i></span>
> <b>(help 'gensym)</b>
> <b>(help gensym)</b> <span class="roman"><i>; OK because gensym is a procedure</i></span>
> <b>(help 'time)</b>
> <b>(help time)</b> <span class="roman"><i>; not OK because time is a special form</i></span>
*** ERROR IN (console)@5.7 -- Macro name can't be used as a variable: time
>
</pre></td></tr></table>
<a name="Definition_of_repl-result-history-ref"></a><a name="Procedure_repl-result-history-ref"></a><a name="index-repl_002dresult_002dhistory_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_repl-result-history-ref">repl-result-history-ref</a></b></code><i> <var>i</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_repl-result-history-max-length-set!"></a><a name="Procedure_repl-result-history-max-length-set!"></a><a name="index-repl_002dresult_002dhistory_002dmax_002dlength_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_repl-result-history-max-length-set!">repl-result-history-max-length-set!</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-_0023"></a>
<a name="index-_0023_0023"></a>
<p>The REPL keeps a history of the last few results printed by the
REPL. The call <code>(repl-result-history-ref <var>i</var>)</code> returns the
<var>i</var>th previous result (the last for <var>i</var>=0, the next to last
for <var>i</var>=1, etc). By default the REPL result history remembers up
to 3 results. The maximal length of the history can be set to <var>n</var>
between 0 and 10 by a call to
<code>(repl-result-history-max-length-set! <var>n</var>)</code>.
</p>
<p>For convenience the reader defines an abbreviation for calling
<code>repl-result-history-ref</code>. Tokens formed by a sequence of one or
more hash signs, such as ‘<samp><code>#</code></samp>’, ‘<samp><code>##</code></samp>’, etc, are
expanded by the reader into the list <code>(repl-result-history-ref
<var>i</var>)</code>, where <var>i</var> is the number of hash signs minus 1. In
other words, ‘<samp><code>#</code></samp>’ will return the last result printed by
the REPL, ‘<samp><code>##</code></samp>’ will return the next to last, etc.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(map (lambda (x) (* x x)) '(1 2 3))</b>
(1 4 9)
> <b>(reverse #)</b>
(9 4 1)
> <b>(append # ##)</b>
(9 4 1 1 4 9)
> <b>1</b>
1
> <b>1</b>
1
> <b>(+ # ##)</b>
2
> <b>(+ # ##)</b>
3
> <b>(+ # ##)</b>
5
> <b>####</b>
*** ERROR IN (console)@9.1 -- (Argument 1) Out of range
(repl-result-history-ref 3)
1>
</pre></td></tr></table>
<a name="Definition_of_trace"></a><a name="Procedure_trace"></a><a name="index-trace"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_trace">trace</a></b></code><i> <var>proc</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_untrace"></a><a name="Procedure_untrace"></a><a name="index-untrace"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_untrace">untrace</a></b></code><i> <var>proc</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>trace</code> procedure starts tracing calls to the specified
procedures. When a traced procedure is called, a line containing the
procedure and its arguments is displayed (using the procedure call
expression syntax). The line is indented with a sequence of vertical
bars which indicate the nesting depth of the procedure’s continuation.
After the vertical bars is a greater-than sign which indicates that
the evaluation of the call is starting.
</p>
<p>When a traced procedure returns a result, it is displayed with the same
indentation as the call but without the greater-than sign. This makes
it easy to match calls and results (the result of a given call is the
value at the same indentation as the greater-than sign). If a traced
procedure P1 performs a tail call to a traced procedure P2, then P2 will
use the same indentation as P1. This makes it easy to spot tail calls.
The special handling for tail calls is needed to preserve the space
complexity of the program (i.e. tail calls are implemented as required
by Scheme even when they involve traced procedures).
</p>
<p>The <code>untrace</code> procedure stops tracing calls to the specified
procedures. When no argument is passed to the <code>trace</code>
procedure, the list of procedures currently being traced is returned.
The void object is returned by the <code>trace</code> procedure when it is
passed one or more arguments. When no argument is passed to the
<code>untrace</code> procedure stops all tracing and returns the void
object. A compiled procedure may be traced but only if it is bound to
a global variable.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (fact n) (if (< n 2) 1 (* n (fact (- n 1)))))</b>
> <b>(trace fact)</b>
> <b>(fact 5)</b>
| > (fact 5)
| | > (fact 4)
| | | > (fact 3)
| | | | > (fact 2)
| | | | | > (fact 1)
| | | | | 1
| | | | 2
| | | 6
| | 24
| 120
120
> <b>(trace -)</b>
*** WARNING -- Rebinding global variable "-" to an interpreted procedure
> <b>(define (fact-iter n r) (if (< n 2) r (fact-iter (- n 1) (* n r))))</b>
> <b>(trace fact-iter)</b>
> <b>(fact-iter 5 1)</b>
| > (fact-iter 5 1)
| | > (- 5 1)
| | 4
| > (fact-iter 4 5)
| | > (- 4 1)
| | 3
| > (fact-iter 3 20)
| | > (- 3 1)
| | 2
| > (fact-iter 2 60)
| | > (- 2 1)
| | 1
| > (fact-iter 1 120)
| 120
120
> <b>(trace)</b>
(#<procedure #2 fact-iter> #<procedure #3 -> #<procedure #4 fact>)
> <b>(untrace)</b>
> <b>(fact 5)</b>
120
</pre></td></tr></table>
<a name="Definition_of_step"></a><a name="Procedure_step"></a><a name="index-step"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_step">step</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_step-level-set!"></a><a name="Procedure_step-level-set!"></a><a name="index-step_002dlevel_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_step-level-set!">step-level-set!</a></b></code><i> <var>level</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>step</code> procedure enables single-stepping mode. After the call
to <code>step</code> the computation will stop just before the interpreter
executes the next evaluation step (as defined by
<code>step-level-set!</code>). A nested REPL is then started. Note that
because single-stepping is stopped by the REPL whenever the prompt is
displayed it is pointless to enter <code>(step)</code> by itself. On the
other hand entering <code>(begin (step) <var>expr</var>)</code> will evaluate
<var>expr</var> in single-stepping mode.
</p>
<p>The procedure <code>step-level-set!</code> sets the stepping level which
determines the granularity of the evaluation steps when single-stepping
is enabled. The stepping level <var>level</var> must be an exact integer in
the range 0 to 7. At a level of 0, the interpreter ignores
single-stepping mode. At higher levels the interpreter stops the
computation just before it performs the following operations, depending
on the stepping level:
</p>
<ol>
<li>
procedure call
</li><li>
<code>delay</code> special form and operations at lower levels
</li><li>
<code>lambda</code> special form and operations at lower levels
</li><li>
<code>define</code> special form and operations at lower levels
</li><li>
<code>set!</code> special form and operations at lower levels
</li><li>
variable reference and operations at lower levels
</li><li>
constant reference and operations at lower levels
</li></ol>
<p>The default stepping level is 7.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (fact n) (if (< n 2) 1 (* n (fact (- n 1)))))</b>
> <b>(step-level-set! 1)</b>
> <b>(begin (step) (fact 5))</b>
*** STOPPED IN (console)@3.15
1> <b>,s</b>
| > (fact 5)
*** STOPPED IN fact, (console)@1.22
1> <b>,s</b>
| | > (< n 2)
| | #f
*** STOPPED IN fact, (console)@1.43
1> <b>,s</b>
| | > (- n 1)
| | 4
*** STOPPED IN fact, (console)@1.37
1> <b>,s</b>
| | > (fact (- n 1))
*** STOPPED IN fact, (console)@1.22
1> <b>,s</b>
| | | > (< n 2)
| | | #f
*** STOPPED IN fact, (console)@1.43
1> <b>,s</b>
| | | > (- n 1)
| | | 3
*** STOPPED IN fact, (console)@1.37
1> <b>,l</b>
| | | > (fact (- n 1))
*** STOPPED IN fact, (console)@1.22
1> <b>,l</b>
| | > (* n (fact (- n 1)))
| | 24
*** STOPPED IN fact, (console)@1.32
1> <b>,l</b>
| > (* n (fact (- n 1)))
| 120
120
</pre></td></tr></table>
<a name="Definition_of_break"></a><a name="Procedure_break"></a><a name="index-break"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_break">break</a></b></code><i> <var>proc</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbreak"></a><a name="Procedure_unbreak"></a><a name="index-unbreak"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbreak">unbreak</a></b></code><i> <var>proc</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>break</code> procedure places a breakpoint on each of the
specified procedures. When a procedure is called that has a
breakpoint, the interpreter will enable single-stepping mode (as if
<code>step</code> had been called). This typically causes the computation
to stop soon inside the procedure if the stepping level is high
enough.
</p>
<p>The <code>unbreak</code> procedure removes the breakpoints on the specified
procedures. With no argument, <code>break</code> returns the list of
procedures currently containing breakpoints. The void object is
returned by <code>break</code> if it is passed one or more arguments. With
no argument <code>unbreak</code> removes all the breakpoints and returns the
void object. A breakpoint can be placed on a compiled procedure but
only if it is bound to a global variable.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (double x) (+ x x))</b>
> <b>(define (triple y) (- (double (double y)) y))</b>
> <b>(define (f z) (* (triple z) 10))</b>
> <b>(break double)</b>
> <b>(break -)</b>
*** WARNING -- Rebinding global variable "-" to an interpreted procedure
> <b>(f 5)</b>
*** STOPPED IN double, (console)@1.21
1> <b>,b</b>
0 double (console)@1:21 +
1 triple (console)@2:31 (double y)
2 f (console)@3:18 (triple z)
3 (interaction) (console)@6:1 (f 5)
1> <b>,e</b>
x = 5
1> <b>,c</b>
*** STOPPED IN double, (console)@1.21
1> <b>,c</b>
*** STOPPED IN f, (console)@3.29
1> <b>,c</b>
150
> <b>(break)</b>
(#<procedure #3 -> #<procedure #4 double>)
> <b>(unbreak)</b>
> <b>(f 5)</b>
150
</pre></td></tr></table>
<a name="Definition_of_generate-proper-tail-calls"></a><a name="Procedure_generate-proper-tail-calls"></a><a name="index-generate_002dproper_002dtail_002dcalls"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_generate-proper-tail-calls">generate-proper-tail-calls</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-proper-tail_002dcalls"></a>
<a name="index-tail_002dcalls"></a>
<p>[Note: this procedure is DEPRECATED and will be removed
in a future version of Gambit. Use the ‘<samp>proper-tail-calls</samp>’
declaration instead.]
</p>
<p>The parameter object <code>generate-proper-tail-calls</code> is bound to a
boolean value controlling how the interpreter handles tail calls.
When it is bound to <code>#f</code> the interpreter will treat tail calls
like nontail calls, that is a new continuation will be created for the
call. This setting is useful for debugging, because when a primitive
signals an error the location information will point to the call site
of the primitive even if this primitive was called with a tail call.
The initial value of this parameter object is <code>#t</code>, which means
that a tail call will reuse the continuation of the calling function.
</p>
<p>This parameter object only affects code that is subsequently processed
by <code>load</code> or <code>eval</code>, or entered at the REPL.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(generate-proper-tail-calls)</b>
#t
> <b>(let loop ((i 1)) (if (< i 10) (loop (* i 2)) oops))</b>
*** ERROR IN #<procedure #2>, (console)@2.47 -- Unbound variable: oops
1> <b>,b</b>
0 #<procedure #2> (console)@2:47 oops
1 (interaction) (console)@2:1 ((letrec ((loop (lambda...
1> <b>,t</b>
> <b>(generate-proper-tail-calls #f)</b>
> <b>(let loop ((i 1)) (if (< i 10) (loop (* i 2)) oops))</b>
*** ERROR IN #<procedure #3>, (console)@6.47 -- Unbound variable: oops
1> <b>,b</b>
0 #<procedure #3> (console)@6:47 oops
1 #<procedure #3> (console)@6:32 (loop (* i 2))
2 #<procedure #3> (console)@6:32 (loop (* i 2))
3 #<procedure #3> (console)@6:32 (loop (* i 2))
4 #<procedure #3> (console)@6:32 (loop (* i 2))
5 (interaction) (console)@6:1 ((letrec ((loop (lambda...
</pre></td></tr></table>
<a name="Definition_of_display-environment-set!"></a><a name="Procedure_display-environment-set!"></a><a name="index-display_002denvironment_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_display-environment-set!">display-environment-set!</a></b></code><i> <var>display?</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>[Note: this procedure is DEPRECATED and will be removed
in a future version of Gambit. Use the parameter object
<code>repl-display-environment?</code> instead.]
</p>
<p>This procedure sets a flag that controls the automatic display of the
environment by the REPL. If <var>display?</var> is true, the environment
is displayed by the REPL before the prompt. The default setting is
not to display the environment.
</p>
<a name="Definition_of_repl-display-environment?"></a><a name="Procedure_repl-display-environment?"></a><a name="index-repl_002ddisplay_002denvironment_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_repl-display-environment?">repl-display-environment?</a></b></code><i> <var>display?</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The parameter object <code>repl-display-environment?</code> is bound to a
boolean value that controls the automatic display of the environment
by the REPL. If <var>display?</var> is true, the environment is displayed
by the REPL before the prompt. This is particularly useful in
single-stepping mode. The default setting is not to display the
environment.
</p>
<a name="Definition_of_display-dynamic-environment?"></a><a name="Procedure_display-dynamic-environment?"></a><a name="index-display_002ddynamic_002denvironment_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_display-dynamic-environment?">display-dynamic-environment?</a></b></code><i> <var>display?</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The parameter object <code>display-dynamic-environment?</code> is bound to a
boolean value that controls wether the dynamic environment is
displayed when the environment is displayed. The default setting is
not to display the dynamic environment.
</p>
<a name="Definition_of_pretty-print"></a><a name="Procedure_pretty-print"></a><a name="index-pretty_002dprint"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_pretty-print">pretty-print</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure pretty-prints <var>obj</var> on the port <var>port</var>. If it
is not specified, <var>port</var> defaults to the current output-port.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(pretty-print
(let* ((x '(1 2 3 4)) (y (list x x x))) (list y y y)))</b>
(((1 2 3 4) (1 2 3 4) (1 2 3 4))
((1 2 3 4) (1 2 3 4) (1 2 3 4))
((1 2 3 4) (1 2 3 4) (1 2 3 4)))
</pre></td></tr></table>
<a name="Definition_of_pp"></a><a name="Procedure_pp"></a><a name="index-pp"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_pp">pp</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure pretty-prints <var>obj</var> on the port <var>port</var>. When
<var>obj</var> is a procedure created by the interpreter or a procedure
created by code compiled with the declaration
‘<samp>debug-source</samp>’, the procedure’s source code is
displayed. If it is not specified, <var>port</var> defaults to the
interaction channel (i.e. the output will appear at the REPL).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (f g) (+ (time (g 100)) (time (g 1000))))</b>
> <b>(pp f)</b>
(lambda (g)
(+ (##time (lambda () (g 100)) '(g 100))
(##time (lambda () (g 1000)) '(g 1000))))
</pre></td></tr></table>
<a name="Definition_of_gc-report-set!"></a><a name="Procedure_gc-report-set!"></a><a name="index-gc_002dreport_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_gc-report-set!">gc-report-set!</a></b></code><i> <var>report?</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-GC"></a>
<p>This procedure controls the generation of reports during garbage
collections. If the argument is true, a brief report of memory usage
is generated after every garbage collection. It contains: the time
taken for this garbage collection, the amount of memory allocated in
megabytes since the program was started, the size of the heap in
megabytes, the heap memory in megabytes occupied by live data, the
proportion of the heap occupied by live data, and the number of bytes
occupied by movable and nonmovable objects.
</p>
<hr size="6">
<a name="Console-line_002dediting"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Procedures-related-to-debugging" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Emacs-interface" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugging" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Console-line_002dediting-1"></a>
<h2 class="section">5.5 Console line-editing</h2>
<p>The console implements a simple Scheme-friendly line-editing
user-interface that is enabled by default. It offers parentheses
balancing, a history of previous commands, symbol completion, and
several emacs-compatible keyboard commands. The user’s input is
displayed in a bold font and the output produced by the system is in a
plain font. The history of previous commands is saved in the file
‘<tt>~/.gambit_history</tt>’. It is restored when a REPL is started.
</p>
<p>Symbol completion is triggered with the tab key. When the cursor is
after a sequence of characters that can form a symbol, typing the tab
key will search the symbol table for the first symbol (in alphabetical
order) that begins with that sequence and insert that symbol. Typing
the tab key in succession will cycle through all symbols with that
prefix. When all possible symbols have been shown or there are no
possible completions, the text reverts to the uncompleted symbol and
the bell is rung.
</p>
<p>Here are the keyboard commands available (where the ‘<samp><code>M-</code></samp>’
prefix means the escape key is typed and the ‘<samp><code>C-</code></samp>’ prefix
means the control key is pressed):
</p>
<dl compact="compact">
<dt> <code>C-d</code></dt>
<dd><p>Generate an end-of-file when the line is empty, otherwise delete
character at cursor.
</p>
</dd>
<dt> <code>delete <span class="roman">or backspace</span></code></dt>
<dd><p>Delete character before cursor.
</p>
</dd>
<dt> <code>M-C-d</code></dt>
<dd><p>Delete word forward and keep a copy of this text on the clipboard.
</p>
</dd>
<dt> <code>M-delete</code></dt>
<dd><p>Delete word backward and keep a copy of this text on the clipboard.
</p>
</dd>
<dt> <code>M-backspace</code></dt>
<dd><p>Delete S-expression backward and keep a copy of this text on the clipboard.
</p>
</dd>
<dt> <code>C-a</code></dt>
<dd><p>Move cursor to beginning of line.
</p>
</dd>
<dt> <code>C-e</code></dt>
<dd><p>Move cursor to end of line.
</p>
</dd>
<dt> <code>C-b <span class="roman">or <i>left-arrow</i></span></code></dt>
<dd><p>Move cursor left one character.
</p>
</dd>
<dt> <code>M-b</code></dt>
<dd><p>Move cursor left one word.
</p>
</dd>
<dt> <code>M-C-b <span class="roman">or <code>M-</code><i>left-arrow</i></span></code></dt>
<dd><p>Move cursor left one S-expression.
</p>
</dd>
<dt> <code>C-f <span class="roman">or <i>right-arrow</i></span></code></dt>
<dd><p>Move cursor right one character.
</p>
</dd>
<dt> <code>M-f</code></dt>
<dd><p>Move cursor right one word.
</p>
</dd>
<dt> <code>M-C-f <span class="roman">or <code>M-</code><i>right-arrow</i></span></code></dt>
<dd><p>Move cursor right one S-expression.
</p>
</dd>
<dt> <code>C-p <span class="roman">or <code>M-p</code> or <i>up-arrow</i></span></code></dt>
<dd><p>Move to previous line in history.
</p>
</dd>
<dt> <code>C-n <span class="roman">or <code>M-n</code> or <i>down-arrow</i></span></code></dt>
<dd><p>Move to next line in history.
</p>
</dd>
<dt> <code>C-t</code></dt>
<dd><p>Transpose character at cursor with previous character.
</p>
</dd>
<dt> <code>M-t</code></dt>
<dd><p>Transpose word after cursor with previous word.
</p>
</dd>
<dt> <code>M-C-t</code></dt>
<dd><p>Transpose S-expression after cursor with previous S-expression.
</p>
</dd>
<dt> <code>C-l</code></dt>
<dd><p>Clear console and redraw line being edited.
</p>
</dd>
<dt> <code>C-<i>nul</i></code></dt>
<dd><p>Set the mark to the cursor.
</p>
</dd>
<dt> <code>C-w</code></dt>
<dd><p>Delete the text between the cursor and the mark and keep a copy
of this text on the clipboard.
</p>
</dd>
<dt> <code>C-k</code></dt>
<dd><p>Delete the text from the cursor to the end of the line and keep a copy
of this text on the clipboard.
</p>
</dd>
<dt> <code>C-y</code></dt>
<dd><p>Paste the text that is on the clipboard.
</p>
</dd>
<dt> <code>F8</code></dt>
<dd><p>Same as typing ‘<samp>#||#,c;</samp>’ (REPL command to continue the computation).
</p>
</dd>
<dt> <code>F9</code></dt>
<dd><p>Same as typing ‘<samp>#||#,-;</samp>’ (REPL command to move to newer frame).
</p>
</dd>
<dt> <code>F10</code></dt>
<dd><p>Same as typing ‘<samp>#||#,+;</samp>’ (REPL command to move to older frame).
</p>
</dd>
<dt> <code>F11</code></dt>
<dd><p>Same as typing ‘<samp>#||#,s;</samp>’ (REPL command to step the computation).
</p>
</dd>
<dt> <code>F12</code></dt>
<dd><p>Same as typing ‘<samp>#||#,l;</samp>’ (REPL command to leap the computation).
</p>
</dd>
</dl>
<p>On Mac OS X, depending on your configuration, you may have to press
the <code>fn</code> key to access the function key <code>F12</code> and the
<code>option</code> key to access the other function keys.
</p>
<p>On Microsoft Windows the clipboard is the system clipboard. This
allows text to be copied and pasted between the program and other
applications. On other operating systems the clipboard is internal to
the program (it is not integrated with the operating system).
</p>
<hr size="6">
<a name="Emacs-interface"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Console-line_002dediting" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#GUIDE" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugging" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Emacs-interface-1"></a>
<h2 class="section">5.6 Emacs interface</h2>
<a name="index-Emacs"></a>
<a name="index-gambit_002eel"></a>
<p>Gambit comes with the Emacs package ‘<samp>gambit.el</samp>’ which provides a
nice environment for running Gambit from within the Emacs editor.
This package filters the standard output of the Gambit process and
when it intercepts a location information (in the format
‘<samp><var>stream</var>@<var>line</var>.<var>column</var></samp>’ where <var>stream</var> is
either ‘<samp>(stdin)</samp>’ when the expression was obtained from standard
input, ‘<samp>(console)</samp>’ when the expression was obtained from the
console, or a string naming a file) it opens a window to highlight the
corresponding expression.
</p>
<p>To use this package, make sure the file ‘<samp>gambit.el</samp>’ is accessible
from your load-path and that the following lines are in your
‘<samp>.emacs</samp>’ file:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(autoload 'gambit-inferior-mode "gambit" "Hook Gambit mode into cmuscheme.")
(autoload 'gambit-mode "gambit" "Hook Gambit mode into scheme.")
(add-hook 'inferior-scheme-mode-hook (function gambit-inferior-mode))
(add-hook 'scheme-mode-hook (function gambit-mode))
(setq scheme-program-name "gsi -:d-")
</pre></td></tr></table>
<p>Alternatively, if you don’t mind always loading this package,
you can simply add this line to your ‘<samp>.emacs</samp>’ file:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(require 'gambit)
</pre></td></tr></table>
<p>You can then start an inferior Gambit process by typing ‘<samp>M-x
run-scheme</samp>’. The commands provided in ‘<samp>cmuscheme</samp>’ mode will be
available in the Gambit interaction buffer (i.e. ‘<samp>*scheme*</samp>’) and in
buffers attached to Scheme source files. Here is a list of the most
useful commands (for a complete list type ‘<samp>C-h m</samp>’ in the Gambit
interaction buffer):
</p><dl compact="compact">
<dt> <code>C-x C-e</code></dt>
<dd><p>Evaluate the expression which is before the cursor (the expression will
be copied to the Gambit interaction buffer).
</p></dd>
<dt> <code>C-c C-z</code></dt>
<dd><p>Switch to Gambit interaction buffer.
</p></dd>
<dt> <code>C-c C-l</code></dt>
<dd><p>Load a file (file attached to current buffer is default) using
<code>(load <var>file</var>)</code>.
</p></dd>
<dt> <code>C-c C-k</code></dt>
<dd><p>Compile a file (file attached to current buffer is default) using
<code>(compile-file <var>file</var>)</code>.
</p></dd>
</dl>
<p>The file ‘<samp>gambit.el</samp>’ provides these additional commands:
</p>
<dl compact="compact">
<dt> <code>F8 <span class="roman"><i>or</i></span> C-c c</code></dt>
<dd><p>Continue the computation (same as typing ‘<samp>#||#,c;</samp>’ to the REPL).
</p></dd>
<dt> <code>F9 <span class="roman"><i>or</i></span> C-c ]</code></dt>
<dd><p>Move to newer frame (same as typing ‘<samp>#||#,-;</samp>’ to the REPL).
</p></dd>
<dt> <code>F10 <span class="roman"><i>or</i></span> C-c [</code></dt>
<dd><p>Move to older frame (same as typing ‘<samp>#||#,+;</samp>’ to the REPL).
</p></dd>
<dt> <code>F11 <span class="roman"><i>or</i></span> C-c s</code></dt>
<dd><p>Step the computation (same as typing ‘<samp>#||#,s;</samp>’ to the REPL).
</p></dd>
<dt> <code>F12 <span class="roman"><i>or</i></span> C-c l</code></dt>
<dd><p>Leap the computation (same as typing ‘<samp>#||#,l;</samp>’ to the REPL).
</p></dd>
<dt> <code>C-c _</code></dt>
<dd><p>Removes the last window that was opened to highlight an expression.
</p></dd>
</dl>
<p>The two keystroke version of these commands can be shortened to
‘<samp>M-c</samp>’, ‘<samp>M-[</samp>’, ‘<samp>M-]</samp>’, ‘<samp>M-s</samp>’, ‘<samp>M-l</samp>’, and
‘<samp>M-_</samp>’ respectively by adding this line to your ‘<samp>.emacs</samp>’
file:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(setq gambit-repl-command-prefix "\e")
</pre></td></tr></table>
<p>This is more convenient to type than the two keystroke ‘<samp>C-c</samp>’ based
sequences but the purist may not like this because it does not follow
normal Emacs conventions.
</p>
<p>Here is what a typical ‘<samp>.emacs</samp>’ file will look like:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(setq load-path ; add directory containing gambit.el
(cons "/usr/local/Gambit/share/emacs/site-lisp"
load-path))
(setq scheme-program-name "/tmp/gsi -:d-") ; if gsi not in executable path
(setq gambit-highlight-color "gray") ; if you don't like the default
(setq gambit-repl-command-prefix "\e") ; if you want M-c, M-s, etc
(require 'gambit)
</pre></td></tr></table>
<hr size="6">
<a name="GUIDE"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Emacs-interface" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugging" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Debugging" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="GUIDE-1"></a>
<h2 class="section">5.7 GUIDE</h2>
<p>The implementation and documentation for GUIDE, the Gambit Universal
IDE, are not yet complete.
</p>
<hr size="6">
<a name="Scheme-extensions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GUIDE" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Extensions-to-standard-procedures" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Debugging" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Namespaces" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Scheme-extensions-1"></a>
<h1 class="chapter">6. Scheme extensions</h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Extensions-to-standard-special-forms">6.2 Extensions to standard special forms</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Extensions-to-standard-procedures"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Scheme-extensions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Extensions-to-standard-special-forms" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Namespaces" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Extensions-to-standard-procedures-1"></a>
<h2 class="section">6.1 Extensions to standard procedures</h2>
<a name="Definition_of_transcript-on"></a><a name="Procedure_transcript-on"></a><a name="index-transcript_002don"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_transcript-on">transcript-on</a></b></code><i> <var>file</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_transcript-off"></a><a name="Procedure_transcript-off"></a><a name="index-transcript_002doff"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_transcript-off">transcript-off</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures do nothing.
</p>
<a name="Definition_of_call-with-current-continuation"></a><a name="Procedure_call-with-current-continuation"></a><a name="index-call_002dwith_002dcurrent_002dcontinuation"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-current-continuation">call-with-current-continuation</a></b></code><i> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call/cc"></a><a name="Procedure_call/cc"></a><a name="index-call_002fcc"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call/cc">call/cc</a></b></code><i> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>call-with-current-continuation</code> is bound to the
global variables <code>call-with-current-continuation</code> and
<code>call/cc</code>.
</p>
<hr size="6">
<a name="Extensions-to-standard-special-forms"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Extensions-to-standard-procedures" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Miscellaneous-extensions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Namespaces" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Extensions-to-standard-special-forms-1"></a>
<h2 class="section">6.2 Extensions to standard special forms</h2>
<a name="Definition_of_lambda"></a><a name="Special_form_lambda"></a><a name="index-lambda"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_lambda">lambda</a></b></code><i> <span class="roman"><i>lambda-formals</i></span> <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_define"></a><a name="Special_form_define"></a><a name="index-define"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define">define</a></b></code><i> (<span class="roman"><i>variable</i></span> <span class="roman"><i>define-formals</i></span>) <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<ul class="toc">
<li> <var> </var>
<i>lambda-formals</i> = <code>(</code> <i>formal-argument-list</i> <code>)</code> | <i>r4rs-lambda-formals</i>
</li><li> <var> </var>
<i>define-formals</i> = <i>formal-argument-list</i> | <i>r4rs-define-formals</i>
</li><li> <var> </var>
<i>formal-argument-list</i> = <i>dsssl-formal-argument-list</i> | <i>rest-at-end-formal-argument-list</i>
</li><li> <var> </var>
<i>dsssl-formal-argument-list</i> = <i>reqs</i> <i>opts</i> <i>rest</i> <i>keys</i>
</li><li> <var> </var>
<i>rest-at-end-formal-argument-list</i> = <i>reqs</i> <i>opts</i> <i>keys</i> <i>rest</i> | <i>reqs</i> <i>opts</i> <i>keys</i> <code>.</code> <i>rest-formal-argument</i>
</li><li> <var> </var>
<i>reqs</i> = <i>required-formal-argument</i>*
</li><li> <var> </var>
<i>required-formal-argument</i> = <i>variable</i>
</li><li> <var> </var>
<i>opts</i> = <code>#!optional</code> <i>optional-formal-argument</i>* | <i>empty</i>
</li><li> <var> </var>
<i>optional-formal-argument</i> = <i>variable</i> | <code>(</code> <i>variable</i> <i>initializer</i> <code>)</code>
</li><li> <var> </var>
<i>rest</i> = <code>#!rest</code> <i>rest-formal-argument</i> | <i>empty</i>
</li><li> <var> </var>
<i>rest-formal-argument</i> = <i>variable</i>
</li><li> <var> </var>
<i>keys</i> = <code>#!key</code> <i>keyword-formal-argument</i>* | <i>empty</i>
</li><li> <var> </var>
<i>keyword-formal-argument</i> = <i>variable</i> | <code>(</code> <i>variable</i> <i>initializer</i> <code>)</code>
</li><li> <var> </var>
<i>initializer</i> = <i>expression</i>
</li><li> <var> </var>
<i>r4rs-lambda-formals</i> = <code>(</code> <i>variable</i>* <code>)</code> |
<code>(</code> <i>variable</i>+ <code>.</code> <i>variable</i> <code>)</code> |
<i>variable</i>
</li><li> <var> </var>
<i>r4rs-define-formals</i> = <i>variable</i>* | <i>variable</i>* <code>.</code> <i>variable</i>
</li></ul>
<p>These forms are extended versions of the <code>lambda</code> and <code>define</code>
special forms of standard Scheme. They allow the use of optional formal
arguments, either positional or named, and support the syntax and semantics
of the DSSSL standard.
</p>
<p>When the procedure introduced by a <code>lambda</code> (or <code>define</code>) is
applied to a list of actual arguments, the formal and actual arguments
are processed as specified in the R4RS if the <i>lambda-formals</i> (or
<i>define-formals</i>) is a <i>r4rs-lambda-formals</i> (or
<i>r4rs-define-formals</i>).
</p>
<p>If the <i>formal-argument-list</i> matches
<i>dsssl-formal-argument-list</i> or <i>extended-formal-argument-list</i>
they are processed as follows:
</p>
<ol>
<li>
<i>Variable</i>s in <i>required-formal-argument</i>s are bound to
successive actual arguments starting with the first actual argument. It
shall be an error if there are fewer actual arguments than
<i>required-formal-argument</i>s.
</li><li>
Next <i>variable</i>s in <i>optional-formal-argument</i>s are bound to
remaining actual arguments. If there are fewer remaining actual
arguments than <i>optional-formal-argument</i>s, then the variables are
bound to the result of evaluating <i>initializer</i>, if one was
specified, and otherwise to <code>#f</code>. The <i>initializer</i> is
evaluated in an environment in which all previous formal arguments have
been bound.
</li><li>
If <code>#!key</code> does not appear in the <i>formal-argument-list</i>
and there is no <i>rest-formal-argument</i> then it shall be an error
if there are any remaining actual arguments.
</li><li>
If <code>#!key</code> does not appear in the <i>formal-argument-list</i>
and there is a <i>rest-formal-argument</i> then the
<i>rest-formal-argument</i> is bound to a list of all remaining actual
arguments.
</li><li>
If <code>#!key</code> appears in the <i>formal-argument-list</i> and there is
no <i>rest-formal-argument</i> then there shall be an even number of
remaining actual arguments. These are interpreted as a series of
pairs, where the first member of each pair is a keyword specifying the
argument name, and the second is the corresponding value. It shall be
an error if the first member of a pair is not a keyword. It shall be
an error if the argument name is not the same as a variable in a
<i>keyword-formal-argument</i>. If the same argument name occurs more
than once in the list of actual arguments, then the first value is
used. If there is no actual argument for a particular
<i>keyword-formal-argument</i>, then the variable is bound to the
result of evaluating <i>initializer</i> if one was specified, and
otherwise to <code>#f</code>. The <i>initializer</i> is evaluated in an
environment in which all previous formal arguments have been bound.
</li><li>
If <code>#!key</code> appears in the <i>formal-argument-list</i> and there is
a <i>rest-formal-argument</i> <b>before</b> the <code>#!key</code> then there
may be an even or odd number of remaining actual arguments and the
<i>rest-formal-argument</i> is bound to a list of all remaining actual
arguments. Then, these remaining actual arguments are scanned from
left to right in pairs, stopping at the first pair whose first element
is not a keyword. Each pair whose first element is a keyword matching
the name of a <i>keyword-formal-argument</i> gives the value (i.e. the
second element of the pair) of the corresponding formal argument. If
the same argument name occurs more than once in the list of actual
arguments, then the first value is used. If there is no actual
argument for a particular <i>keyword-formal-argument</i>, then the
variable is bound to the result of evaluating <i>initializer</i> if one
was specified, and otherwise to <code>#f</code>. The <i>initializer</i> is
evaluated in an environment in which all previous formal arguments
have been bound.
</li><li>
If <code>#!key</code> appears in the <i>formal-argument-list</i> and there is
a <i>rest-formal-argument</i> <b>after</b> the <code>#!key</code> then there may
be an even or odd number of remaining actual arguments. The remaining
actual arguments are scanned from left to right in pairs, stopping at
the first pair whose first element is not a keyword. Each pair shall
have as its first element a keyword matching the name of a
<i>keyword-formal-argument</i>; the second element gives the value of
the corresponding formal argument. If the same argument name occurs
more than once in the list of actual arguments, then the first value
is used. If there is no actual argument for a particular
<i>keyword-formal-argument</i>, then the variable is bound to the
result of evaluating <i>initializer</i> if one was specified, and
otherwise to <code>#f</code>. The <i>initializer</i> is evaluated in an
environment in which all previous formal arguments have been bound.
Finally, the <i>rest-formal-argument</i> is bound to the list of the
actual arguments that were not scanned (i.e. after the last
keyword/value pair).
</li></ol>
<p>In all cases it is an error for a <i>variable</i> to appear more than
once in a <i>formal-argument-list</i>.
</p>
<p>Note that this specification is compatible with the DSSSL language
standard (i.e. a correct DSSSL program will have the same semantics
when run with Gambit).
</p>
<p>It is unspecified whether variables receive their value by binding or by
assignment. Currently the compiler and interpreter use different
methods, which can lead to different semantics if
<code>call-with-current-continuation</code> is used in an <i>initializer</i>.
Note that this is irrelevant for DSSSL programs because
<code>call-with-current-continuation</code> does not exist in DSSSL.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>((lambda (#!rest x) x) 1 2 3)</b>
(1 2 3)
> <b>(define (f a #!optional b) (list a b))</b>
> <b>(define (g a #!optional (b a) #!key (k (* a b))) (list a b k))</b>
> <b>(define (h1 a #!rest r #!key k) (list a k r))</b>
> <b>(define (h2 a #!key k #!rest r) (list a k r))</b>
> <b>(f 1)</b>
(1 #f)
> <b>(f 1 2)</b>
(1 2)
> <b>(g 3)</b>
(3 3 9)
> <b>(g 3 4)</b>
(3 4 12)
> <b>(g 3 4 k: 5)</b>
(3 4 5)
> <b>(g 3 4 k: 5 k: 6)</b>
(3 4 5)
> <b>(h1 7)</b>
(7 #f ())
> <b>(h1 7 k: 8 9)</b>
(7 8 (k: 8 9))
> <b>(h1 7 k: 8 z: 9)</b>
(7 8 (k: 8 z: 9))
> <b>(h2 7)</b>
(7 #f ())
> <b>(h2 7 k: 8 9)</b>
(7 8 (9))
> <b>(h2 7 k: 8 z: 9)</b>
*** ERROR IN (console)@17.1 -- Unknown keyword argument passed to procedure
(h2 7 k: 8 z: 9)
</pre></td></tr></table>
<hr size="6">
<a name="Miscellaneous-extensions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Extensions-to-standard-special-forms" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Undocumented-extensions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Namespaces" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Miscellaneous-extensions-1"></a>
<h2 class="section">6.3 Miscellaneous extensions</h2>
<a name="Definition_of_vector-copy"></a><a name="Procedure_vector-copy"></a><a name="index-vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_vector-copy">vector-copy</a></b></code><i> <var>vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a newly allocated vector with the same content
as the vector <var>vector</var>. Note that the elements are not
recursively copied.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v1 '#(1 2 3))</b>
> <b>(define v2 (vector-copy v1))</b>
> <b>v2</b>
#(1 2 3)
> <b>(eq? v1 v2)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_subvector"></a><a name="Procedure_subvector"></a><a name="index-subvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subvector">subvector</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure is the vector analog of the <code>substring</code>
procedure. It returns a newly allocated vector formed from the
elements of the vector <var>vector</var> beginning with index <var>start</var>
(inclusive) and ending with index <var>end</var> (exclusive).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(subvector '#(a b c d e f) 3 5)</b>
#(d e)
</pre></td></tr></table>
<a name="Definition_of_vector-append"></a><a name="Procedure_vector-append"></a><a name="index-vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_vector-append">vector-append</a></b></code><i> <var>vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure is the vector analog of the <code>string-append</code>
procedure. It returns a newly allocated vector whose elements
form the concatenation of the given vectors.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v '#(1 2 3))</b>
> <b>(vector-append v v v)</b>
#(1 2 3 1 2 3 1 2 3)
</pre></td></tr></table>
<a name="Definition_of_append-vectors"></a><a name="Procedure_append-vectors"></a><a name="index-append_002dvectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-vectors">append-vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a newly allocated vector whose elements form
the concatenation of all the vectors in the list <var>lst</var>. It is
equivalent to <code>(apply vector-append <span class="roman"><var>lst</var></span>)</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v '#(1 2 3))</b>
> <b>(append-vectors (list v v v))</b>
#(1 2 3 1 2 3 1 2 3)
</pre></td></tr></table>
<a name="Definition_of_subvector-fill!"></a><a name="Procedure_subvector-fill!"></a><a name="index-subvector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subvector-fill!">subvector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure is like <code>vector-fill!</code>, but fills a selected part
of the given vector. It sets the elements of the vector <var>vector</var>,
beginning with index <var>start</var> (inclusive) and ending with index
<var>end</var> (exclusive) to <var>fill</var>. The value returned is
unspecified.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v (vector 'a 'b 'c 'd 'e 'f))</b>
> <b>(subvector-fill! v 3 5 'x)</b>
> <b>v</b>
#(a b c x x f)
</pre></td></tr></table>
<a name="Definition_of_subvector-move!"></a><a name="Procedure_subvector-move!"></a><a name="index-subvector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subvector-move!">subvector-move!</a></b></code><i> <var>src-vector</var> <var>src-start</var> <var>src-end</var> <var>dst-vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure replaces part of the contents of vector
<var>dst-vector</var> with part of the contents of vector
<var>src-vector</var>. It copies elements from <var>src-vector</var>, beginning
with index <var>src-start</var> (inclusive) and ending with index
<var>src-end</var> (exclusive) to <var>dst-vector</var> beginning with index
<var>dst-start</var> (inclusive). The value returned is unspecified.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v1 '#(1 2 3 4 5 6))</b>
> <b>(define v2 (vector 'a 'b 'c 'd 'e 'f))</b>
> <b>(subvector-move! v1 3 5 v2 1)</b>
> <b>v2</b>
#(a 4 5 d e f)
</pre></td></tr></table>
<a name="Definition_of_vector-shrink!"></a><a name="Procedure_vector-shrink!"></a><a name="index-vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_vector-shrink!">vector-shrink!</a></b></code><i> <var>vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure shortens the vector <var>vector</var> so that its new size
is <var>k</var>. The value returned is unspecified.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v (vector 'a 'b 'c 'd 'e 'f))</b>
> <b>v</b>
#(a b c d e f)
> <b>(vector-shrink! v 3)</b>
> <b>v</b>
#(a b c)
</pre></td></tr></table>
<a name="Definition_of_append-strings"></a><a name="Procedure_append-strings"></a><a name="index-append_002dstrings"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-strings">append-strings</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a newly allocated string whose elements form
the concatenation of all the strings in the list <var>lst</var>. It is
equivalent to <code>(apply string-append <span class="roman"><var>lst</var></span>)</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s "abc")</b>
> <b>(append-strings (list s s s))</b>
"abcabcabc"
</pre></td></tr></table>
<a name="Definition_of_substring-fill!"></a><a name="Procedure_substring-fill!"></a><a name="index-substring_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_substring-fill!">substring-fill!</a></b></code><i> <var>string</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure is like <code>string-fill!</code>, but fills a selected part
of the given string. It sets the elements of the string <var>string</var>,
beginning with index <var>start</var> (inclusive) and ending with index
<var>end</var> (exclusive) to <var>fill</var>. The value returned is
unspecified.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (string #\a #\b #\c #\d #\e #\f))</b>
> <b>(substring-fill! s 3 5 #\x)</b>
> <b>s</b>
"abcxxf"
</pre></td></tr></table>
<a name="Definition_of_substring-move!"></a><a name="Procedure_substring-move!"></a><a name="index-substring_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_substring-move!">substring-move!</a></b></code><i> <var>src-string</var> <var>src-start</var> <var>src-end</var> <var>dst-string</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure replaces part of the contents of string
<var>dst-string</var> with part of the contents of string
<var>src-string</var>. It copies elements from <var>src-string</var>, beginning
with index <var>src-start</var> (inclusive) and ending with index
<var>src-end</var> (exclusive) to <var>dst-string</var> beginning with index
<var>dst-start</var> (inclusive). The value returned is unspecified.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s1 "123456")</b>
> <b>(define s2 (string #\a #\b #\c #\d #\e #\f))</b>
> <b>(substring-move! s1 3 5 s2 1)</b>
> <b>s2</b>
"a45def"
</pre></td></tr></table>
<a name="Definition_of_string-shrink!"></a><a name="Procedure_string-shrink!"></a><a name="index-string_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-shrink!">string-shrink!</a></b></code><i> <var>string</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure shortens the string <var>string</var> so that its new size
is <var>k</var>. The value returned is unspecified.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (string #\a #\b #\c #\d #\e #\f))</b>
> <b>s</b>
"abcdef"
> <b>(string-shrink! s 3)</b>
> <b>s</b>
"abc"
</pre></td></tr></table>
<a name="Definition_of_box"></a><a name="Procedure_box"></a><a name="index-box"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_box">box</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_box?"></a><a name="Procedure_box?"></a><a name="index-box_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_box?">box?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbox"></a><a name="Procedure_unbox"></a><a name="index-unbox"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbox">unbox</a></b></code><i> <var>box</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_set-box!"></a><a name="Procedure_set-box!"></a><a name="index-set_002dbox_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_set-box!">set-box!</a></b></code><i> <var>box</var> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-boxes"></a>
<p>These procedures implement the <em>box</em> data type. A box is a
cell containing a single mutable field. The lexical syntax
of a box containing the object <var>obj</var> is <code>#&<var>obj</var></code>
(see section <a href="#Box-syntax">Box syntax</a>).
</p>
<p>The procedure <code>box</code> returns a new box object whose content is
initialized to <var>obj</var>. The procedure <code>box?</code> returns <code>#t</code>
if <var>obj</var> is a box, and otherwise returns <code>#f</code>. The procedure
<code>unbox</code> returns the content of the box <var>box</var>. The procedure
<code>set-box!</code> changes the content of the box <var>box</var> to <var>obj</var>.
The procedure <code>set-box!</code> returns an unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define b (box 0))</b>
> <b>b</b>
#&0
> <b>(define (inc!) (set-box! b (+ (unbox b) 1)))</b>
> <b>(inc!)</b>
> <b>b</b>
#&1
> <b>(unbox b)</b>
1
</pre></td></tr></table>
<a name="Definition_of_keyword?"></a><a name="Procedure_keyword?"></a><a name="index-keyword_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_keyword?">keyword?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_keyword-%3Estring"></a><a name="Procedure_keyword-%3Estring"></a><a name="index-keyword_002d_003estring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_keyword-%3Estring">keyword->string</a></b></code><i> <var>keyword</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string-%3Ekeyword"></a><a name="Procedure_string-%3Ekeyword"></a><a name="index-string_002d_003ekeyword"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-%3Ekeyword">string->keyword</a></b></code><i> <var>string</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-keywords"></a>
<p>These procedures implement the <em>keyword</em> data type. Keywords are
similar to symbols but are self evaluating and distinct from the
symbol data type. The lexical syntax of keywords is specified in
<a href="#Keyword-syntax">Keyword syntax</a>.
</p>
<p>The procedure <code>keyword?</code> returns <code>#t</code> if <var>obj</var> is a
keyword, and otherwise returns <code>#f</code>. The procedure
<code>keyword->string</code> returns the name of <var>keyword</var> as a string.
The procedure <code>string->keyword</code> returns the keyword whose name is
<var>string</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(keyword? 'color)</b>
#f
> <b>(keyword? color:)</b>
#t
> <b>(keyword->string color:)</b>
"color"
> <b>(string->keyword "color")</b>
color:
</pre></td></tr></table>
<a name="Definition_of_gensym"></a><a name="Procedure_gensym"></a><a name="index-gensym"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_gensym">gensym</a></b></code><i> <span class="roman">[</span><var>prefix</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a new <em>uninterned symbol</em>. Uninterned symbols
are guaranteed to be distinct from the symbols generated by the
procedures <code>read</code> and <code>string->symbol</code>. The symbol
<var>prefix</var> is the prefix used to generate the new symbol’s name. If
it is not specified, the prefix defaults to ‘<samp>g</samp>’.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(gensym)</b>
#:g0
> <b>(gensym)</b>
#:g1
> <b>(gensym 'star-trek-)</b>
#:star-trek-2
</pre></td></tr></table>
<a name="Definition_of_string-%3Euninterned-symbol"></a><a name="Procedure_string-%3Euninterned-symbol"></a><a name="index-string_002d_003euninterned_002dsymbol"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-%3Euninterned-symbol">string->uninterned-symbol</a></b></code><i> <var>name</var> <span class="roman">[</span><var>hash</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_uninterned-symbol?"></a><a name="Procedure_uninterned-symbol?"></a><a name="index-uninterned_002dsymbol_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_uninterned-symbol?">uninterned-symbol?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>string->uninterned-symbol</code> returns a new uninterned
symbol whose name is <var>name</var> and hash is <var>hash</var>. The name must
be a string and the hash must be a nonnegative fixnum.
</p>
<p>The procedure <code>uninterned-symbol?</code> returns <code>#t</code> when
<var>obj</var> is a symbol that is uninterned and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(uninterned-symbol? (gensym))</b>
#t
> <b>(string->uninterned-symbol "foo")</b>
#:foo:
> <b>(uninterned-symbol? (string->uninterned-symbol "foo"))</b>
#t
> <b>(uninterned-symbol? 'hello)</b>
#f
> <b>(uninterned-symbol? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_string-%3Euninterned-keyword"></a><a name="Procedure_string-%3Euninterned-keyword"></a><a name="index-string_002d_003euninterned_002dkeyword"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-%3Euninterned-keyword">string->uninterned-keyword</a></b></code><i> <var>name</var> <span class="roman">[</span><var>hash</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_uninterned-keyword?"></a><a name="Procedure_uninterned-keyword?"></a><a name="index-uninterned_002dkeyword_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_uninterned-keyword?">uninterned-keyword?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>string->uninterned-keyword</code> returns a new uninterned
keyword whose name is <var>name</var> and hash is <var>hash</var>. The name must
be a string and the hash must be a nonnegative fixnum.
</p>
<p>The procedure <code>uninterned-keyword?</code> returns <code>#t</code> when
<var>obj</var> is a keyword that is uninterned and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(string->uninterned-keyword "foo")</b>
#:foo:
> <b>(uninterned-keyword? (string->uninterned-keyword "foo"))</b>
#t
> <b>(uninterned-keyword? hello:)</b>
#f
> <b>(uninterned-keyword? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_identity"></a><a name="Procedure_identity"></a><a name="index-identity"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_identity">identity</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <var>obj</var>.
</p>
<a name="Definition_of_void"></a><a name="Procedure_void"></a><a name="index-void"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_void">void</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the void object. The read-eval-print loop
prints nothing when the result is the void object.
</p>
<a name="Definition_of_eval"></a><a name="Procedure_eval"></a><a name="index-eval"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_eval">eval</a></b></code><i> <var>expr</var> <span class="roman">[</span><var>env</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The first parameter is a datum representing an expression. The
<code>eval</code> procedure evaluates this expression in the global
interaction environment and returns the result. If present, the
second parameter is ignored (it is provided for compatibility with
R5RS).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(eval '(+ 1 2))</b>
3
> <b>((eval 'car) '(1 2))</b>
1
> <b>(eval '(define x 5))</b>
> <b>x</b>
5
</pre></td></tr></table>
<a name="Definition_of_include"></a><a name="Special_form_include"></a><a name="index-include"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_include">include</a></b></code><i> <span class="roman"><i>file</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<p>The <i>file</i> parameter must be a string naming an existing file
containing Scheme source code. The <code>include</code> special form
splices the content of the specified source file. This form can only
appear where a <code>define</code> form is acceptable.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(include "macros.scm")
(define (f lst)
(include "sort.scm")
(map sqrt (sort lst)))
</pre></td></tr></table>
<a name="Definition_of_define-macro"></a><a name="Special_form_define-macro"></a><a name="index-define_002dmacro"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define-macro">define-macro</a></b></code><i> (<span class="roman"><i>name</i></span> <span class="roman"><i>define-formals</i></span>) <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="index-include-1"></a>
<p>Define <i>name</i> as a macro special form which expands into <i>body</i>.
This form can only appear where a <code>define</code> form is acceptable.
Macros are lexically scoped. The scope of a local macro definition
extends from the definition to the end of the body of the surrounding
binding construct. Macros defined at the top level of a Scheme module
are only visible in that module. To have access to the macro
definitions contained in a file, that file must be included using the
<code>include</code> special form. Macros which are visible from the REPL are
also visible during the compilation of Scheme source files.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define-macro (unless test . body)
`(if ,test #f (begin ,@body)))
(define-macro (push var #!optional val)
`(set! ,var (cons ,val ,var)))
</pre></td></tr></table>
<p>To examine the code into which a macro expands you can use the
compiler’s ‘<samp>-expansion</samp>’ option or the <code>pp</code> procedure.
For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define-macro (push var #!optional val)
`(set! ,var (cons ,val ,var)))</b>
> <b>(pp (lambda () (push stack 1) (push stack) (push stack 3)))</b>
(lambda ()
(set! stack (cons 1 stack))
(set! stack (cons #f stack))
(set! stack (cons 3 stack)))
</pre></td></tr></table>
<a name="Definition_of_define-syntax"></a><a name="Special_form_define-syntax"></a><a name="index-define_002dsyntax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define-syntax">define-syntax</a></b></code><i> <span class="roman"><i>name</i></span> <span class="roman"><i>expander</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="index-define_002dsyntax-1"></a>
<a name="index-syntax_002drules"></a>
<a name="index-syntax_002dcase"></a>
<a name="index-_002d_003as-1"></a>
<p>Define <i>name</i> as a macro special form whose expansion is specified
by <i>expander</i>. This form is available only when the runtime option
‘<samp>-:s</samp>’ is used. This option causes the loading of the
<code>~~lib/syntax-case</code> support library, which is the Hieb and Dybvig
portable <code>syntax-case</code> implementation which has been ported to
the Gambit interpreter and compiler. Note that this implementation of
<code>syntax-case</code> does not support special forms that are specific to
Gambit.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi -:s</b>
Gambit v4.9.3
> <b>(define-syntax unless
(syntax-rules ()
((unless test body ...)
(if test #f (begin body ...)))))</b>
> <b>(let ((test 111)) (unless (= 1 2) (list test test)))</b>
(111 111)
> <b>(pp (lambda () (let ((test 111)) (unless (= 1 2) (list test test)))))</b>
(lambda () ((lambda (%%test14) (if (= 1 2) #f (list %%test14 %%test14))) 111))
> <b>(unless #f (pp xxx))</b>
*** ERROR IN (console)@7.16 -- Unbound variable: xxx
</pre></td></tr></table>
<a name="Definition_of_declare"></a><a name="Special_form_declare"></a><a name="index-declare"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_declare">declare</a></b></code><i> <span class="roman"><i>declaration</i></span>…</i><code>)</code></td><td align="right">special form</td></tr></table>
<p>This form introduces declarations to be used by the compiler
(currently the interpreter ignores the declarations). This form can
only appear where a <code>define</code> form is acceptable. Declarations
are lexically scoped in the same way as macros. The following
declarations are accepted by the compiler:
</p>
<dl compact="compact">
<dt> <code>(<var>dialect</var>)</code></dt>
<dd><a name="index-ieee_002dscheme"></a>
<a name="index-r4rs_002dscheme"></a>
<a name="index-r5rs_002dscheme"></a>
<a name="index-gambit_002dscheme"></a>
<p>Use the given dialect’s semantics. <var>dialect</var> can be:
‘<samp>ieee-scheme</samp>’, ‘<samp>r4rs-scheme</samp>’, ‘<samp>r5rs-scheme</samp>’
or ‘<samp>gambit-scheme</samp>’.
</p>
</dd>
<dt> <code>(<var>strategy</var>)</code></dt>
<dd><a name="index-block"></a>
<a name="index-separate"></a>
<p>Select block compilation or separate compilation. In block
compilation, the compiler assumes that global variables defined in the
current file that are not mutated in the file will never be mutated.
<var>strategy</var> can be: ‘<samp>block</samp>’ or ‘<samp>separate</samp>’.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> inline)</code></dt>
<dd><a name="index-inline"></a>
<p>Allow (or disallow) inlining of user procedures.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> inline-primitives <var>primitive</var>…)</code></dt>
<dd><a name="index-inline_002dprimitives"></a>
<p>The given primitives should (or should not) be inlined
if possible (all primitives if none specified).
</p>
</dd>
<dt> <code>(inlining-limit <var>n</var>)</code></dt>
<dd><a name="index-inlining_002dlimit"></a>
<p>Select the degree to which the compiler inlines user procedures.
<var>n</var> is the upper-bound, in percent, on code expansion that will
result from inlining. Thus, a value of 300 indicates that the size of
the program will not grow by more than 300 percent (i.e. it will be at
most 4 times the size of the original). A value of 0 disables inlining.
The size of a program is the total number of subexpressions it contains
(i.e. the size of an expression is one plus the size of its immediate
subexpressions). The following conditions must hold for a procedure to
be inlined: inlining the procedure must not cause the size of the call
site to grow more than specified by the inlining limit, the site of
definition (the <code>define</code> or <code>lambda</code>) and the call site must
be declared as <code>(inline)</code>, and the compiler must be able to find
the definition of the procedure referred to at the call site (if the
procedure is bound to a global variable, the definition site must have a
<code>(block)</code> declaration). Note that inlining usually causes much
less code expansion than specified by the inlining limit (an expansion
around 10% is common for <var>n</var>=350).
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> lambda-lift)</code></dt>
<dd><a name="index-lambda_002dlift"></a>
<p>Lambda-lift (or don’t lambda-lift) locally defined procedures.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> constant-fold)</code></dt>
<dd><a name="index-constant_002dfold"></a>
<p>Allow (or disallow) constant-folding of primitive procedures.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> standard-bindings <var>var</var>…)</code></dt>
<dd><a name="index-standard_002dbindings"></a>
<p>The given global variables are known (or not known) to be equal to
the value defined for them in the dialect (all variables defined in
the standard if none specified).
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> extended-bindings <var>var</var>…)</code></dt>
<dd><a name="index-extended_002dbindings"></a>
<p>The given global variables are known (or not known) to be equal to the
value defined for them in the runtime system (all variables defined
in the runtime if none specified).
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> run-time-bindings <var>var</var>…)</code></dt>
<dd><a name="index-run_002dtime_002dbindings"></a>
<p>The given global variables will be tested at run time to see if they
are equal to the value defined for them in the runtime system (all
variables defined in the runtime if none specified).
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> safe)</code></dt>
<dd><a name="index-safe"></a>
<p>Generate (or don’t generate) code that will prevent fatal errors at
run time. Note that in ‘<samp>safe</samp>’ mode certain semantic errors will
not be checked as long as they can’t crash the system. For example
the primitive <code>char=?</code> may disregard the type of its arguments in
‘<samp>safe</samp>’ as well as ‘<samp>not safe</samp>’ mode.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> interrupts-enabled)</code></dt>
<dd><a name="index-interrupts_002denabled"></a>
<p>Generate (or don’t generate) interrupt checks. Interrupt checks are
used to detect user interrupts and also to check for stack overflows.
Interrupt checking should not be turned off casually.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> poll-on-return)</code></dt>
<dd><a name="index-poll_002don_002dreturn"></a>
<p>Generate (or don’t generate) interrupt checks on procedure returns
(when interrupt checking is enabled). This declaration has no effect
on the behavior of interrupt checking on procedure calls, which is
needed to guarantee that stack overflows are handled properly.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug)</code></dt>
<dd><a name="index-debug-1"></a>
<a name="index-_002ddebug-1"></a>
<p>Enable (or disable) the generation of debugging information. The kind
of debugging information that is generated depends on the declarations
‘<samp>debug-location</samp>’, ‘<samp>debug-source</samp>’, and
‘<samp>debug-environments</samp>’. If any of the command line options
‘<samp>-debug</samp>’, ‘<samp>-debug-location</samp>’, ‘<samp>-debug-source</samp>’ and
‘<samp>-debug-environments</samp>’ are present, the ‘<samp>debug</samp>’ declaration
is initially enabled, otherwise it is initially disabled. When all
kinds of debugging information are generated there is a substantial
increase in the C compilation time and the size of the generated code.
When compiling a 3000 line Scheme file it was observed that the total
compilation time is 500% longer and the executable code is 150%
bigger.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug-location)</code></dt>
<dd><a name="index-debug_002dlocation-1"></a>
<a name="index-_002ddebug_002dlocation-1"></a>
<p>Select (or deselect) source code location debugging information. When
this declaration and the ‘<samp>debug</samp>’ declaration are in effect, run
time error messages indicate the location of the error in the source
code file. If any of the command line options ‘<samp>-debug-source</samp>’
and ‘<samp>-debug-environments</samp>’ are present and ‘<samp>-debug-location</samp>’
is absent, the ‘<samp>debug-location</samp>’ declaration is initially
disabled, otherwise it is initially enabled. When compiling a 3000
line Scheme file it was observed that the total compilation time is
200% longer and the executable code is 60% bigger.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug-source)</code></dt>
<dd><a name="index-debug_002dsource-1"></a>
<a name="index-_002ddebug_002dsource-1"></a>
<p>Select (or deselect) source code debugging information. When this
declaration and the ‘<samp>debug</samp>’ declaration are in effect, run time
error messages indicate the source code, the backtraces are more
precise, and the <code>pp</code> procedure will display the source code of
compiled procedures. If any of the command line options
‘<samp>-debug-location</samp>’ and ‘<samp>-debug-environments</samp>’ are present and
‘<samp>-debug-source</samp>’ is absent, the ‘<samp>debug-source</samp>’ declaration is
initially disabled, otherwise it is initially enabled. When compiling
a 3000 line Scheme file it was observed that the total compilation
time is 90% longer and the executable code is 90% bigger.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug-environments)</code></dt>
<dd><a name="index-debug_002denvironments-1"></a>
<a name="index-_002ddebug_002denvironments-1"></a>
<p>Select (or deselect) environment debugging information. When this
declaration and the ‘<samp>debug</samp>’ declaration are in effect, the
debugger will have access to the environments of the continuations.
In other words the local variables defined in compiled procedures (and
not optimized away by the compiler) will be shown by the ‘<samp>,e</samp>’
REPL command. If any of the command line options
‘<samp>-debug-location</samp>’ and ‘<samp>-debug-source</samp>’ are present and
‘<samp>-debug-environments</samp>’ is absent, the ‘<samp>debug-environments</samp>’
declaration is initially disabled, otherwise it is initially enabled.
When compiling a 3000 line Scheme file it was observed that the total
compilation time is 70% longer and the executable code is 40% bigger.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> proper-tail-calls)</code></dt>
<dd><a name="index-proper_002dtail_002dcalls"></a>
<a name="index-proper-tail_002dcalls-1"></a>
<a name="index-tail_002dcalls-1"></a>
<p>Generate (or don’t generate) proper tail calls. When proper tail
calls are turned off, tail calls are handled like non-tail calls, that
is a continuation frame will be created for all calls regardless of
their kind. This is useful for debugging because the caller of a
procedure will be visible in the backtrace produced by the REPL’s
‘<samp>,b</samp>’ command even when the call is a tail call. Be advised that
this does cause stack space to be consumed for tail calls which may
cause the stack to overflow when performing long iterations with tail
calls (whether they are expressed with a <code>letrec</code>, named
<code>let</code>, <code>do</code>, or other form).
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> generative-lambda)</code></dt>
<dd><a name="index-generative_002dlambda"></a>
<a name="index-generative_002dlambda-1"></a>
<p>Force (or don’t force) the creation of fresh closures when evaluating
lambda-expressions. A fresh closure is always created when a
lambda-expression has at least one free variable (that has not been
eliminated by dead-code elimination or other compiler optimization) or
when the generative-lambda declaration is turned on. When a
lambda-expression has no free variables and the generative-lambda
declaration is turned off, the value of the lambda-expression may be
the same procedure (in the sense of <code>eq?</code>).
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> optimize-dead-local-variables)</code></dt>
<dd><a name="index-optimize_002ddead_002dlocal_002dvariables"></a>
<p>Remove (or preserve) the dead local variables in the environment.
Preserving the dead local variables is useful for debugging because
continuations will contain the dead variables. Thus, if the code is
also compiled with the declaration ‘<samp>debug-environments</samp>’
the ‘<samp>,e</samp>’, ‘<samp>,ed</samp>’, ‘<samp>,be</samp>’, and ‘<samp>,bed</samp>’ REPL
commands will display the dead variables. On the other hand,
preserving the dead local variables may change the space complexity of
the program (i.e. some of the data that would normally be reclaimed by
the garbage collector will not be). Note that due to other compiler
optimizations some dead local variables may be removed regardless of
this declaration.
</p>
</dd>
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> optimize-dead-definitions <var>var</var>…)</code></dt>
<dd><a name="index-optimize_002ddead_002ddefinitions"></a>
<p>Remove (or preserve) the dead toplevel definitions of the given global
variables (all global variables if none specified). A toplevel
definition is dead if it is not referenced by toplevel expressions
of the program or toplevel definitions that aren’t dead (regardless
of the evaluation of its expression causing a side-effect). When a
module is separately compiled and some of its definitions are only
used by other modules, this declaration must be used with care to keep
definitions that are used by other modules, for example if <code>foo</code>
is referenced in another module the following declaration should be
used: ‘<samp>(declare (not optimize-dead-definitions foo))</samp>’.
</p>
</dd>
<dt> <code>(<var>number-type</var> <var>primitive</var>…)</code></dt>
<dd><a name="index-generic"></a>
<a name="index-fixnum"></a>
<a name="index-flonum"></a>
<p>Numeric arguments and result of the specified primitives are
known to be of the given type (all primitives if none specified).
<var>number-type</var> can be: ‘<samp>generic</samp>’, ‘<samp>fixnum</samp>’, or
‘<samp>flonum</samp>’.
</p>
</dd>
<dt> <code>(<var>mostly-number-type</var> <var>primitive</var>…)</code></dt>
<dd><a name="index-mostly_002dgeneric"></a>
<a name="index-mostly_002dfixnum"></a>
<a name="index-mostly_002dfixnum_002dflonum"></a>
<a name="index-mostly_002dflonum"></a>
<a name="index-mostly_002dflonum_002dfixnum"></a>
<p>Numeric arguments and result of the specified primitives are expected
to be most often of the given type (all primitives if none specified).
<var>mostly-number-type</var> can be: ‘<samp>mostly-generic</samp>’,
‘<samp>mostly-fixnum</samp>’, ‘<samp>mostly-fixnum-flonum</samp>’,
‘<samp>mostly-flonum</samp>’, or ‘<samp>mostly-flonum-fixnum</samp>’.
</p>
</dd>
</dl>
<p>The default declarations used by the compiler are equivalent to:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(declare
(gambit-scheme)
(separate)
(inline)
(inline-primitives)
(inlining-limit 370)
(constant-fold)
(lambda-lift)
(not standard-bindings)
(not extended-bindings)
(run-time-bindings)
(safe)
(interrupts-enabled)
(not poll-on-return)
(not debug) ;; depends on debugging command line options
(debug-location) ;; depends on debugging command line options
(debug-source) ;; depends on debugging command line options
(debug-environments) ;; depends on debugging command line options
(proper-tail-calls)
(not generative-lambda)
(optimize-dead-local-variables)
(not optimize-dead-definitions)
(generic)
(mostly-fixnum-flonum)
)
</pre></td></tr></table>
<p>These declarations are compatible with the semantics of R5RS Scheme
and includes a few procedures from R6RS (mainly fixnum specific and
flonum specific procedures). Typically used declarations that enhance
performance, at the cost of violating the R5RS Scheme semantics, are:
<code>(standard-bindings)</code>, <code>(block)</code>, <code>(not safe)</code> and
<code>(fixnum)</code>.
</p>
<hr size="6">
<a name="Undocumented-extensions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Miscellaneous-extensions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Namespaces" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Namespaces" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Undocumented-extensions-1"></a>
<h2 class="section">6.4 Undocumented extensions</h2>
<p>The procedures in this section are not yet documented.
</p>
<a name="Definition_of_continuation?"></a><a name="Procedure_continuation?"></a><a name="index-continuation_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_continuation?">continuation?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_continuation-capture"></a><a name="Procedure_continuation-capture"></a><a name="index-continuation_002dcapture"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_continuation-capture">continuation-capture</a></b></code><i> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_continuation-graft"></a><a name="Procedure_continuation-graft"></a><a name="index-continuation_002dgraft"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_continuation-graft">continuation-graft</a></b></code><i> <var>cont</var> <var>proc</var> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_continuation-return"></a><a name="Procedure_continuation-return"></a><a name="index-continuation_002dreturn"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_continuation-return">continuation-return</a></b></code><i> <var>cont</var> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures provide access to internal first-class continuations
which are represented using continuation objects distinct from procedures.
</p>
<p>The procedure <code>continuation?</code> returns <code>#t</code> when <var>obj</var> is
a continuation object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>continuation-capture</code> is similar to the
<code>call/cc</code> procedure but it represents the continuation with a
continuation object. The <var>proc</var> parameter must be a procedure
accepting a single argument. The procedure
<code>continuation-capture</code> reifies its continuation and calls
<var>proc</var> with the corresponding continuation object as its sole
argument. Like for <code>call/cc</code>, the implicit continuation of the
call to <var>proc</var> is the implicit continuation of the call to
<code>continuation-capture</code>.
</p>
<p>The procedure <code>continuation-graft</code> performs a procedure call to
the procedure <var>proc</var> with arguments <var>obj</var>… and the
implicit continuation corresponding to the continuation object
<var>cont</var>. The current continuation of the call to procedure
<code>continuation-graft</code> is ignored.
</p>
<p>The procedure <code>continuation-return</code> invokes the implicit
continuation corresponding to the continuation object <var>cont</var> with
the result(s) <var>obj</var>…. This procedure can be easily
defined in terms of <code>continuation-graft</code>:
</p>
<table><tr><td> </td><td><pre class="smallexample">(define (continuation-return cont . objs)
(continuation-graft (lambda () (apply values objs))))
</pre></td></tr></table>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define x #f)</b>
> <b>(define p (make-parameter 11))</b>
> <b>(pp (parameterize ((p 22))
(cons 33 (continuation-capture
(lambda (c) (set! x c) 44)))))</b>
(33 . 44)
> <b>x</b>
#<continuation #2>
> <b>(continuation-return x 55)</b>
(33 . 55)
> <b>(continuation-graft x (lambda () (expt 2 10)))</b>
(33 . 1024)
> <b>(continuation-graft x expt 2 10)</b>
(33 . 1024)
> <b>(continuation-graft x (lambda () (p)))</b>
(33 . 22)
> <b>(define (map-sqrt1 lst)
(call/cc
(lambda (k)
(map (lambda (x)
(if (< x 0)
(k 'error)
(sqrt x)))
lst))))</b>
> <b>(map-sqrt1 '(1 4 9))</b>
(1 2 3)
> <b>(map-sqrt1 '(1 -1 9))</b>
error
> <b>(define (map-sqrt2 lst)
(continuation-capture
(lambda (c)
(map (lambda (x)
(if (< x 0)
(continuation-return c 'error)
(sqrt x)))
lst))))</b>
> <b>(map-sqrt2 '(1 4 9))</b>
(1 2 3)
> <b>(map-sqrt2 '(1 -1 9))</b>
error
</pre></td></tr></table>
<a name="Definition_of_display-exception"></a><a name="Procedure_display-exception"></a><a name="index-display_002dexception"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_display-exception">display-exception</a></b></code><i> <var>exc</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_display-exception-in-context"></a><a name="Procedure_display-exception-in-context"></a><a name="index-display_002dexception_002din_002dcontext"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_display-exception-in-context">display-exception-in-context</a></b></code><i> <var>exc</var> <var>cont</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_display-procedure-environment"></a><a name="Procedure_display-procedure-environment"></a><a name="index-display_002dprocedure_002denvironment"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_display-procedure-environment">display-procedure-environment</a></b></code><i> <var>proc</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_display-continuation-environment"></a><a name="Procedure_display-continuation-environment"></a><a name="index-display_002dcontinuation_002denvironment"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_display-continuation-environment">display-continuation-environment</a></b></code><i> <var>cont</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_display-continuation-dynamic-environment"></a><a name="Procedure_display-continuation-dynamic-environment"></a><a name="index-display_002dcontinuation_002ddynamic_002denvironment"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_display-continuation-dynamic-environment">display-continuation-dynamic-environment</a></b></code><i> <var>cont</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_display-continuation-backtrace"></a><a name="Procedure_display-continuation-backtrace"></a><a name="index-display_002dcontinuation_002dbacktrace"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_display-continuation-backtrace">display-continuation-backtrace</a></b></code><i> <var>cont</var> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>all-frames?</var> <span class="roman">[</span><var>display-env?</var> <span class="roman">[</span><var>max-head</var> <span class="roman">[</span><var>max-tail</var> <span class="roman">[</span><var>depth</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>display-continuation-backtrace</code> displays the
frames of the continuation corresponding to the continuation object
<var>cont</var> on the port <var>port</var>. If it is not specified, <var>port</var>
defaults to the current output-port. The frames are displayed in the
same format as the REPL’s ‘<samp>,b</samp>’ command.
</p>
<p>The parameter <var>all-frames?</var>, which defaults to <code>#f</code>, controls
which frames are displayed. Some frames of ancillary importance, such
as internal frames created by the interpreter, are not displayed when
<var>all-frames?</var> is <code>#f</code>. Otherwise all frames are displayed.
</p>
<p>The parameter <var>display-env?</var>, which defaults to <code>#f</code>, controls
if the frames are displayed with its environment (the variables
accessible and their bindings).
</p>
<p>The parameters <var>max-head</var> and <var>max-tail</var>, which default to 10
and 4 respectively, control how many frames are displayed at the head
and tail of the continuation.
</p>
<p>The parameter <var>depth</var>, which defaults to 0, causes the frame numbers
to be offset by that value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define x #f)</b>
> <b>(define (fib n)
(if (< n 2)
(continuation-capture
(lambda (c) (set! x c) 1))
(+ (fib (- n 1))
(fib (- n 2)))))</b>
> <b>(fib 10)</b>
89
> <b>(display-continuation-backtrace x)</b>
0 fib (console)@7:12 (fib (- n 2))
1 fib (console)@7:12 (fib (- n 2))
2 fib (console)@7:12 (fib (- n 2))
3 fib (console)@7:12 (fib (- n 2))
4 fib (console)@7:12 (fib (- n 2))
5 (interaction) (console)@8:1 (fib 10)
#f
> <b>(display-continuation-backtrace x (current-output-port) #t)</b>
0 fib (console)@7:12 (fib (- n 2))
1 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
2 fib (console)@7:12 (fib (- n 2))
3 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
4 fib (console)@7:12 (fib (- n 2))
5 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
6 fib (console)@7:12 (fib (- n 2))
7 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
8 fib (console)@7:12 (fib (- n 2))
9 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
...
13 ##with-no-result-expected-toplevel
14 ##repl-debug
15 ##repl-debug-main
16 ##kernel-handlers
#f
> <b>(display-continuation-backtrace x (current-output-port) #f #t)</b>
0 fib (console)@7:12 (fib (- n 2))
n = 2
1 fib (console)@7:12 (fib (- n 2))
n = 4
2 fib (console)@7:12 (fib (- n 2))
n = 6
3 fib (console)@7:12 (fib (- n 2))
n = 8
4 fib (console)@7:12 (fib (- n 2))
n = 10
5 (interaction) (console)@8:1 (fib 10)
#f
> <b>(display-continuation-backtrace x (current-output-port) #f #f 2 1 100)</b>
100 fib (console)@7:12 (fib (- n 2))
101 fib (console)@7:12 (fib (- n 2))
...
105 (interaction) (console)@8:1 (fib 10)
#f
</pre></td></tr></table>
<a name="Definition_of_make-thread-group"></a><a name="Procedure_make-thread-group"></a><a name="index-make_002dthread_002dgroup"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-thread-group">make-thread-group</a></b></code><i> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>thread-group</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group?"></a><a name="Procedure_thread-group?"></a><a name="index-thread_002dgroup_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group?">thread-group?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group-name"></a><a name="Procedure_thread-group-name"></a><a name="index-thread_002dgroup_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-name">thread-group-name</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group-parent"></a><a name="Procedure_thread-group-parent"></a><a name="index-thread_002dgroup_002dparent"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-parent">thread-group-parent</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group-resume!"></a><a name="Procedure_thread-group-resume!"></a><a name="index-thread_002dgroup_002dresume_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-resume!">thread-group-resume!</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group-suspend!"></a><a name="Procedure_thread-group-suspend!"></a><a name="index-thread_002dgroup_002dsuspend_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-suspend!">thread-group-suspend!</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group-terminate!"></a><a name="Procedure_thread-group-terminate!"></a><a name="index-thread_002dgroup_002dterminate_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-terminate!">thread-group-terminate!</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group-%3Ethread-group-list"></a><a name="Procedure_thread-group-%3Ethread-group-list"></a><a name="index-thread_002dgroup_002d_003ethread_002dgroup_002dlist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-group-list">thread-group->thread-group-list</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group-%3Ethread-group-vector"></a><a name="Procedure_thread-group-%3Ethread-group-vector"></a><a name="index-thread_002dgroup_002d_003ethread_002dgroup_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-group-vector">thread-group->thread-group-vector</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group-%3Ethread-list"></a><a name="Procedure_thread-group-%3Ethread-list"></a><a name="index-thread_002dgroup_002d_003ethread_002dlist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-list">thread-group->thread-list</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-group-%3Ethread-vector"></a><a name="Procedure_thread-group-%3Ethread-vector"></a><a name="index-thread_002dgroup_002d_003ethread_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-vector">thread-group->thread-vector</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state"></a><a name="Procedure_thread-state"></a><a name="index-thread_002dstate"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state">thread-state</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-uninitialized?"></a><a name="Procedure_thread-state-uninitialized?"></a><a name="index-thread_002dstate_002duninitialized_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-uninitialized?">thread-state-uninitialized?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-initialized?"></a><a name="Procedure_thread-state-initialized?"></a><a name="index-thread_002dstate_002dinitialized_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-initialized?">thread-state-initialized?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-running?"></a><a name="Procedure_thread-state-running?"></a><a name="index-thread_002dstate_002drunning_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-running?">thread-state-running?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-running-processor"></a><a name="Procedure_thread-state-running-processor"></a><a name="index-thread_002dstate_002drunning_002dprocessor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-running-processor">thread-state-running-processor</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-waiting?"></a><a name="Procedure_thread-state-waiting?"></a><a name="index-thread_002dstate_002dwaiting_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-waiting?">thread-state-waiting?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-waiting-for"></a><a name="Procedure_thread-state-waiting-for"></a><a name="index-thread_002dstate_002dwaiting_002dfor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-waiting-for">thread-state-waiting-for</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-waiting-timeout"></a><a name="Procedure_thread-state-waiting-timeout"></a><a name="index-thread_002dstate_002dwaiting_002dtimeout"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-waiting-timeout">thread-state-waiting-timeout</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-normally-terminated?"></a><a name="Procedure_thread-state-normally-terminated?"></a><a name="index-thread_002dstate_002dnormally_002dterminated_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-normally-terminated?">thread-state-normally-terminated?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-normally-terminated-result"></a><a name="Procedure_thread-state-normally-terminated-result"></a><a name="index-thread_002dstate_002dnormally_002dterminated_002dresult"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-normally-terminated-result">thread-state-normally-terminated-result</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-abnormally-terminated?"></a><a name="Procedure_thread-state-abnormally-terminated?"></a><a name="index-thread_002dstate_002dabnormally_002dterminated_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-abnormally-terminated?">thread-state-abnormally-terminated?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-state-abnormally-terminated-reason"></a><a name="Procedure_thread-state-abnormally-terminated-reason"></a><a name="index-thread_002dstate_002dabnormally_002dterminated_002dreason"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-state-abnormally-terminated-reason">thread-state-abnormally-terminated-reason</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_top"></a><a name="Procedure_top"></a><a name="index-top"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_top">top</a></b></code><i> <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>thread-group</var> <span class="roman">[</span><var>port</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-interrupt!"></a><a name="Procedure_thread-interrupt!"></a><a name="index-thread_002dinterrupt_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-interrupt!">thread-interrupt!</a></b></code><i> <var>thread</var> <span class="roman">[</span><var>thunk</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-suspend!"></a><a name="Procedure_thread-suspend!"></a><a name="index-thread_002dsuspend_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-suspend!">thread-suspend!</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-resume!"></a><a name="Procedure_thread-resume!"></a><a name="index-thread_002dresume_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-resume!">thread-resume!</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-thread-group"></a><a name="Procedure_thread-thread-group"></a><a name="index-thread_002dthread_002dgroup"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-thread-group">thread-thread-group</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_define-type-of-thread"></a><a name="Special_form_define-type-of-thread"></a><a name="index-define_002dtype_002dof_002dthread"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define-type-of-thread">define-type-of-thread</a></b></code><i> <span class="roman"><i>name</i></span> <span class="roman"><i>field</i></span>…</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_thread-init!"></a><a name="Procedure_thread-init!"></a><a name="index-thread_002dinit_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-init!">thread-init!</a></b></code><i> <var>thread</var> <var>thunk</var> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>thread-group</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_initialized-thread-exception?"></a><a name="Procedure_initialized-thread-exception?"></a><a name="index-initialized_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_initialized-thread-exception?">initialized-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_initialized-thread-exception-procedure"></a><a name="Procedure_initialized-thread-exception-procedure"></a><a name="index-initialized_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_initialized-thread-exception-procedure">initialized-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_initialized-thread-exception-arguments"></a><a name="Procedure_initialized-thread-exception-arguments"></a><a name="index-initialized_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_initialized-thread-exception-arguments">initialized-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_uninitialized-thread-exception?"></a><a name="Procedure_uninitialized-thread-exception?"></a><a name="index-uninitialized_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_uninitialized-thread-exception?">uninitialized-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_uninitialized-thread-exception-procedure"></a><a name="Procedure_uninitialized-thread-exception-procedure"></a><a name="index-uninitialized_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_uninitialized-thread-exception-procedure">uninitialized-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_uninitialized-thread-exception-arguments"></a><a name="Procedure_uninitialized-thread-exception-arguments"></a><a name="index-uninitialized_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_uninitialized-thread-exception-arguments">uninitialized-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_inactive-thread-exception?"></a><a name="Procedure_inactive-thread-exception?"></a><a name="index-inactive_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_inactive-thread-exception?">inactive-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_inactive-thread-exception-procedure"></a><a name="Procedure_inactive-thread-exception-procedure"></a><a name="index-inactive_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_inactive-thread-exception-procedure">inactive-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_inactive-thread-exception-arguments"></a><a name="Procedure_inactive-thread-exception-arguments"></a><a name="index-inactive_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_inactive-thread-exception-arguments">inactive-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_rpc-remote-error-exception?"></a><a name="Procedure_rpc-remote-error-exception?"></a><a name="index-rpc_002dremote_002derror_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_rpc-remote-error-exception?">rpc-remote-error-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_rpc-remote-error-exception-procedure"></a><a name="Procedure_rpc-remote-error-exception-procedure"></a><a name="index-rpc_002dremote_002derror_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_rpc-remote-error-exception-procedure">rpc-remote-error-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_rpc-remote-error-exception-arguments"></a><a name="Procedure_rpc-remote-error-exception-arguments"></a><a name="index-rpc_002dremote_002derror_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_rpc-remote-error-exception-arguments">rpc-remote-error-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_rpc-remote-error-exception-message"></a><a name="Procedure_rpc-remote-error-exception-message"></a><a name="index-rpc_002dremote_002derror_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_rpc-remote-error-exception-message">rpc-remote-error-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_processor?"></a><a name="Procedure_processor?"></a><a name="index-processor_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_processor?">processor?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_current-processor"></a><a name="Procedure_current-processor"></a><a name="index-current_002dprocessor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-processor">current-processor</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_processor-id"></a><a name="Procedure_processor-id"></a><a name="index-processor_002did"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_processor-id">processor-id</a></b></code><i> <var>processor</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_timeout-%3Etime"></a><a name="Procedure_timeout-%3Etime"></a><a name="index-timeout_002d_003etime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_timeout-%3Etime">timeout->time</a></b></code><i> <var>timeout</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_current-second"></a><a name="Procedure_current-second"></a><a name="index-current_002dsecond"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-second">current-second</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_current-jiffy"></a><a name="Procedure_current-jiffy"></a><a name="index-current_002djiffy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-jiffy">current-jiffy</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_jiffies-per-second"></a><a name="Procedure_jiffies-per-second"></a><a name="index-jiffies_002dper_002dsecond"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_jiffies-per-second">jiffies-per-second</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_get-environment-variable"></a><a name="Procedure_get-environment-variable"></a><a name="index-get_002denvironment_002dvariable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_get-environment-variable">get-environment-variable</a></b></code><i> <var>name</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_get-environment-variables"></a><a name="Procedure_get-environment-variables"></a><a name="index-get_002denvironment_002dvariables"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_get-environment-variables">get-environment-variables</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-dummy"></a><a name="Procedure_open-dummy"></a><a name="index-open_002ddummy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-dummy">open-dummy</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_port-settings-set!"></a><a name="Procedure_port-settings-set!"></a><a name="index-port_002dsettings_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_port-settings-set!">port-settings-set!</a></b></code><i> <var>port</var> <var>settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_port-io-exception-handler-set!"></a><a name="Procedure_port-io-exception-handler-set!"></a><a name="index-port_002dio_002dexception_002dhandler_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_port-io-exception-handler-set!">port-io-exception-handler-set!</a></b></code><i> <var>port</var> <var>handler</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_input-port-bytes-buffered"></a><a name="Procedure_input-port-bytes-buffered"></a><a name="index-input_002dport_002dbytes_002dbuffered"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port-bytes-buffered">input-port-bytes-buffered</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_input-port-characters-buffered"></a><a name="Procedure_input-port-characters-buffered"></a><a name="index-input_002dport_002dcharacters_002dbuffered"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port-characters-buffered">input-port-characters-buffered</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_nonempty-input-port-character-buffer-exception?"></a><a name="Procedure_nonempty-input-port-character-buffer-exception?"></a><a name="index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_nonempty-input-port-character-buffer-exception?">nonempty-input-port-character-buffer-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_nonempty-input-port-character-buffer-exception-arguments"></a><a name="Procedure_nonempty-input-port-character-buffer-exception-arguments"></a><a name="index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_nonempty-input-port-character-buffer-exception-arguments">nonempty-input-port-character-buffer-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_nonempty-input-port-character-buffer-exception-procedure"></a><a name="Procedure_nonempty-input-port-character-buffer-exception-procedure"></a><a name="index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_nonempty-input-port-character-buffer-exception-procedure">nonempty-input-port-character-buffer-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_repl-input-port"></a><a name="Procedure_repl-input-port"></a><a name="index-repl_002dinput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_repl-input-port">repl-input-port</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_repl-output-port"></a><a name="Procedure_repl-output-port"></a><a name="index-repl_002doutput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_repl-output-port">repl-output-port</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_console-port"></a><a name="Procedure_console-port"></a><a name="index-console_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_console-port">console-port</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_current-user-interrupt-handler"></a><a name="Procedure_current-user-interrupt-handler"></a><a name="index-current_002duser_002dinterrupt_002dhandler"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-user-interrupt-handler">current-user-interrupt-handler</a></b></code><i> <span class="roman">[</span><var>handler</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_defer-user-interrupts"></a><a name="Procedure_defer-user-interrupts"></a><a name="index-defer_002duser_002dinterrupts"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_defer-user-interrupts">defer-user-interrupts</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_primordial-exception-handler"></a><a name="Procedure_primordial-exception-handler"></a><a name="index-primordial_002dexception_002dhandler"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_primordial-exception-handler">primordial-exception-handler</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_err-code-%3Estring"></a><a name="Procedure_err-code-%3Estring"></a><a name="index-err_002dcode_002d_003estring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_err-code-%3Estring">err-code->string</a></b></code><i> <var>code</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_foreign?"></a><a name="Procedure_foreign?"></a><a name="index-foreign_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_foreign?">foreign?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_foreign-tags"></a><a name="Procedure_foreign-tags"></a><a name="index-foreign_002dtags"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_foreign-tags">foreign-tags</a></b></code><i> <var>foreign</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_foreign-address"></a><a name="Procedure_foreign-address"></a><a name="index-foreign_002daddress"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_foreign-address">foreign-address</a></b></code><i> <var>foreign</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_foreign-release!"></a><a name="Procedure_foreign-release!"></a><a name="index-foreign_002drelease_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_foreign-release!">foreign-release!</a></b></code><i> <var>foreign</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_foreign-released?"></a><a name="Procedure_foreign-released?"></a><a name="index-foreign_002dreleased_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_foreign-released?">foreign-released?</a></b></code><i> <var>foreign</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_invalid-hash-number-exception?"></a><a name="Procedure_invalid-hash-number-exception?"></a><a name="index-invalid_002dhash_002dnumber_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_invalid-hash-number-exception?">invalid-hash-number-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_invalid-hash-number-exception-procedure"></a><a name="Procedure_invalid-hash-number-exception-procedure"></a><a name="index-invalid_002dhash_002dnumber_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_invalid-hash-number-exception-procedure">invalid-hash-number-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_invalid-hash-number-exception-arguments"></a><a name="Procedure_invalid-hash-number-exception-arguments"></a><a name="index-invalid_002dhash_002dnumber_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_invalid-hash-number-exception-arguments">invalid-hash-number-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tcp-client-local-socket-info"></a><a name="Procedure_tcp-client-local-socket-info"></a><a name="index-tcp_002dclient_002dlocal_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tcp-client-local-socket-info">tcp-client-local-socket-info</a></b></code><i> <var>tcp-client-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tcp-client-peer-socket-info"></a><a name="Procedure_tcp-client-peer-socket-info"></a><a name="index-tcp_002dclient_002dpeer_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tcp-client-peer-socket-info">tcp-client-peer-socket-info</a></b></code><i> <var>tcp-client-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tcp-server-socket-info"></a><a name="Procedure_tcp-server-socket-info"></a><a name="index-tcp_002dserver_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tcp-server-socket-info">tcp-server-socket-info</a></b></code><i> <var>tcp-server-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_socket-info?"></a><a name="Procedure_socket-info?"></a><a name="index-socket_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_socket-info?">socket-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_socket-info-address"></a><a name="Procedure_socket-info-address"></a><a name="index-socket_002dinfo_002daddress"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_socket-info-address">socket-info-address</a></b></code><i> <var>socket-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_socket-info-family"></a><a name="Procedure_socket-info-family"></a><a name="index-socket_002dinfo_002dfamily"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_socket-info-family">socket-info-family</a></b></code><i> <var>socket-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_socket-info-port-number"></a><a name="Procedure_socket-info-port-number"></a><a name="index-socket_002dinfo_002dport_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_socket-info-port-number">socket-info-port-number</a></b></code><i> <var>socket-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_system-version"></a><a name="Procedure_system-version"></a><a name="index-system_002dversion"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_system-version">system-version</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_system-version-string"></a><a name="Procedure_system-version-string"></a><a name="index-system_002dversion_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_system-version-string">system-version-string</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_system-type"></a><a name="Procedure_system-type"></a><a name="index-system_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_system-type">system-type</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_system-type-string"></a><a name="Procedure_system-type-string"></a><a name="index-system_002dtype_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_system-type-string">system-type-string</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_configure-command-string"></a><a name="Procedure_configure-command-string"></a><a name="index-configure_002dcommand_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_configure-command-string">configure-command-string</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_system-stamp"></a><a name="Procedure_system-stamp"></a><a name="index-system_002dstamp"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_system-stamp">system-stamp</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_future"></a><a name="Special_form_future"></a><a name="index-future"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_future">future</a></b></code><i> <var>expr</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_touch"></a><a name="Procedure_touch"></a><a name="index-touch"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_touch">touch</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tty?"></a><a name="Procedure_tty?"></a><a name="index-tty_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tty?">tty?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tty-history"></a><a name="Procedure_tty-history"></a><a name="index-tty_002dhistory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tty-history">tty-history</a></b></code><i> <var>tty</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tty-history-set!"></a><a name="Procedure_tty-history-set!"></a><a name="index-tty_002dhistory_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tty-history-set!">tty-history-set!</a></b></code><i> <var>tty</var> <var>history</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tty-history-max-length-set!"></a><a name="Procedure_tty-history-max-length-set!"></a><a name="index-tty_002dhistory_002dmax_002dlength_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tty-history-max-length-set!">tty-history-max-length-set!</a></b></code><i> <var>tty</var> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tty-paren-balance-duration-set!"></a><a name="Procedure_tty-paren-balance-duration-set!"></a><a name="index-tty_002dparen_002dbalance_002dduration_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tty-paren-balance-duration-set!">tty-paren-balance-duration-set!</a></b></code><i> <var>tty</var> <var>duration</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tty-text-attributes-set!"></a><a name="Procedure_tty-text-attributes-set!"></a><a name="index-tty_002dtext_002dattributes_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tty-text-attributes-set!">tty-text-attributes-set!</a></b></code><i> <var>tty</var> <var>attributes</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tty-mode-set!"></a><a name="Procedure_tty-mode-set!"></a><a name="index-tty_002dmode_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tty-mode-set!">tty-mode-set!</a></b></code><i> <var>tty</var> <var>mode</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tty-type-set!"></a><a name="Procedure_tty-type-set!"></a><a name="index-tty_002dtype_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tty-type-set!">tty-type-set!</a></b></code><i> <var>tty</var> <var>type</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-input-from-port"></a><a name="Procedure_with-input-from-port"></a><a name="index-with_002dinput_002dfrom_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-input-from-port">with-input-from-port</a></b></code><i> <var>port</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-output-to-port"></a><a name="Procedure_with-output-to-port"></a><a name="index-with_002doutput_002dto_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-output-to-port">with-output-to-port</a></b></code><i> <var>port</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_input-port-char-position"></a><a name="Procedure_input-port-char-position"></a><a name="index-input_002dport_002dchar_002dposition"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port-char-position">input-port-char-position</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_output-port-char-position"></a><a name="Procedure_output-port-char-position"></a><a name="index-output_002dport_002dchar_002dposition"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_output-port-char-position">output-port-char-position</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-event-queue"></a><a name="Procedure_open-event-queue"></a><a name="index-open_002devent_002dqueue"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-event-queue">open-event-queue</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_main"></a><a name="Procedure_main"></a><a name="index-main"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_main">main</a></b></code><i> …</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_define-record-type"></a><a name="Special_form_define-record-type"></a><a name="index-define_002drecord_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define-record-type">define-record-type</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_define-type"></a><a name="Special_form_define-type"></a><a name="index-define_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define-type">define-type</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_namespace"></a><a name="Special_form_namespace"></a><a name="index-namespace"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_namespace">namespace</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_this-source-file"></a><a name="Special_form_this-source-file"></a><a name="index-this_002dsource_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_this-source-file">this-source-file</a></b></code><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_receive"></a><a name="Special_form_receive"></a><a name="index-receive"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_receive">receive</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_cond-expand"></a><a name="Special_form_cond-expand"></a><a name="index-cond_002dexpand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_cond-expand">cond-expand</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_define-cond-expand-feature"></a><a name="Special_form_define-cond-expand-feature"></a><a name="index-define_002dcond_002dexpand_002dfeature"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define-cond-expand-feature">define-cond-expand-feature</a></b></code><i> <var>ident</var> …</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_case-lambda"></a><a name="Special_form_case-lambda"></a><a name="index-case_002dlambda"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_case-lambda">case-lambda</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_list-set"></a><a name="Procedure_list-set"></a><a name="index-list_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-set">list-set</a></b></code><i> <var>list</var> <var>k</var> <var>val</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-set!"></a><a name="Procedure_list-set!"></a><a name="index-list_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-set!">list-set!</a></b></code><i> <var>list</var> <var>k</var> <var>val</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fold"></a><a name="Procedure_fold"></a><a name="index-fold"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fold">fold</a></b></code><i> <var>proc</var> <var>base</var> <var>list</var> …</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fold-right"></a><a name="Procedure_fold-right"></a><a name="index-fold_002dright"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fold-right">fold-right</a></b></code><i> <var>proc</var> <var>base</var> <var>list</var> …</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_iota"></a><a name="Procedure_iota"></a><a name="index-iota"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_iota">iota</a></b></code><i> <var>count</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>step</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_circular-list"></a><a name="Procedure_circular-list"></a><a name="index-circular_002dlist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_circular-list">circular-list</a></b></code><i> <var>x</var> <var>y</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_cons%2A"></a><a name="Procedure_cons%2A"></a><a name="index-cons_002a"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_cons%2A">cons*</a></b></code><i> <var>x</var> <var>y</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-copy"></a><a name="Procedure_list-copy"></a><a name="index-list_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-copy">list-copy</a></b></code><i> <var>list</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-tabulate"></a><a name="Procedure_list-tabulate"></a><a name="index-list_002dtabulate"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-tabulate">list-tabulate</a></b></code><i> <var>n</var> <var>init-proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-list"></a><a name="Procedure_make-list"></a><a name="index-make_002dlist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-list">make-list</a></b></code><i> <var>n</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_reverse!"></a><a name="Procedure_reverse!"></a><a name="index-reverse_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_reverse!">reverse!</a></b></code><i> <var>list</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_xcons"></a><a name="Procedure_xcons"></a><a name="index-xcons"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_xcons">xcons</a></b></code><i> <var>d</var> <var>a</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_take"></a><a name="Procedure_take"></a><a name="index-take"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_take">take</a></b></code><i> <var>x</var> <var>i</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_drop"></a><a name="Procedure_drop"></a><a name="index-drop"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_drop">drop</a></b></code><i> <var>x</var> <var>i</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_last"></a><a name="Procedure_last"></a><a name="index-last"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_last">last</a></b></code><i> <var>pair</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_last-pair"></a><a name="Procedure_last-pair"></a><a name="index-last_002dpair"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_last-pair">last-pair</a></b></code><i> <var>pair</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_finite?"></a><a name="Procedure_finite?"></a><a name="index-finite_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_finite?">finite?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_infinite?"></a><a name="Procedure_infinite?"></a><a name="index-infinite_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_infinite?">infinite?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_nan?"></a><a name="Procedure_nan?"></a><a name="index-nan_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_nan?">nan?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_six.!"></a><a name="Undefined_six.!"></a><a name="index-six_002e_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.!">six.!</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.!x"></a><a name="Special_form_six.!x"></a><a name="index-six_002e_0021x"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.!x">six.!x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.&x"></a><a name="Special_form_six.&x"></a><a name="index-six_002e_0026x"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.&x">six.&x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.%2Ax"></a><a name="Special_form_six.%2Ax"></a><a name="index-six_002e_002ax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.%2Ax">six.*x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.%2B%2Bx"></a><a name="Special_form_six.%2B%2Bx"></a><a name="index-six_002e_002b_002bx"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.%2B%2Bx">six.++x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.%2Bx"></a><a name="Special_form_six.%2Bx"></a><a name="index-six_002e_002bx"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.%2Bx">six.+x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.--x"></a><a name="Special_form_six.--x"></a><a name="index-six_002e_002d_002dx"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.--x">six.--x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.-x"></a><a name="Special_form_six.-x"></a><a name="index-six_002e_002dx"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.-x">six.-x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.arrow"></a><a name="Special_form_six.arrow"></a><a name="index-six_002earrow"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.arrow">six.arrow</a></b></code><i> <var>expr</var> <var>ident</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.break"></a><a name="Undefined_six.break"></a><a name="index-six_002ebreak"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.break">six.break</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.call"></a><a name="Special_form_six.call"></a><a name="index-six_002ecall"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.call">six.call</a></b></code><i> <var>func</var> <var>arg</var>…</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.case"></a><a name="Undefined_six.case"></a><a name="index-six_002ecase"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.case">six.case</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.clause"></a><a name="Undefined_six.clause"></a><a name="index-six_002eclause"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.clause">six.clause</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.compound"></a><a name="Special_form_six.compound"></a><a name="index-six_002ecompound"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.compound">six.compound</a></b></code><i> <var>statement</var>…</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.cons"></a><a name="Special_form_six.cons"></a><a name="index-six_002econs"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.cons">six.cons</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.continue"></a><a name="Undefined_six.continue"></a><a name="index-six_002econtinue"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.continue">six.continue</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.define-procedure"></a><a name="Special_form_six.define-procedure"></a><a name="index-six_002edefine_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.define-procedure">six.define-procedure</a></b></code><i> <var>ident</var> <var>proc</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.define-variable"></a><a name="Special_form_six.define-variable"></a><a name="index-six_002edefine_002dvariable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.define-variable">six.define-variable</a></b></code><i> <var>ident</var> <var>type</var> <var>dims</var> <var>init</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.do-while"></a><a name="Special_form_six.do-while"></a><a name="index-six_002edo_002dwhile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.do-while">six.do-while</a></b></code><i> <var>stat</var> <var>expr</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.dot"></a><a name="Special_form_six.dot"></a><a name="index-six_002edot"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.dot">six.dot</a></b></code><i> <var>expr</var> <var>ident</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.for"></a><a name="Special_form_six.for"></a><a name="index-six_002efor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.for">six.for</a></b></code><i> <var>stat1</var> <var>expr2</var> <var>expr3</var> <var>stat2</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.goto"></a><a name="Undefined_six.goto"></a><a name="index-six_002egoto"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.goto">six.goto</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.identifier"></a><a name="Special_form_six.identifier"></a><a name="index-six_002eidentifier"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.identifier">six.identifier</a></b></code><i> <var>ident</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.if"></a><a name="Special_form_six.if"></a><a name="index-six_002eif"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.if">six.if</a></b></code><i> <var>expr</var> <var>stat1</var> <span class="roman">[</span><var>stat2</var><span class="roman">]</span></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.index"></a><a name="Special_form_six.index"></a><a name="index-six_002eindex"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.index">six.index</a></b></code><i> <var>expr1</var> <var>expr2</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.label"></a><a name="Undefined_six.label"></a><a name="index-six_002elabel"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.label">six.label</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.list"></a><a name="Special_form_six.list"></a><a name="index-six_002elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.list">six.list</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.literal"></a><a name="Special_form_six.literal"></a><a name="index-six_002eliteral"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.literal">six.literal</a></b></code><i> <var>value</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.make-array"></a><a name="Procedure_six.make-array"></a><a name="index-six_002emake_002darray"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_six.make-array">six.make-array</a></b></code><i> <var>init</var> <var>dim</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_six.new"></a><a name="Special_form_six.new"></a><a name="index-six_002enew"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.new">six.new</a></b></code><i> <var>ident</var> <var>arg</var>…</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.null"></a><a name="Special_form_six.null"></a><a name="index-six_002enull"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.null">six.null</a></b></code><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.prefix"></a><a name="Special_form_six.prefix"></a><a name="index-six_002eprefix"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.prefix">six.prefix</a></b></code><i> <var>datum</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.procedure"></a><a name="Special_form_six.procedure"></a><a name="index-six_002eprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.procedure">six.procedure</a></b></code><i> <var>type</var> <var>params</var> <var>stat</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.procedure-body"></a><a name="Special_form_six.procedure-body"></a><a name="index-six_002eprocedure_002dbody"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.procedure-body">six.procedure-body</a></b></code><i> <var>stat</var>…</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.return"></a><a name="Undefined_six.return"></a><a name="index-six_002ereturn"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.return">six.return</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.switch"></a><a name="Undefined_six.switch"></a><a name="index-six_002eswitch"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.switch">six.switch</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.while"></a><a name="Special_form_six.while"></a><a name="index-six_002ewhile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.while">six.while</a></b></code><i> <var>expr</var> <var>stat</var>…</i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x!=y"></a><a name="Special_form_six.x!=y"></a><a name="index-six_002ex_0021_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x!=y">six.x!=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%25=y"></a><a name="Special_form_six.x%25=y"></a><a name="index-six_002ex_0025_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%25=y">six.x%=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%25y"></a><a name="Special_form_six.x%25y"></a><a name="index-six_002ex_0025y"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%25y">six.x%y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x&&y"></a><a name="Special_form_six.x&&y"></a><a name="index-six_002ex_0026_0026y"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x&&y">six.x&&y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x&=y"></a><a name="Special_form_six.x&=y"></a><a name="index-six_002ex_0026_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x&=y">six.x&=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x&y"></a><a name="Special_form_six.x&y"></a><a name="index-six_002ex_0026y"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x&y">six.x&y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%2A=y"></a><a name="Special_form_six.x%2A=y"></a><a name="index-six_002ex_002a_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%2A=y">six.x*=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%2Ay"></a><a name="Special_form_six.x%2Ay"></a><a name="index-six_002ex_002ay"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%2Ay">six.x*y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%2B%2B"></a><a name="Special_form_six.x%2B%2B"></a><a name="index-six_002ex_002b_002b"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%2B%2B">six.x++</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%2B=y"></a><a name="Special_form_six.x%2B=y"></a><a name="index-six_002ex_002b_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%2B=y">six.x+=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%2By"></a><a name="Special_form_six.x%2By"></a><a name="index-six_002ex_002by"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%2By">six.x+y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_|six.x"></a><a name="Special_form_|six.x"></a><a name="index-_007csix_002ex"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_|six.x">|six.x</a></b></code><i>,y| <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x--"></a><a name="Special_form_six.x--"></a><a name="index-six_002ex_002d_002d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x--">six.x--</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x-=y"></a><a name="Special_form_six.x-=y"></a><a name="index-six_002ex_002d_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x-=y">six.x-=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x-y"></a><a name="Special_form_six.x-y"></a><a name="index-six_002ex_002dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x-y">six.x-y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x/=y"></a><a name="Special_form_six.x/=y"></a><a name="index-six_002ex_002f_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x/=y">six.x/=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x/y"></a><a name="Special_form_six.x/y"></a><a name="index-six_002ex_002fy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x/y">six.x/y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x:-y"></a><a name="Undefined_six.x:-y"></a><a name="index-six_002ex_003a_002dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.x:-y">six.x:-y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">undefined</td></tr></table>
<a name="Definition_of_six.x:=y"></a><a name="Special_form_six.x:=y"></a><a name="index-six_002ex_003a_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x:=y">six.x:=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x:y"></a><a name="Special_form_six.x:y"></a><a name="index-six_002ex_003ay"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x:y">six.x:y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%3C%3C=y"></a><a name="Special_form_six.x%3C%3C=y"></a><a name="index-six_002ex_003c_003c_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3C%3C=y">six.x<<=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%3C%3Cy"></a><a name="Special_form_six.x%3C%3Cy"></a><a name="index-six_002ex_003c_003cy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3C%3Cy">six.x<<y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%3C=y"></a><a name="Special_form_six.x%3C=y"></a><a name="index-six_002ex_003c_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3C=y">six.x<=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%3Cy"></a><a name="Special_form_six.x%3Cy"></a><a name="index-six_002ex_003cy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3Cy">six.x<y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x==y"></a><a name="Special_form_six.x==y"></a><a name="index-six_002ex_003d_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x==y">six.x==y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x=y"></a><a name="Special_form_six.x=y"></a><a name="index-six_002ex_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x=y">six.x=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%3E=y"></a><a name="Special_form_six.x%3E=y"></a><a name="index-six_002ex_003e_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3E=y">six.x>=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%3E%3E=y"></a><a name="Special_form_six.x%3E%3E=y"></a><a name="index-six_002ex_003e_003e_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3E%3E=y">six.x>>=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%3E%3Ey"></a><a name="Special_form_six.x%3E%3Ey"></a><a name="index-six_002ex_003e_003ey"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3E%3Ey">six.x>>y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x%3Ey"></a><a name="Special_form_six.x%3Ey"></a><a name="index-six_002ex_003ey"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3Ey">six.x>y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x?y:z"></a><a name="Special_form_six.x?y:z"></a><a name="index-six_002ex_003fy_003az"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x?y:z">six.x?y:z</a></b></code><i> <var>x</var> <var>y</var> <var>z</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x^=y"></a><a name="Special_form_six.x^=y"></a><a name="index-six_002ex_005e_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x^=y">six.x^=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.x^y"></a><a name="Special_form_six.x^y"></a><a name="index-six_002ex_005ey"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x^y">six.x^y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_|six.x\|=y|"></a><a name="Special_form_|six.x\|=y|"></a><a name="index-_007csix_002ex_005c_007c_003dy_007c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_|six.x\|=y|">|six.x\|=y|</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_|six.x\|y|"></a><a name="Special_form_|six.x\|y|"></a><a name="index-_007csix_002ex_005c_007cy_007c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_|six.x\|y|">|six.x\|y|</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_|six.x\|\|y|"></a><a name="Special_form_|six.x\|\|y|"></a><a name="index-_007csix_002ex_005c_007c_005c_007cy_007c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_|six.x\|\|y|">|six.x\|\|y|</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<a name="Definition_of_six.~x"></a><a name="Special_form_six.~x"></a><a name="index-six_002e_007ex"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.~x">six.~x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
<hr size="6">
<a name="Namespaces"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Undocumented-extensions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Characters-and-strings" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Characters-and-strings" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Namespaces-1"></a>
<h1 class="chapter">7. Namespaces</h1>
<p>TO DO!
</p>
<hr size="6">
<a name="Characters-and-strings"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Namespaces" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Extensions-to-character-procedures" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Namespaces" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Characters-and-strings-1"></a>
<h1 class="chapter">8. Characters and strings</h1>
<p>Gambit supports the Unicode character encoding standard. Scheme
characters can be any of the characters whose Unicode encoding is in
the range 0 to #x10ffff (inclusive) but not in the range #xd800 to
#xdfff. Source code can also contain any Unicode character, however
to read such source code properly <code>gsi</code> and <code>gsc</code> must be
told which character encoding to use for reading the source code
(i.e. ASCII, ISO-8859-1, UTF-8, etc). This can be done by specifying
the runtime option ‘<samp>-:f</samp>’ when <code>gsi</code> and <code>gsc</code> are
started.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Extensions-to-character-procedures"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Characters-and-strings" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Extensions-to-string-procedures" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Characters-and-strings" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Characters-and-strings" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Extensions-to-character-procedures-1"></a>
<h2 class="section">8.1 Extensions to character procedures</h2>
<a name="Definition_of_char-%3Einteger"></a><a name="Procedure_char-%3Einteger"></a><a name="index-char_002d_003einteger"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-%3Einteger">char->integer</a></b></code><i> <var>char</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_integer-%3Echar"></a><a name="Procedure_integer-%3Echar"></a><a name="index-integer_002d_003echar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_integer-%3Echar">integer->char</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>char->integer</code> returns the Unicode encoding of
the character <var>char</var>.
</p>
<p>The procedure <code>integer->char</code> returns the character whose
Unicode encoding is the exact integer <var>n</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(char->integer #\!)</b>
33
> <b>(integer->char 65)</b>
#\A
> <b>(integer->char (char->integer #\u1234))</b>
#\u1234
> <b>(integer->char #xd800)</b>
*** ERROR IN (console)@4.1 -- (Argument 1) Out of range
(integer->char 55296)
</pre></td></tr></table>
<a name="Definition_of_char=?"></a><a name="Procedure_char=?"></a><a name="index-char_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char=?">char=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_char%3C?"></a><a name="Procedure_char%3C?"></a><a name="index-char_003c_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char%3C?">char<?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_char%3E?"></a><a name="Procedure_char%3E?"></a><a name="index-char_003e_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char%3E?">char>?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_char%3C=?"></a><a name="Procedure_char%3C=?"></a><a name="index-char_003c_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char%3C=?">char<=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_char%3E=?"></a><a name="Procedure_char%3E=?"></a><a name="index-char_003e_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char%3E=?">char>=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_char-ci=?"></a><a name="Procedure_char-ci=?"></a><a name="index-char_002dci_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci=?">char-ci=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_char-ci%3C?"></a><a name="Procedure_char-ci%3C?"></a><a name="index-char_002dci_003c_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci%3C?">char-ci<?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_char-ci%3E?"></a><a name="Procedure_char-ci%3E?"></a><a name="index-char_002dci_003e_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci%3E?">char-ci>?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_char-ci%3C=?"></a><a name="Procedure_char-ci%3C=?"></a><a name="index-char_002dci_003c_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci%3C=?">char-ci<=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_char-ci%3E=?"></a><a name="Procedure_char-ci%3E=?"></a><a name="index-char_002dci_003e_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci%3E=?">char-ci>=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures take any number of arguments including no argument.
This is useful to test if the elements of a list are sorted in a
particular order. For example, testing that the list of characters
<code>lst</code> is sorted in nondecreasing order can be done with the call
<code>(apply char<? lst)</code>.
</p>
<hr size="6">
<a name="Extensions-to-string-procedures"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Extensions-to-character-procedures" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Characters-and-strings" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Characters-and-strings" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Extensions-to-string-procedures-1"></a>
<h2 class="section">8.2 Extensions to string procedures</h2>
<a name="Definition_of_string=?"></a><a name="Procedure_string=?"></a><a name="index-string_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string=?">string=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string%3C?"></a><a name="Procedure_string%3C?"></a><a name="index-string_003c_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string%3C?">string<?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string%3E?"></a><a name="Procedure_string%3E?"></a><a name="index-string_003e_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string%3E?">string>?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string%3C=?"></a><a name="Procedure_string%3C=?"></a><a name="index-string_003c_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string%3C=?">string<=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string%3E=?"></a><a name="Procedure_string%3E=?"></a><a name="index-string_003e_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string%3E=?">string>=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string-ci=?"></a><a name="Procedure_string-ci=?"></a><a name="index-string_002dci_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci=?">string-ci=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string-ci%3C?"></a><a name="Procedure_string-ci%3C?"></a><a name="index-string_002dci_003c_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci%3C?">string-ci<?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string-ci%3E?"></a><a name="Procedure_string-ci%3E?"></a><a name="index-string_002dci_003e_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci%3E?">string-ci>?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string-ci%3C=?"></a><a name="Procedure_string-ci%3C=?"></a><a name="index-string_002dci_003c_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci%3C=?">string-ci<=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_string-ci%3E=?"></a><a name="Procedure_string-ci%3E=?"></a><a name="index-string_002dci_003e_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci%3E=?">string-ci>=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures take any number of arguments including no argument.
This is useful to test if the elements of a list are sorted in a
particular order. For example, testing that the list of strings
<code>lst</code> is sorted in nondecreasing order can be done with the call
<code>(apply string<? lst)</code>.
</p>
<hr size="6">
<a name="Numbers"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Extensions-to-string-procedures" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Extensions-to-numeric-procedures" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Characters-and-strings" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Numbers-1"></a>
<h1 class="chapter">9. Numbers</h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#IEEE-floating-point-arithmetic">9.2 IEEE floating point arithmetic</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Integer-square-root-and-nth-root">9.3 Integer square root and nth root</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td><td> </td><td align="left" valign="top"> Operations on fixnums
</td></tr>
<tr><td align="left" valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td><td> </td><td align="left" valign="top"> Operations on flonums
</td></tr>
<tr><td align="left" valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Extensions-to-numeric-procedures"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Numbers" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#IEEE-floating-point-arithmetic" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Numbers" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Extensions-to-numeric-procedures-1"></a>
<h2 class="section">9.1 Extensions to numeric procedures</h2>
<a name="Definition_of_="></a><a name="Procedure_="></a><a name="index-_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_=">=</a></b></code><i> <var>z1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_%3C"></a><a name="Procedure_%3C"></a><a name="index-_003c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_%3C"><</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_%3E"></a><a name="Procedure_%3E"></a><a name="index-_003e"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_%3E">></a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_%3C="></a><a name="Procedure_%3C="></a><a name="index-_003c_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_%3C="><=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_%3E="></a><a name="Procedure_%3E="></a><a name="index-_003e_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_%3E=">>=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures take any number of arguments including no argument.
This is useful to test if the elements of a list are sorted in a
particular order. For example, testing that the list of numbers
<code>lst</code> is sorted in nondecreasing order can be done with the call
<code>(apply < lst)</code>.
</p>
<hr size="6">
<a name="IEEE-floating-point-arithmetic"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Extensions-to-numeric-procedures" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Integer-square-root-and-nth-root" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Numbers" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="IEEE-floating-point-arithmetic-1"></a>
<h2 class="section">9.2 IEEE floating point arithmetic</h2>
<p>To better conform to IEEE floating point arithmetic the standard
numeric tower is extended with these special inexact reals:
</p>
<dl compact="compact">
<dt> <code>+inf.0</code></dt>
<dd><p>positive infinity
</p></dd>
<dt> <code>-inf.0</code></dt>
<dd><p>negative infinity
</p></dd>
<dt> <code>+nan.0</code></dt>
<dd><p>“not a number”
</p></dd>
<dt> <code>-0.</code></dt>
<dd><p>negative zero (‘<samp>0.</samp>’ is the positive zero)
</p></dd>
</dl>
<p>The infinities and “not a number” are reals (i.e. <code>(real?
+inf.0)</code> is <code>#t</code>) but are not rational (i.e. <code>(rational?
+inf.0)</code> is <code>#f</code>).
</p>
<p>Both zeros are numerically equal (i.e. <code>(= -0. 0.)</code> is <code>#t</code>)
but are not equivalent (i.e. <code>(eqv? -0. 0.)</code> and <code>(equal?
-0. 0.)</code> are <code>#f</code>). All numerical comparisons with “not a
number”, including <code>(= +nan.0 +nan.0)</code>, are <code>#f</code>.
</p>
<hr size="6">
<a name="Integer-square-root-and-nth-root"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#IEEE-floating-point-arithmetic" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Bitwise_002doperations-on-exact-integers" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Numbers" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Integer-square-root-and-nth-root-1"></a>
<h2 class="section">9.3 Integer square root and nth root</h2>
<a name="Definition_of_integer-sqrt"></a><a name="Procedure_integer-sqrt"></a><a name="index-integer_002dsqrt"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_integer-sqrt">integer-sqrt</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the integer part of the square root of the
nonnegative exact integer <var>n</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(integer-sqrt 123)</b>
11
</pre></td></tr></table>
<a name="Definition_of_integer-nth-root"></a><a name="Procedure_integer-nth-root"></a><a name="index-integer_002dnth_002droot"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_integer-nth-root">integer-nth-root</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the integer part of <var>n1</var> raised to the
power 1/<var>n2</var>, where <var>n1</var> is a nonnegative exact integer and
<var>n2</var> is a positive exact integer.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(integer-nth-root 100 3)</b>
4
</pre></td></tr></table>
<hr size="6">
<a name="Bitwise_002doperations-on-exact-integers"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Integer-square-root-and-nth-root" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Fixnum-specific-operations" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Numbers" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Bitwise_002doperations-on-exact-integers-1"></a>
<h2 class="section">9.4 Bitwise-operations on exact integers</h2>
<p>The procedures defined in this section are compatible with the
withdrawn “Integer Bitwise-operation Library SRFI” (SRFI 33). Note
that some of the procedures specified in SRFI 33 are not provided.
</p>
<p>Most procedures in this section are specified in terms of the binary
representation of exact integers. The two’s complement representation
is assumed where an integer is composed of an infinite number of bits.
The upper section of an integer (the most significant bits) are either
an infinite sequence of ones when the integer is negative, or they are
an infinite sequence of zeros when the integer is nonnegative.
</p>
<a name="Definition_of_arithmetic-shift"></a><a name="Procedure_arithmetic-shift"></a><a name="index-arithmetic_002dshift"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_arithmetic-shift">arithmetic-shift</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <var>n1</var> shifted to the left by <var>n2</var> bits,
that is <code>(floor (* <var>n1</var> (expt 2 <var>n2</var>)))</code>. Both <var>n1</var>
and <var>n2</var> must be exact integers.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(arithmetic-shift 1000 7) <span class="roman"><i>; n1=...0000001111101000</i></span></b>
128000
> <b>(arithmetic-shift 1000 -6) <span class="roman"><i>; n1=...0000001111101000</i></span></b>
15
> <b>(arithmetic-shift -23 -3) <span class="roman"><i>; n1=...1111111111101001</i></span></b>
-3
</pre></td></tr></table>
<a name="Definition_of_bitwise-merge"></a><a name="Procedure_bitwise-merge"></a><a name="index-bitwise_002dmerge"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bitwise-merge">bitwise-merge</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns an exact integer whose bits combine the bits
from <var>n2</var> and <var>n3</var> depending on <var>n1</var>. The bit at index
<var>i</var> of the result depends only on the bits at index <var>i</var> in
<var>n1</var>, <var>n2</var> and <var>n3</var>: it is equal to the bit in <var>n2</var>
when the bit in <var>n1</var> is 0 and it is equal to the bit in <var>n3</var>
when the bit in <var>n1</var> is 1. All arguments must be exact integers.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-merge -4 -11 10) <span class="roman"><i>; ...11111100 ...11110101 ...00001010</i></span></b>
9
> <b>(bitwise-merge 12 -11 10) <span class="roman"><i>; ...00001100 ...11110101 ...00001010</i></span></b>
-7
</pre></td></tr></table>
<a name="Definition_of_bitwise-and"></a><a name="Procedure_bitwise-and"></a><a name="index-bitwise_002dand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bitwise-and">bitwise-and</a></b></code><i> <var>n</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the bitwise “and” of the exact integers
<var>n</var>…. The value -1 is returned when there are no arguments.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-and 6 12) <span class="roman"><i>; ...00000110 ...00001100</i></span></b>
4
> <b>(bitwise-and 6 -4) <span class="roman"><i>; ...00000110 ...11111100</i></span></b>
4
> <b>(bitwise-and -6 -4) <span class="roman"><i>; ...11111010 ...11111100</i></span></b>
-8
> <b>(bitwise-and)</b>
-1
</pre></td></tr></table>
<a name="Definition_of_bitwise-ior"></a><a name="Procedure_bitwise-ior"></a><a name="index-bitwise_002dior"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bitwise-ior">bitwise-ior</a></b></code><i> <var>n</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the bitwise “inclusive-or” of the exact
integers <var>n</var>…. The value 0 is returned when there are no
arguments.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-ior 6 12) <span class="roman"><i>; ...00000110 ...00001100</i></span></b>
14
> <b>(bitwise-ior 6 -4) <span class="roman"><i>; ...00000110 ...11111100</i></span></b>
-2
> <b>(bitwise-ior -6 -4) <span class="roman"><i>; ...11111010 ...11111100</i></span></b>
-2
> <b>(bitwise-ior)</b>
0
</pre></td></tr></table>
<a name="Definition_of_bitwise-xor"></a><a name="Procedure_bitwise-xor"></a><a name="index-bitwise_002dxor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bitwise-xor">bitwise-xor</a></b></code><i> <var>n</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the bitwise “exclusive-or” of the exact
integers <var>n</var>…. The value 0 is returned when there are no
arguments.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-xor 6 12) <span class="roman"><i>; ...00000110 ...00001100</i></span></b>
10
> <b>(bitwise-xor 6 -4) <span class="roman"><i>; ...00000110 ...11111100</i></span></b>
-6
> <b>(bitwise-xor -6 -4) <span class="roman"><i>; ...11111010 ...11111100</i></span></b>
6
> <b>(bitwise-xor)</b>
0
</pre></td></tr></table>
<a name="Definition_of_bitwise-not"></a><a name="Procedure_bitwise-not"></a><a name="index-bitwise_002dnot"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bitwise-not">bitwise-not</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the bitwise complement of the exact integer
<var>n</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-not 3) <span class="roman"><i>; ...00000011</i></span></b>
-4
> <b>(bitwise-not -1) <span class="roman"><i>; ...11111111</i></span></b>
0
</pre></td></tr></table>
<a name="Definition_of_bit-count"></a><a name="Procedure_bit-count"></a><a name="index-bit_002dcount"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bit-count">bit-count</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the bit count of the exact integer <var>n</var>. If
<var>n</var> is nonnegative, the bit count is the number of 1 bits in the
two’s complement representation of <var>n</var>. If <var>n</var> is negative,
the bit count is the number of 0 bits in the two’s complement
representation of <var>n</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(bit-count 0) <span class="roman"><i>; ...00000000</i></span></b>
0
> <b>(bit-count 1) <span class="roman"><i>; ...00000001</i></span></b>
1
> <b>(bit-count 2) <span class="roman"><i>; ...00000010</i></span></b>
1
> <b>(bit-count 3) <span class="roman"><i>; ...00000011</i></span></b>
2
> <b>(bit-count 4) <span class="roman"><i>; ...00000100</i></span></b>
1
> <b>(bit-count -23) <span class="roman"><i>; ...11101001</i></span></b>
3
</pre></td></tr></table>
<a name="Definition_of_integer-length"></a><a name="Procedure_integer-length"></a><a name="index-integer_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_integer-length">integer-length</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the bit length of the exact integer <var>n</var>.
If <var>n</var> is a positive integer the bit length is one more than the
index of the highest 1 bit (the least significant bit is at index 0).
If <var>n</var> is a negative integer the bit length is one more than the
index of the highest 0 bit. If <var>n</var> is zero, the bit length is 0.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(integer-length 0) <span class="roman"><i>; ...00000000</i></span></b>
0
> <b>(integer-length 1) <span class="roman"><i>; ...00000001</i></span></b>
1
> <b>(integer-length 2) <span class="roman"><i>; ...00000010</i></span></b>
2
> <b>(integer-length 3) <span class="roman"><i>; ...00000011</i></span></b>
2
> <b>(integer-length 4) <span class="roman"><i>; ...00000100</i></span></b>
3
> <b>(integer-length -23) <span class="roman"><i>; ...11101001</i></span></b>
5
</pre></td></tr></table>
<a name="Definition_of_bit-set?"></a><a name="Procedure_bit-set?"></a><a name="index-bit_002dset_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bit-set?">bit-set?</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a boolean indicating if the bit at index
<var>n1</var> of <var>n2</var> is set (i.e. equal to 1) or not. Both <var>n1</var>
and <var>n2</var> must be exact integers, and <var>n1</var> must be
nonnegative.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(map (lambda (i) (bit-set? i -23)) <span class="roman"><i>; ...11101001</i></span>
'(7 6 5 4 3 2 1 0))</b>
(#t #t #t #f #t #f #f #t)
</pre></td></tr></table>
<a name="Definition_of_any-bits-set?"></a><a name="Procedure_any-bits-set?"></a><a name="index-any_002dbits_002dset_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_any-bits-set?">any-bits-set?</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a boolean indicating if the bitwise and
of <var>n1</var> and <var>n2</var> is different from zero or not. This procedure
is implemented more efficiently than the naive definition:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (any-bits-set? n1 n2) (not (zero? (bitwise-and n1 n2))))
</pre></td></tr></table>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(any-bits-set? 5 10) <span class="roman"><i>; ...00000101 ...00001010</i></span></b>
#f
> <b>(any-bits-set? -23 32) <span class="roman"><i>; ...11101001 ...00100000</i></span></b>
#t
</pre></td></tr></table>
<a name="Definition_of_all-bits-set?"></a><a name="Procedure_all-bits-set?"></a><a name="index-all_002dbits_002dset_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_all-bits-set?">all-bits-set?</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a boolean indicating if the bitwise and
of <var>n1</var> and <var>n2</var> is equal to <var>n1</var> or not. This procedure
is implemented more efficiently than the naive definition:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (all-bits-set? n1 n2) (= n1 (bitwise-and n1 n2)))
</pre></td></tr></table>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(all-bits-set? 1 3) <span class="roman"><i>; ...00000001 ...00000011</i></span></b>
#t
> <b>(all-bits-set? 7 3) <span class="roman"><i>; ...00000111 ...00000011</i></span></b>
#f
</pre></td></tr></table>
<a name="Definition_of_first-bit-set"></a><a name="Procedure_first-bit-set"></a><a name="index-first_002dbit_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_first-bit-set">first-bit-set</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the bit index of the least significant bit of
<var>n</var> equal to 1 (which is also the number of 0 bits that are below
the least significant 1 bit). This procedure returns <code>-1</code> when
<var>n</var> is zero.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(first-bit-set 24) <span class="roman"><i>; ...00011000</i></span></b>
3
> <b>(first-bit-set 0) <span class="roman"><i>; ...00000000</i></span></b>
-1
</pre></td></tr></table>
<a name="Definition_of_extract-bit-field"></a><a name="Procedure_extract-bit-field"></a><a name="index-extract_002dbit_002dfield"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_extract-bit-field">extract-bit-field</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_test-bit-field?"></a><a name="Procedure_test-bit-field?"></a><a name="index-test_002dbit_002dfield_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_test-bit-field?">test-bit-field?</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_clear-bit-field"></a><a name="Procedure_clear-bit-field"></a><a name="index-clear_002dbit_002dfield"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_clear-bit-field">clear-bit-field</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_replace-bit-field"></a><a name="Procedure_replace-bit-field"></a><a name="index-replace_002dbit_002dfield"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_replace-bit-field">replace-bit-field</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var> <var>n4</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_copy-bit-field"></a><a name="Procedure_copy-bit-field"></a><a name="index-copy_002dbit_002dfield"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_copy-bit-field">copy-bit-field</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var> <var>n4</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures operate on a bit-field which is <var>n1</var> bits wide
starting at bit index <var>n2</var>. All arguments must be exact integers
and <var>n1</var> and <var>n2</var> must be nonnegative.
</p>
<p>The procedure <code>extract-bit-field</code> returns the bit-field of
<var>n3</var> shifted to the right so that the least significant bit of the
bit-field is the least significant bit of the result.
</p>
<p>The procedure <code>test-bit-field?</code> returns <code>#t</code> if any bit in
the bit-field of <var>n3</var> is equal to 1, otherwise <code>#f</code> is
returned.
</p>
<p>The procedure <code>clear-bit-field</code> returns <var>n3</var> with all bits
in the bit-field replaced with 0.
</p>
<p>The procedure <code>replace-bit-field</code> returns <var>n4</var> with the
bit-field replaced with the least-significant <var>n1</var> bits of
<var>n3</var>.
</p>
<p>The procedure <code>copy-bit-field</code> returns <var>n4</var> with the
bit-field replaced with the (same index and size) bit-field in
<var>n3</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(extract-bit-field 5 2 -37) <span class="roman"><i>; ...11011011</i></span></b>
22
> <b>(test-bit-field? 5 2 -37) <span class="roman"><i>; ...11011011</i></span></b>
#t
> <b>(test-bit-field? 1 2 -37) <span class="roman"><i>; ...11011011</i></span></b>
#f
> <b>(clear-bit-field 5 2 -37) <span class="roman"><i>; ...11011011</i></span></b>
-125
> <b>(replace-bit-field 5 2 -6 -37) <span class="roman"><i>; ...11111010 ...11011011</i></span></b>
-21
> <b>(copy-bit-field 5 2 -6 -37) <span class="roman"><i>; ...11111010 ...11011011</i></span></b>
-5
</pre></td></tr></table>
<hr size="6">
<a name="Fixnum-specific-operations"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Bitwise_002doperations-on-exact-integers" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Flonum-specific-operations" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Numbers" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Fixnum-specific-operations-1"></a>
<h2 class="section">9.5 Fixnum specific operations</h2>
<a name="Definition_of_fixnum?"></a><a name="Procedure_fixnum?"></a><a name="index-fixnum_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fixnum?">fixnum?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fx%2A"></a><a name="Procedure_fx%2A"></a><a name="index-fx_002a"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%2A">fx*</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fx%2B"></a><a name="Procedure_fx%2B"></a><a name="index-fx_002b"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%2B">fx+</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fx-"></a><a name="Procedure_fx-"></a><a name="index-fx_002d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx-">fx-</a></b></code><i> <var>n1</var> <var>n2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fx%3C"></a><a name="Procedure_fx%3C"></a><a name="index-fx_003c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%3C">fx<</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fx%3C="></a><a name="Procedure_fx%3C="></a><a name="index-fx_003c_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%3C=">fx<=</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fx="></a><a name="Procedure_fx="></a><a name="index-fx_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx=">fx=</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fx%3E"></a><a name="Procedure_fx%3E"></a><a name="index-fx_003e"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%3E">fx></a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fx%3E="></a><a name="Procedure_fx%3E="></a><a name="index-fx_003e_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%3E=">fx>=</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxabs"></a><a name="Procedure_fxabs"></a><a name="index-fxabs"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxabs">fxabs</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxand"></a><a name="Procedure_fxand"></a><a name="index-fxand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxand">fxand</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxarithmetic-shift"></a><a name="Procedure_fxarithmetic-shift"></a><a name="index-fxarithmetic_002dshift"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxarithmetic-shift">fxarithmetic-shift</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxarithmetic-shift-left"></a><a name="Procedure_fxarithmetic-shift-left"></a><a name="index-fxarithmetic_002dshift_002dleft"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxarithmetic-shift-left">fxarithmetic-shift-left</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxarithmetic-shift-right"></a><a name="Procedure_fxarithmetic-shift-right"></a><a name="index-fxarithmetic_002dshift_002dright"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxarithmetic-shift-right">fxarithmetic-shift-right</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxbit-count"></a><a name="Procedure_fxbit-count"></a><a name="index-fxbit_002dcount"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxbit-count">fxbit-count</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxbit-set?"></a><a name="Procedure_fxbit-set?"></a><a name="index-fxbit_002dset_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxbit-set?">fxbit-set?</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxeven?"></a><a name="Procedure_fxeven?"></a><a name="index-fxeven_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxeven?">fxeven?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxfirst-bit-set"></a><a name="Procedure_fxfirst-bit-set"></a><a name="index-fxfirst_002dbit_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxfirst-bit-set">fxfirst-bit-set</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxif"></a><a name="Procedure_fxif"></a><a name="index-fxif"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxif">fxif</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxior"></a><a name="Procedure_fxior"></a><a name="index-fxior"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxior">fxior</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxlength"></a><a name="Procedure_fxlength"></a><a name="index-fxlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxlength">fxlength</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxmax"></a><a name="Procedure_fxmax"></a><a name="index-fxmax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxmax">fxmax</a></b></code><i> <var>n1</var> <var>n2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxmin"></a><a name="Procedure_fxmin"></a><a name="index-fxmin"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxmin">fxmin</a></b></code><i> <var>n1</var> <var>n2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxmodulo"></a><a name="Procedure_fxmodulo"></a><a name="index-fxmodulo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxmodulo">fxmodulo</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxnegative?"></a><a name="Procedure_fxnegative?"></a><a name="index-fxnegative_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxnegative?">fxnegative?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxnot"></a><a name="Procedure_fxnot"></a><a name="index-fxnot"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxnot">fxnot</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxodd?"></a><a name="Procedure_fxodd?"></a><a name="index-fxodd_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxodd?">fxodd?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxpositive?"></a><a name="Procedure_fxpositive?"></a><a name="index-fxpositive_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxpositive?">fxpositive?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxquotient"></a><a name="Procedure_fxquotient"></a><a name="index-fxquotient"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxquotient">fxquotient</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxremainder"></a><a name="Procedure_fxremainder"></a><a name="index-fxremainder"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxremainder">fxremainder</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxwrap%2A"></a><a name="Procedure_fxwrap%2A"></a><a name="index-fxwrap_002a"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwrap%2A">fxwrap*</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxwrap%2B"></a><a name="Procedure_fxwrap%2B"></a><a name="index-fxwrap_002b"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwrap%2B">fxwrap+</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxwrap-"></a><a name="Procedure_fxwrap-"></a><a name="index-fxwrap_002d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwrap-">fxwrap-</a></b></code><i> <var>n1</var> <var>n2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxwrapabs"></a><a name="Procedure_fxwrapabs"></a><a name="index-fxwrapabs"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwrapabs">fxwrapabs</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxwraparithmetic-shift"></a><a name="Procedure_fxwraparithmetic-shift"></a><a name="index-fxwraparithmetic_002dshift"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwraparithmetic-shift">fxwraparithmetic-shift</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxwraparithmetic-shift-left"></a><a name="Procedure_fxwraparithmetic-shift-left"></a><a name="index-fxwraparithmetic_002dshift_002dleft"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwraparithmetic-shift-left">fxwraparithmetic-shift-left</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxwraplogical-shift-right"></a><a name="Procedure_fxwraplogical-shift-right"></a><a name="index-fxwraplogical_002dshift_002dright"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwraplogical-shift-right">fxwraplogical-shift-right</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxwrapquotient"></a><a name="Procedure_fxwrapquotient"></a><a name="index-fxwrapquotient"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwrapquotient">fxwrapquotient</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxxor"></a><a name="Procedure_fxxor"></a><a name="index-fxxor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxxor">fxxor</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fxzero?"></a><a name="Procedure_fxzero?"></a><a name="index-fxzero_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxzero?">fxzero?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fixnum-overflow-exception?"></a><a name="Procedure_fixnum-overflow-exception?"></a><a name="index-fixnum_002doverflow_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fixnum-overflow-exception?">fixnum-overflow-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fixnum-overflow-exception-procedure"></a><a name="Procedure_fixnum-overflow-exception-procedure"></a><a name="index-fixnum_002doverflow_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fixnum-overflow-exception-procedure">fixnum-overflow-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fixnum-overflow-exception-arguments"></a><a name="Procedure_fixnum-overflow-exception-arguments"></a><a name="index-fixnum_002doverflow_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fixnum-overflow-exception-arguments">fixnum-overflow-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Fixnum-overflow-exception objects are raised by some of the fixnum
specific procedures when the result is larger than can fit in a
fixnum. The parameter <var>exc</var> must be a fixnum-overflow-exception
object.
</p>
<p>The procedure <code>fixnum-overflow-exception?</code> returns
<code>#t</code> when <var>obj</var> is a fixnum-overflow-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>fixnum-overflow-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>fixnum-overflow-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (fixnum-overflow-exception? exc)
(list (fixnum-overflow-exception-procedure exc)
(fixnum-overflow-exception-arguments exc))
'not-fixnum-overflow-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (fx* 100000 100000)))</b>
(#<procedure #2 fx*> (100000 100000))
</pre></td></tr></table>
<hr size="6">
<a name="Flonum-specific-operations"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Fixnum-specific-operations" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Pseudo-random-numbers" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Numbers" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Flonum-specific-operations-1"></a>
<h2 class="section">9.6 Flonum specific operations</h2>
<a name="Definition_of_flonum?"></a><a name="Procedure_flonum?"></a><a name="index-flonum_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flonum?">flonum?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fixnum-%3Eflonum"></a><a name="Procedure_fixnum-%3Eflonum"></a><a name="index-fixnum_002d_003eflonum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fixnum-%3Eflonum">fixnum->flonum</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fl%2A"></a><a name="Procedure_fl%2A"></a><a name="index-fl_002a"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%2A">fl*</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fl%2B"></a><a name="Procedure_fl%2B"></a><a name="index-fl_002b"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%2B">fl+</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fl-"></a><a name="Procedure_fl-"></a><a name="index-fl_002d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl-">fl-</a></b></code><i> <var>x1</var> <var>x2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fl/"></a><a name="Procedure_fl/"></a><a name="index-fl_002f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl/">fl/</a></b></code><i> <var>x1</var> <var>x2</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fl%3C"></a><a name="Procedure_fl%3C"></a><a name="index-fl_003c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%3C">fl<</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fl%3C="></a><a name="Procedure_fl%3C="></a><a name="index-fl_003c_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%3C=">fl<=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fl="></a><a name="Procedure_fl="></a><a name="index-fl_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl=">fl=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fl%3E"></a><a name="Procedure_fl%3E"></a><a name="index-fl_003e"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%3E">fl></a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fl%3E="></a><a name="Procedure_fl%3E="></a><a name="index-fl_003e_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%3E=">fl>=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flabs"></a><a name="Procedure_flabs"></a><a name="index-flabs"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flabs">flabs</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flacos"></a><a name="Procedure_flacos"></a><a name="index-flacos"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flacos">flacos</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flasin"></a><a name="Procedure_flasin"></a><a name="index-flasin"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flasin">flasin</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flatan"></a><a name="Procedure_flatan"></a><a name="index-flatan"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flatan">flatan</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flatan"></a><a name="Procedure_flatan"></a><a name="index-flatan-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flatan">flatan</a></b></code><i> <var>y</var> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flceiling"></a><a name="Procedure_flceiling"></a><a name="index-flceiling"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flceiling">flceiling</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flcos"></a><a name="Procedure_flcos"></a><a name="index-flcos"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flcos">flcos</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fldenominator"></a><a name="Procedure_fldenominator"></a><a name="index-fldenominator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fldenominator">fldenominator</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fleven?"></a><a name="Procedure_fleven?"></a><a name="index-fleven_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fleven?">fleven?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flexp"></a><a name="Procedure_flexp"></a><a name="index-flexp"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flexp">flexp</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flexpt"></a><a name="Procedure_flexpt"></a><a name="index-flexpt"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flexpt">flexpt</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flfinite?"></a><a name="Procedure_flfinite?"></a><a name="index-flfinite_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flfinite?">flfinite?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flfloor"></a><a name="Procedure_flfloor"></a><a name="index-flfloor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flfloor">flfloor</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flinfinite?"></a><a name="Procedure_flinfinite?"></a><a name="index-flinfinite_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flinfinite?">flinfinite?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flinteger?"></a><a name="Procedure_flinteger?"></a><a name="index-flinteger_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flinteger?">flinteger?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fllog"></a><a name="Procedure_fllog"></a><a name="index-fllog"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fllog">fllog</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flmax"></a><a name="Procedure_flmax"></a><a name="index-flmax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flmax">flmax</a></b></code><i> <var>x1</var> <var>x2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flmin"></a><a name="Procedure_flmin"></a><a name="index-flmin"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flmin">flmin</a></b></code><i> <var>x1</var> <var>x2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flnan?"></a><a name="Procedure_flnan?"></a><a name="index-flnan_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flnan?">flnan?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flnegative?"></a><a name="Procedure_flnegative?"></a><a name="index-flnegative_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flnegative?">flnegative?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flnumerator"></a><a name="Procedure_flnumerator"></a><a name="index-flnumerator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flnumerator">flnumerator</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flodd?"></a><a name="Procedure_flodd?"></a><a name="index-flodd_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flodd?">flodd?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flpositive?"></a><a name="Procedure_flpositive?"></a><a name="index-flpositive_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flpositive?">flpositive?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flround"></a><a name="Procedure_flround"></a><a name="index-flround"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flround">flround</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flsin"></a><a name="Procedure_flsin"></a><a name="index-flsin"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flsin">flsin</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flsqrt"></a><a name="Procedure_flsqrt"></a><a name="index-flsqrt"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flsqrt">flsqrt</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fltan"></a><a name="Procedure_fltan"></a><a name="index-fltan"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fltan">fltan</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_fltruncate"></a><a name="Procedure_fltruncate"></a><a name="index-fltruncate"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fltruncate">fltruncate</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_flzero?"></a><a name="Procedure_flzero?"></a><a name="index-flzero_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flzero?">flzero?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<hr size="6">
<a name="Pseudo-random-numbers"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Flonum-specific-operations" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Numbers" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Numbers" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Pseudo-random-numbers-1"></a>
<h2 class="section">9.7 Pseudo random numbers</h2>
<p>The procedures and variables defined in this section are compatible
with the “Sources of Random Bits SRFI” (SRFI 27). The
implementation is based on Pierre L’Ecuyer’s MRG32k3a pseudo random
number generator. At the heart of SRFI 27’s interface is the random
source type which encapsulates the state of a pseudo random number
generator. The state of a random source object changes every time a
pseudo random number is generated from this random source object.
</p>
<a name="Definition_of_default-random-source"></a><a name="Variable_default-random-source"></a><a name="index-default_002drandom_002dsource"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Variable_default-random-source">default-random-source</a></b></code><code>)</code></td><td align="right">variable</td></tr></table>
<p>The global variable <code>default-random-source</code> is bound to the
random source object which is used by the <code>random-integer</code>,
<code>random-real</code>, <code>random-u8vector</code> and <code>random-f64vector</code>
procedures.
</p>
<a name="Definition_of_random-integer"></a><a name="Procedure_random-integer"></a><a name="index-random_002dinteger"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-integer">random-integer</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a pseudo random exact integer in the range 0 to
<var>n</var>-1. The random source object in the global variable
<code>default-random-source</code> is used to generate this number. The
parameter <var>n</var> must be a positive exact integer.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-integer 100)</b>
24
> <b>(random-integer 100)</b>
2
> <b>(random-integer 10000000000000000000000000000000000000000)</b>
6143360270902284438072426748425263488507
</pre></td></tr></table>
<a name="Definition_of_random-real"></a><a name="Procedure_random-real"></a><a name="index-random_002dreal"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-real">random-real</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a pseudo random inexact real between, but not
including, 0 and 1. The random source object in the global variable
<code>default-random-source</code> is used to generate this number.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-real)</b>
.24230672079133753
> <b>(random-real)</b>
.02317001922506932
</pre></td></tr></table>
<a name="Definition_of_random-u8vector"></a><a name="Procedure_random-u8vector"></a><a name="index-random_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-u8vector">random-u8vector</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a u8vector of length <var>n</var> containing pseudo
random exact integers in the range 0 to 255. The random source object
in the global variable <code>default-random-source</code> is used to
generate these numbers. The parameter <var>n</var> must be a nonnegative
exact integer.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-u8vector 10)</b>
#u8(200 53 29 202 3 85 208 187 73 219)
</pre></td></tr></table>
<a name="Definition_of_random-f64vector"></a><a name="Procedure_random-f64vector"></a><a name="index-random_002df64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-f64vector">random-f64vector</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a f64vector of length <var>n</var> containing pseudo
random inexact reals between, but not including, 0 and 1. The random
source object in the global variable <code>default-random-source</code> is
used to generate these numbers. The parameter <var>n</var> must be a nonnegative
exact integer.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-f64vector 3)</b>
#f64(.7145854494613069 .47089632669147946 .5400124875182746)
</pre></td></tr></table>
<a name="Definition_of_make-random-source"></a><a name="Procedure_make-random-source"></a><a name="index-make_002drandom_002dsource"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-random-source">make-random-source</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a new random source object initialized to a
predetermined state (to initialize to a pseudo random state the
procedure <code>random-source-randomize!</code> should be called).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b>
> <b>((random-source-make-integers rs) 10000000)</b>
8583952
</pre></td></tr></table>
<a name="Definition_of_random-source?"></a><a name="Procedure_random-source?"></a><a name="index-random_002dsource_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-source?">random-source?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a random source
object and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-source? default-random-source)</b>
#t
> <b>(random-source? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_random-source-state-ref"></a><a name="Procedure_random-source-state-ref"></a><a name="index-random_002dsource_002dstate_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-source-state-ref">random-source-state-ref</a></b></code><i> <var>random-source</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_random-source-state-set!"></a><a name="Procedure_random-source-state-set!"></a><a name="index-random_002dsource_002dstate_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-source-state-set!">random-source-state-set!</a></b></code><i> <var>random-source</var> <var>state</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>random-source-state-ref</code> extracts the state of
the random source object <var>random-source</var> and returns a vector
containing the state.
</p>
<p>The procedure <code>random-source-state-set!</code> restores the state of
the random source object <var>random-source</var> to <var>state</var> which must
be a vector returned from a call to the procedure
<code>random-source-state-ref</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (random-source-state-ref default-random-source))</b>
> <b>(random-integer 10000000000000000000000000000000000000000)</b>
7583880188903074396261960585615270693321
> <b>(random-source-state-set! default-random-source s)</b>
> <b>(random-integer 10000000000000000000000000000000000000000)</b>
7583880188903074396261960585615270693321
</pre></td></tr></table>
<a name="Definition_of_random-source-randomize!"></a><a name="Procedure_random-source-randomize!"></a><a name="index-random_002dsource_002drandomize_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-source-randomize!">random-source-randomize!</a></b></code><i> <var>random-source</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_random-source-pseudo-randomize!"></a><a name="Procedure_random-source-pseudo-randomize!"></a><a name="index-random_002dsource_002dpseudo_002drandomize_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-source-pseudo-randomize!">random-source-pseudo-randomize!</a></b></code><i> <var>random-source</var> <var>i</var> <var>j</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures change the state of the random source object
<var>random-source</var>. The procedure <code>random-source-randomize!</code>
sets the random source object to a state that depends on the current
time (which for typical uses can be considered to randomly initialize
the state). The procedure <code>random-source-pseudo-randomize!</code>
sets the random source object to a state that is determined only by
the current state and the nonnegative exact integers <var>i</var> and
<var>j</var>. For both procedures the value returned is unspecified.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (random-source-state-ref default-random-source))</b>
> <b>(random-source-pseudo-randomize! default-random-source 5 99)</b>
> <b>(random-integer 10000000000000000000000000000000000000000)</b>
9816755163910623041601722050112674079767
> <b>(random-source-state-set! default-random-source s)</b>
> <b>(random-source-pseudo-randomize! default-random-source 5 99)</b>
> <b>(random-integer 10000000000000000000000000000000000000000)</b>
9816755163910623041601722050112674079767
> <b>(random-source-pseudo-randomize! default-random-source 5 99)</b>
> <b>(random-integer 10000000000000000000000000000000000000000)</b>
9816755163910623041601722050112674079767
> <b>(random-source-state-set! default-random-source s)</b>
> <b>(random-source-randomize! default-random-source)</b>
> <b>(random-integer 10000000000000000000000000000000000000000)</b>
2271441220851914333384493143687768110622
> <b>(random-source-state-set! default-random-source s)</b>
> <b>(random-source-randomize! default-random-source)</b>
> <b>(random-integer 10000000000000000000000000000000000000000)</b>
6247966138948323029033944059178072366895
</pre></td></tr></table>
<a name="Definition_of_random-source-make-integers"></a><a name="Procedure_random-source-make-integers"></a><a name="index-random_002dsource_002dmake_002dintegers"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-source-make-integers">random-source-make-integers</a></b></code><i> <var>random-source</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a procedure for generating pseudo random exact
integers using the random source object <var>random-source</var>. The
returned procedure accepts a single parameter <var>n</var>, a positive
exact integer, and returns a pseudo random exact integer in the range
0 to <var>n</var>-1.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b>
> <b>(define ri (random-source-make-integers rs))</b>
> <b>(ri 10000000)</b>
8583952
> <b>(ri 10000000)</b>
2879793
</pre></td></tr></table>
<a name="Definition_of_random-source-make-reals"></a><a name="Procedure_random-source-make-reals"></a><a name="index-random_002dsource_002dmake_002dreals"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-source-make-reals">random-source-make-reals</a></b></code><i> <var>random-source</var> <span class="roman">[</span><var>precision</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a procedure for generating pseudo random
inexact reals using the random source object <var>random-source</var>. The
returned procedure accepts no parameters and returns a pseudo random
inexact real between, but not including, 0 and 1. The optional parameter
<var>precision</var> specifies an upper bound on the minimum amount by which two
generated pseudo-random numbers can be separated.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b>
> <b>(define rr (random-source-make-reals rs))</b>
> <b>(rr)</b>
.857402537562821
> <b>(rr)</b>
.2876463473845367
</pre></td></tr></table>
<a name="Definition_of_random-source-make-u8vectors"></a><a name="Procedure_random-source-make-u8vectors"></a><a name="index-random_002dsource_002dmake_002du8vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-source-make-u8vectors">random-source-make-u8vectors</a></b></code><i> <var>random-source</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a procedure for generating pseudo random
u8vectors using the random source object <var>random-source</var>. The
returned procedure accepts a single parameter <var>n</var>, a nonnegative
exact integer, and returns a u8vector of length <var>n</var> containing
pseudo random exact integers in the range 0 to 255.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b>
> <b>(define rv (random-source-make-u8vectors rs))</b>
> <b>(rv 10)</b>
#u8(200 53 29 202 3 85 208 187 73 219)
> <b>(rv 10)</b>
#u8(113 8 182 120 138 103 53 192 40 176)
</pre></td></tr></table>
<a name="Definition_of_random-source-make-f64vectors"></a><a name="Procedure_random-source-make-f64vectors"></a><a name="index-random_002dsource_002dmake_002df64vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-source-make-f64vectors">random-source-make-f64vectors</a></b></code><i> <var>random-source</var> <span class="roman">[</span><var>precision</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a procedure for generating pseudo random
f64vectors using the random source object <var>random-source</var>. The
returned procedure accepts a single parameter <var>n</var>, a nonnegative
exact integer, and returns an f64vector of length <var>n</var> containing
pseudo random inexact reals between, but not including, 0 and 1.
The optional parameter <var>precision</var> specifies an upper bound on the
minimum amount by which two generated pseudo-random numbers can be separated.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b>
> <b>(define rv (random-source-make-f64vectors rs))</b>
> <b>(rv 3)</b>
#f64(.7342236104231586 .2876463473845367 .8574025375628211)
> <b>(rv 3)</b>
#f64(.013863292728449427 .33449296573515447 .8162050798467028)
</pre></td></tr></table>
<hr size="6">
<a name="Homogeneous-vectors"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Pseudo-random-numbers" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Numbers" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Homogeneous-vectors-1"></a>
<h1 class="chapter">10. Homogeneous vectors</h1>
<a name="index-homogeneous-vectors"></a>
<p>Homogeneous vectors are vectors containing raw numbers of the same
type (signed or unsigned exact integers or inexact reals). There are
10 types of homogeneous vectors:
‘<samp>s8vector</samp>’ (vector of exact integers in the range -2^7 to 2^7-1),
‘<samp>u8vector</samp>’ (vector of exact integers in the range 0 to 2^8-1),
‘<samp>s16vector</samp>’ (vector of exact integers in the range -2^15 to 2^15-1),
‘<samp>u16vector</samp>’ (vector of exact integers in the range 0 to 2^16-1),
‘<samp>s32vector</samp>’ (vector of exact integers in the range -2^31 to 2^31-1),
‘<samp>u32vector</samp>’ (vector of exact integers in the range 0 to 2^32-1),
‘<samp>s64vector</samp>’ (vector of exact integers in the range -2^63 to 2^63-1),
‘<samp>u64vector</samp>’ (vector of exact integers in the range 0 to 2^64-1),
‘<samp>f32vector</samp>’ (vector of 32 bit floating point numbers),
and ‘<samp>f64vector</samp>’ (vector of 64 bit floating point numbers).
</p>
<p>The lexical syntax of homogeneous vectors is specified in
<a href="#Homogeneous-vector-syntax">Homogeneous vector syntax</a>.
</p>
<p>The procedures available for homogeneous vectors, listed below, are
the analog of the normal vector/string procedures for each of the
homogeneous vector types.
</p>
<a name="Definition_of_s8vector?"></a><a name="Procedure_s8vector?"></a><a name="index-s8vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector?">s8vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-s8vector"></a><a name="Procedure_make-s8vector"></a><a name="index-make_002ds8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-s8vector">make-s8vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector"></a><a name="Procedure_s8vector"></a><a name="index-s8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector">s8vector</a></b></code><i> <var>exact-int8</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector-length"></a><a name="Procedure_s8vector-length"></a><a name="index-s8vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-length">s8vector-length</a></b></code><i> <var>s8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector-ref"></a><a name="Procedure_s8vector-ref"></a><a name="index-s8vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-ref">s8vector-ref</a></b></code><i> <var>s8vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector-set"></a><a name="Procedure_s8vector-set"></a><a name="index-s8vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-set">s8vector-set</a></b></code><i> <var>s8vector</var> <var>k</var> <var>exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector-set!"></a><a name="Procedure_s8vector-set!"></a><a name="index-s8vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-set!">s8vector-set!</a></b></code><i> <var>s8vector</var> <var>k</var> <var>exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector-%3Elist"></a><a name="Procedure_s8vector-%3Elist"></a><a name="index-s8vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-%3Elist">s8vector->list</a></b></code><i> <var>s8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Es8vector"></a><a name="Procedure_list-%3Es8vector"></a><a name="index-list_002d_003es8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Es8vector">list->s8vector</a></b></code><i> <var>list-of-exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector-fill!"></a><a name="Procedure_s8vector-fill!"></a><a name="index-s8vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-fill!">s8vector-fill!</a></b></code><i> <var>s8vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs8vector-fill!"></a><a name="Procedure_subs8vector-fill!"></a><a name="index-subs8vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs8vector-fill!">subs8vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-s8vectors"></a><a name="Procedure_append-s8vectors"></a><a name="index-append_002ds8vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-s8vectors">append-s8vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector-copy"></a><a name="Procedure_s8vector-copy"></a><a name="index-s8vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-copy">s8vector-copy</a></b></code><i> <var>s8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector-append"></a><a name="Procedure_s8vector-append"></a><a name="index-s8vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-append">s8vector-append</a></b></code><i> <var>s8vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs8vector"></a><a name="Procedure_subs8vector"></a><a name="index-subs8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs8vector">subs8vector</a></b></code><i> <var>s8vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs8vector-move!"></a><a name="Procedure_subs8vector-move!"></a><a name="index-subs8vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs8vector-move!">subs8vector-move!</a></b></code><i> <var>src-s8vector</var> <var>src-start</var> <var>src-end</var> <var>dst-s8vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s8vector-shrink!"></a><a name="Procedure_s8vector-shrink!"></a><a name="index-s8vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-shrink!">s8vector-shrink!</a></b></code><i> <var>s8vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector?"></a><a name="Procedure_u8vector?"></a><a name="index-u8vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector?">u8vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-u8vector"></a><a name="Procedure_make-u8vector"></a><a name="index-make_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-u8vector">make-u8vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector"></a><a name="Procedure_u8vector"></a><a name="index-u8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector">u8vector</a></b></code><i> <var>exact-int8</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-length"></a><a name="Procedure_u8vector-length"></a><a name="index-u8vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-length">u8vector-length</a></b></code><i> <var>u8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-ref"></a><a name="Procedure_u8vector-ref"></a><a name="index-u8vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-ref">u8vector-ref</a></b></code><i> <var>u8vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-set"></a><a name="Procedure_u8vector-set"></a><a name="index-u8vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-set">u8vector-set</a></b></code><i> <var>u8vector</var> <var>k</var> <var>exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-set!"></a><a name="Procedure_u8vector-set!"></a><a name="index-u8vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-set!">u8vector-set!</a></b></code><i> <var>u8vector</var> <var>k</var> <var>exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-%3Elist"></a><a name="Procedure_u8vector-%3Elist"></a><a name="index-u8vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-%3Elist">u8vector->list</a></b></code><i> <var>u8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Eu8vector"></a><a name="Procedure_list-%3Eu8vector"></a><a name="index-list_002d_003eu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Eu8vector">list->u8vector</a></b></code><i> <var>list-of-exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-fill!"></a><a name="Procedure_u8vector-fill!"></a><a name="index-u8vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-fill!">u8vector-fill!</a></b></code><i> <var>u8vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu8vector-fill!"></a><a name="Procedure_subu8vector-fill!"></a><a name="index-subu8vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu8vector-fill!">subu8vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-u8vectors"></a><a name="Procedure_append-u8vectors"></a><a name="index-append_002du8vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-u8vectors">append-u8vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-copy"></a><a name="Procedure_u8vector-copy"></a><a name="index-u8vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-copy">u8vector-copy</a></b></code><i> <var>u8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-append"></a><a name="Procedure_u8vector-append"></a><a name="index-u8vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-append">u8vector-append</a></b></code><i> <var>u8vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu8vector"></a><a name="Procedure_subu8vector"></a><a name="index-subu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu8vector">subu8vector</a></b></code><i> <var>u8vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu8vector-move!"></a><a name="Procedure_subu8vector-move!"></a><a name="index-subu8vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu8vector-move!">subu8vector-move!</a></b></code><i> <var>src-u8vector</var> <var>src-start</var> <var>src-end</var> <var>dst-u8vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-shrink!"></a><a name="Procedure_u8vector-shrink!"></a><a name="index-u8vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-shrink!">u8vector-shrink!</a></b></code><i> <var>u8vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector?"></a><a name="Procedure_s16vector?"></a><a name="index-s16vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector?">s16vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-s16vector"></a><a name="Procedure_make-s16vector"></a><a name="index-make_002ds16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-s16vector">make-s16vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector"></a><a name="Procedure_s16vector"></a><a name="index-s16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector">s16vector</a></b></code><i> <var>exact-int16</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector-length"></a><a name="Procedure_s16vector-length"></a><a name="index-s16vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-length">s16vector-length</a></b></code><i> <var>s16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector-ref"></a><a name="Procedure_s16vector-ref"></a><a name="index-s16vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-ref">s16vector-ref</a></b></code><i> <var>s16vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector-set"></a><a name="Procedure_s16vector-set"></a><a name="index-s16vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-set">s16vector-set</a></b></code><i> <var>s16vector</var> <var>k</var> <var>exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector-set!"></a><a name="Procedure_s16vector-set!"></a><a name="index-s16vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-set!">s16vector-set!</a></b></code><i> <var>s16vector</var> <var>k</var> <var>exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector-%3Elist"></a><a name="Procedure_s16vector-%3Elist"></a><a name="index-s16vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-%3Elist">s16vector->list</a></b></code><i> <var>s16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Es16vector"></a><a name="Procedure_list-%3Es16vector"></a><a name="index-list_002d_003es16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Es16vector">list->s16vector</a></b></code><i> <var>list-of-exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector-fill!"></a><a name="Procedure_s16vector-fill!"></a><a name="index-s16vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-fill!">s16vector-fill!</a></b></code><i> <var>s16vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs16vector-fill!"></a><a name="Procedure_subs16vector-fill!"></a><a name="index-subs16vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs16vector-fill!">subs16vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-s16vectors"></a><a name="Procedure_append-s16vectors"></a><a name="index-append_002ds16vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-s16vectors">append-s16vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector-copy"></a><a name="Procedure_s16vector-copy"></a><a name="index-s16vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-copy">s16vector-copy</a></b></code><i> <var>s16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector-append"></a><a name="Procedure_s16vector-append"></a><a name="index-s16vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-append">s16vector-append</a></b></code><i> <var>s16vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs16vector"></a><a name="Procedure_subs16vector"></a><a name="index-subs16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs16vector">subs16vector</a></b></code><i> <var>s16vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs16vector-move!"></a><a name="Procedure_subs16vector-move!"></a><a name="index-subs16vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs16vector-move!">subs16vector-move!</a></b></code><i> <var>src-s16vector</var> <var>src-start</var> <var>src-end</var> <var>dst-s16vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s16vector-shrink!"></a><a name="Procedure_s16vector-shrink!"></a><a name="index-s16vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-shrink!">s16vector-shrink!</a></b></code><i> <var>s16vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector?"></a><a name="Procedure_u16vector?"></a><a name="index-u16vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector?">u16vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-u16vector"></a><a name="Procedure_make-u16vector"></a><a name="index-make_002du16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-u16vector">make-u16vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector"></a><a name="Procedure_u16vector"></a><a name="index-u16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector">u16vector</a></b></code><i> <var>exact-int16</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector-length"></a><a name="Procedure_u16vector-length"></a><a name="index-u16vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-length">u16vector-length</a></b></code><i> <var>u16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector-ref"></a><a name="Procedure_u16vector-ref"></a><a name="index-u16vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-ref">u16vector-ref</a></b></code><i> <var>u16vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector-set"></a><a name="Procedure_u16vector-set"></a><a name="index-u16vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-set">u16vector-set</a></b></code><i> <var>u16vector</var> <var>k</var> <var>exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector-set!"></a><a name="Procedure_u16vector-set!"></a><a name="index-u16vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-set!">u16vector-set!</a></b></code><i> <var>u16vector</var> <var>k</var> <var>exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector-%3Elist"></a><a name="Procedure_u16vector-%3Elist"></a><a name="index-u16vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-%3Elist">u16vector->list</a></b></code><i> <var>u16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Eu16vector"></a><a name="Procedure_list-%3Eu16vector"></a><a name="index-list_002d_003eu16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Eu16vector">list->u16vector</a></b></code><i> <var>list-of-exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector-fill!"></a><a name="Procedure_u16vector-fill!"></a><a name="index-u16vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-fill!">u16vector-fill!</a></b></code><i> <var>u16vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu16vector-fill!"></a><a name="Procedure_subu16vector-fill!"></a><a name="index-subu16vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu16vector-fill!">subu16vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-u16vectors"></a><a name="Procedure_append-u16vectors"></a><a name="index-append_002du16vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-u16vectors">append-u16vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector-copy"></a><a name="Procedure_u16vector-copy"></a><a name="index-u16vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-copy">u16vector-copy</a></b></code><i> <var>u16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector-append"></a><a name="Procedure_u16vector-append"></a><a name="index-u16vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-append">u16vector-append</a></b></code><i> <var>u16vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu16vector"></a><a name="Procedure_subu16vector"></a><a name="index-subu16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu16vector">subu16vector</a></b></code><i> <var>u16vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu16vector-move!"></a><a name="Procedure_subu16vector-move!"></a><a name="index-subu16vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu16vector-move!">subu16vector-move!</a></b></code><i> <var>src-u16vector</var> <var>src-start</var> <var>src-end</var> <var>dst-u16vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u16vector-shrink!"></a><a name="Procedure_u16vector-shrink!"></a><a name="index-u16vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-shrink!">u16vector-shrink!</a></b></code><i> <var>u16vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector?"></a><a name="Procedure_s32vector?"></a><a name="index-s32vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector?">s32vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-s32vector"></a><a name="Procedure_make-s32vector"></a><a name="index-make_002ds32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-s32vector">make-s32vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector"></a><a name="Procedure_s32vector"></a><a name="index-s32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector">s32vector</a></b></code><i> <var>exact-int32</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector-length"></a><a name="Procedure_s32vector-length"></a><a name="index-s32vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-length">s32vector-length</a></b></code><i> <var>s32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector-ref"></a><a name="Procedure_s32vector-ref"></a><a name="index-s32vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-ref">s32vector-ref</a></b></code><i> <var>s32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector-set"></a><a name="Procedure_s32vector-set"></a><a name="index-s32vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-set">s32vector-set</a></b></code><i> <var>s32vector</var> <var>k</var> <var>exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector-set!"></a><a name="Procedure_s32vector-set!"></a><a name="index-s32vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-set!">s32vector-set!</a></b></code><i> <var>s32vector</var> <var>k</var> <var>exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector-%3Elist"></a><a name="Procedure_s32vector-%3Elist"></a><a name="index-s32vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-%3Elist">s32vector->list</a></b></code><i> <var>s32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Es32vector"></a><a name="Procedure_list-%3Es32vector"></a><a name="index-list_002d_003es32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Es32vector">list->s32vector</a></b></code><i> <var>list-of-exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector-fill!"></a><a name="Procedure_s32vector-fill!"></a><a name="index-s32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-fill!">s32vector-fill!</a></b></code><i> <var>s32vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs32vector-fill!"></a><a name="Procedure_subs32vector-fill!"></a><a name="index-subs32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs32vector-fill!">subs32vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-s32vectors"></a><a name="Procedure_append-s32vectors"></a><a name="index-append_002ds32vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-s32vectors">append-s32vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector-copy"></a><a name="Procedure_s32vector-copy"></a><a name="index-s32vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-copy">s32vector-copy</a></b></code><i> <var>s32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector-append"></a><a name="Procedure_s32vector-append"></a><a name="index-s32vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-append">s32vector-append</a></b></code><i> <var>s32vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs32vector"></a><a name="Procedure_subs32vector"></a><a name="index-subs32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs32vector">subs32vector</a></b></code><i> <var>s32vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs32vector-move!"></a><a name="Procedure_subs32vector-move!"></a><a name="index-subs32vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs32vector-move!">subs32vector-move!</a></b></code><i> <var>src-s32vector</var> <var>src-start</var> <var>src-end</var> <var>dst-s32vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s32vector-shrink!"></a><a name="Procedure_s32vector-shrink!"></a><a name="index-s32vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-shrink!">s32vector-shrink!</a></b></code><i> <var>s32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector?"></a><a name="Procedure_u32vector?"></a><a name="index-u32vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector?">u32vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-u32vector"></a><a name="Procedure_make-u32vector"></a><a name="index-make_002du32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-u32vector">make-u32vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector"></a><a name="Procedure_u32vector"></a><a name="index-u32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector">u32vector</a></b></code><i> <var>exact-int32</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector-length"></a><a name="Procedure_u32vector-length"></a><a name="index-u32vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-length">u32vector-length</a></b></code><i> <var>u32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector-ref"></a><a name="Procedure_u32vector-ref"></a><a name="index-u32vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-ref">u32vector-ref</a></b></code><i> <var>u32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector-set"></a><a name="Procedure_u32vector-set"></a><a name="index-u32vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-set">u32vector-set</a></b></code><i> <var>u32vector</var> <var>k</var> <var>exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector-set!"></a><a name="Procedure_u32vector-set!"></a><a name="index-u32vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-set!">u32vector-set!</a></b></code><i> <var>u32vector</var> <var>k</var> <var>exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector-%3Elist"></a><a name="Procedure_u32vector-%3Elist"></a><a name="index-u32vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-%3Elist">u32vector->list</a></b></code><i> <var>u32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Eu32vector"></a><a name="Procedure_list-%3Eu32vector"></a><a name="index-list_002d_003eu32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Eu32vector">list->u32vector</a></b></code><i> <var>list-of-exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector-fill!"></a><a name="Procedure_u32vector-fill!"></a><a name="index-u32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-fill!">u32vector-fill!</a></b></code><i> <var>u32vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu32vector-fill!"></a><a name="Procedure_subu32vector-fill!"></a><a name="index-subu32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu32vector-fill!">subu32vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-u32vectors"></a><a name="Procedure_append-u32vectors"></a><a name="index-append_002du32vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-u32vectors">append-u32vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector-copy"></a><a name="Procedure_u32vector-copy"></a><a name="index-u32vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-copy">u32vector-copy</a></b></code><i> <var>u32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector-append"></a><a name="Procedure_u32vector-append"></a><a name="index-u32vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-append">u32vector-append</a></b></code><i> <var>u32vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu32vector"></a><a name="Procedure_subu32vector"></a><a name="index-subu32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu32vector">subu32vector</a></b></code><i> <var>u32vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu32vector-move!"></a><a name="Procedure_subu32vector-move!"></a><a name="index-subu32vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu32vector-move!">subu32vector-move!</a></b></code><i> <var>src-u32vector</var> <var>src-start</var> <var>src-end</var> <var>dst-u32vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u32vector-shrink!"></a><a name="Procedure_u32vector-shrink!"></a><a name="index-u32vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-shrink!">u32vector-shrink!</a></b></code><i> <var>u32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector?"></a><a name="Procedure_s64vector?"></a><a name="index-s64vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector?">s64vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-s64vector"></a><a name="Procedure_make-s64vector"></a><a name="index-make_002ds64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-s64vector">make-s64vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector"></a><a name="Procedure_s64vector"></a><a name="index-s64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector">s64vector</a></b></code><i> <var>exact-int64</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector-length"></a><a name="Procedure_s64vector-length"></a><a name="index-s64vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-length">s64vector-length</a></b></code><i> <var>s64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector-ref"></a><a name="Procedure_s64vector-ref"></a><a name="index-s64vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-ref">s64vector-ref</a></b></code><i> <var>s64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector-set"></a><a name="Procedure_s64vector-set"></a><a name="index-s64vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-set">s64vector-set</a></b></code><i> <var>s64vector</var> <var>k</var> <var>exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector-set!"></a><a name="Procedure_s64vector-set!"></a><a name="index-s64vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-set!">s64vector-set!</a></b></code><i> <var>s64vector</var> <var>k</var> <var>exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector-%3Elist"></a><a name="Procedure_s64vector-%3Elist"></a><a name="index-s64vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-%3Elist">s64vector->list</a></b></code><i> <var>s64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Es64vector"></a><a name="Procedure_list-%3Es64vector"></a><a name="index-list_002d_003es64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Es64vector">list->s64vector</a></b></code><i> <var>list-of-exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector-fill!"></a><a name="Procedure_s64vector-fill!"></a><a name="index-s64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-fill!">s64vector-fill!</a></b></code><i> <var>s64vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs64vector-fill!"></a><a name="Procedure_subs64vector-fill!"></a><a name="index-subs64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs64vector-fill!">subs64vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-s64vectors"></a><a name="Procedure_append-s64vectors"></a><a name="index-append_002ds64vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-s64vectors">append-s64vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector-copy"></a><a name="Procedure_s64vector-copy"></a><a name="index-s64vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-copy">s64vector-copy</a></b></code><i> <var>s64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector-append"></a><a name="Procedure_s64vector-append"></a><a name="index-s64vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-append">s64vector-append</a></b></code><i> <var>s64vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs64vector"></a><a name="Procedure_subs64vector"></a><a name="index-subs64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs64vector">subs64vector</a></b></code><i> <var>s64vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subs64vector-move!"></a><a name="Procedure_subs64vector-move!"></a><a name="index-subs64vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subs64vector-move!">subs64vector-move!</a></b></code><i> <var>src-s64vector</var> <var>src-start</var> <var>src-end</var> <var>dst-s64vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_s64vector-shrink!"></a><a name="Procedure_s64vector-shrink!"></a><a name="index-s64vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-shrink!">s64vector-shrink!</a></b></code><i> <var>s64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector?"></a><a name="Procedure_u64vector?"></a><a name="index-u64vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector?">u64vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-u64vector"></a><a name="Procedure_make-u64vector"></a><a name="index-make_002du64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-u64vector">make-u64vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector"></a><a name="Procedure_u64vector"></a><a name="index-u64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector">u64vector</a></b></code><i> <var>exact-int64</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector-length"></a><a name="Procedure_u64vector-length"></a><a name="index-u64vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-length">u64vector-length</a></b></code><i> <var>u64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector-ref"></a><a name="Procedure_u64vector-ref"></a><a name="index-u64vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-ref">u64vector-ref</a></b></code><i> <var>u64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector-set"></a><a name="Procedure_u64vector-set"></a><a name="index-u64vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-set">u64vector-set</a></b></code><i> <var>u64vector</var> <var>k</var> <var>exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector-set!"></a><a name="Procedure_u64vector-set!"></a><a name="index-u64vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-set!">u64vector-set!</a></b></code><i> <var>u64vector</var> <var>k</var> <var>exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector-%3Elist"></a><a name="Procedure_u64vector-%3Elist"></a><a name="index-u64vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-%3Elist">u64vector->list</a></b></code><i> <var>u64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Eu64vector"></a><a name="Procedure_list-%3Eu64vector"></a><a name="index-list_002d_003eu64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Eu64vector">list->u64vector</a></b></code><i> <var>list-of-exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector-fill!"></a><a name="Procedure_u64vector-fill!"></a><a name="index-u64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-fill!">u64vector-fill!</a></b></code><i> <var>u64vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu64vector-fill!"></a><a name="Procedure_subu64vector-fill!"></a><a name="index-subu64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu64vector-fill!">subu64vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-u64vectors"></a><a name="Procedure_append-u64vectors"></a><a name="index-append_002du64vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-u64vectors">append-u64vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector-copy"></a><a name="Procedure_u64vector-copy"></a><a name="index-u64vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-copy">u64vector-copy</a></b></code><i> <var>u64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector-append"></a><a name="Procedure_u64vector-append"></a><a name="index-u64vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-append">u64vector-append</a></b></code><i> <var>u64vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu64vector"></a><a name="Procedure_subu64vector"></a><a name="index-subu64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu64vector">subu64vector</a></b></code><i> <var>u64vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subu64vector-move!"></a><a name="Procedure_subu64vector-move!"></a><a name="index-subu64vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subu64vector-move!">subu64vector-move!</a></b></code><i> <var>src-u64vector</var> <var>src-start</var> <var>src-end</var> <var>dst-u64vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u64vector-shrink!"></a><a name="Procedure_u64vector-shrink!"></a><a name="index-u64vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-shrink!">u64vector-shrink!</a></b></code><i> <var>u64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector?"></a><a name="Procedure_f32vector?"></a><a name="index-f32vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector?">f32vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-f32vector"></a><a name="Procedure_make-f32vector"></a><a name="index-make_002df32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-f32vector">make-f32vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector"></a><a name="Procedure_f32vector"></a><a name="index-f32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector">f32vector</a></b></code><i> <var>inexact-real</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector-length"></a><a name="Procedure_f32vector-length"></a><a name="index-f32vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-length">f32vector-length</a></b></code><i> <var>f32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector-ref"></a><a name="Procedure_f32vector-ref"></a><a name="index-f32vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-ref">f32vector-ref</a></b></code><i> <var>f32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector-set"></a><a name="Procedure_f32vector-set"></a><a name="index-f32vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-set">f32vector-set</a></b></code><i> <var>f32vector</var> <var>k</var> <var>inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector-set!"></a><a name="Procedure_f32vector-set!"></a><a name="index-f32vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-set!">f32vector-set!</a></b></code><i> <var>f32vector</var> <var>k</var> <var>inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector-%3Elist"></a><a name="Procedure_f32vector-%3Elist"></a><a name="index-f32vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-%3Elist">f32vector->list</a></b></code><i> <var>f32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Ef32vector"></a><a name="Procedure_list-%3Ef32vector"></a><a name="index-list_002d_003ef32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Ef32vector">list->f32vector</a></b></code><i> <var>list-of-inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector-fill!"></a><a name="Procedure_f32vector-fill!"></a><a name="index-f32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-fill!">f32vector-fill!</a></b></code><i> <var>f32vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subf32vector-fill!"></a><a name="Procedure_subf32vector-fill!"></a><a name="index-subf32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subf32vector-fill!">subf32vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-f32vectors"></a><a name="Procedure_append-f32vectors"></a><a name="index-append_002df32vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-f32vectors">append-f32vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector-copy"></a><a name="Procedure_f32vector-copy"></a><a name="index-f32vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-copy">f32vector-copy</a></b></code><i> <var>f32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector-append"></a><a name="Procedure_f32vector-append"></a><a name="index-f32vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-append">f32vector-append</a></b></code><i> <var>f32vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subf32vector"></a><a name="Procedure_subf32vector"></a><a name="index-subf32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subf32vector">subf32vector</a></b></code><i> <var>f32vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subf32vector-move!"></a><a name="Procedure_subf32vector-move!"></a><a name="index-subf32vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subf32vector-move!">subf32vector-move!</a></b></code><i> <var>src-f32vector</var> <var>src-start</var> <var>src-end</var> <var>dst-f32vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f32vector-shrink!"></a><a name="Procedure_f32vector-shrink!"></a><a name="index-f32vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-shrink!">f32vector-shrink!</a></b></code><i> <var>f32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector?"></a><a name="Procedure_f64vector?"></a><a name="index-f64vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector?">f64vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-f64vector"></a><a name="Procedure_make-f64vector"></a><a name="index-make_002df64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-f64vector">make-f64vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector"></a><a name="Procedure_f64vector"></a><a name="index-f64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector">f64vector</a></b></code><i> <var>inexact-real</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector-length"></a><a name="Procedure_f64vector-length"></a><a name="index-f64vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-length">f64vector-length</a></b></code><i> <var>f64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector-ref"></a><a name="Procedure_f64vector-ref"></a><a name="index-f64vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-ref">f64vector-ref</a></b></code><i> <var>f64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector-set"></a><a name="Procedure_f64vector-set"></a><a name="index-f64vector_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-set">f64vector-set</a></b></code><i> <var>f64vector</var> <var>k</var> <var>inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector-set!"></a><a name="Procedure_f64vector-set!"></a><a name="index-f64vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-set!">f64vector-set!</a></b></code><i> <var>f64vector</var> <var>k</var> <var>inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector-%3Elist"></a><a name="Procedure_f64vector-%3Elist"></a><a name="index-f64vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-%3Elist">f64vector->list</a></b></code><i> <var>f64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_list-%3Ef64vector"></a><a name="Procedure_list-%3Ef64vector"></a><a name="index-list_002d_003ef64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Ef64vector">list->f64vector</a></b></code><i> <var>list-of-inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector-fill!"></a><a name="Procedure_f64vector-fill!"></a><a name="index-f64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-fill!">f64vector-fill!</a></b></code><i> <var>f64vector</var> <var>fill</var> <span class="roman">[</span><var>start</var> <span class="roman">[</span><var>end</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subf64vector-fill!"></a><a name="Procedure_subf64vector-fill!"></a><a name="index-subf64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subf64vector-fill!">subf64vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_append-f64vectors"></a><a name="Procedure_append-f64vectors"></a><a name="index-append_002df64vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-f64vectors">append-f64vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector-copy"></a><a name="Procedure_f64vector-copy"></a><a name="index-f64vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-copy">f64vector-copy</a></b></code><i> <var>f64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector-append"></a><a name="Procedure_f64vector-append"></a><a name="index-f64vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-append">f64vector-append</a></b></code><i> <var>f64vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subf64vector"></a><a name="Procedure_subf64vector"></a><a name="index-subf64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subf64vector">subf64vector</a></b></code><i> <var>f64vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_subf64vector-move!"></a><a name="Procedure_subf64vector-move!"></a><a name="index-subf64vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_subf64vector-move!">subf64vector-move!</a></b></code><i> <var>src-f64vector</var> <var>src-start</var> <var>src-end</var> <var>dst-f64vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_f64vector-shrink!"></a><a name="Procedure_f64vector-shrink!"></a><a name="index-f64vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-shrink!">f64vector-shrink!</a></b></code><i> <var>f64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v (u8vector 10 255 13))</b>
> <b>(u8vector-set! v 2 99)</b>
> <b>v</b>
#u8(10 255 99)
> <b>(u8vector-ref v 1)</b>
255
> <b>(u8vector->list v)</b>
(10 255 99)
> <b>(u8vector-shrink! v 2)</b>
> <b>(v)</b>
#u8(10 255)
</pre></td></tr></table>
<a name="Definition_of_object-%3Eu8vector"></a><a name="Procedure_object-%3Eu8vector"></a><a name="index-object_002d_003eu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_object-%3Eu8vector">object->u8vector</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>encoder</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_u8vector-%3Eobject"></a><a name="Procedure_u8vector-%3Eobject"></a><a name="index-u8vector_002d_003eobject"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-%3Eobject">u8vector->object</a></b></code><i> <var>u8vector</var> <span class="roman">[</span><var>decoder</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-serialization"></a>
<a name="index-deserialization"></a>
<p>The procedure <code>object->u8vector</code> returns a u8vector that contains
the sequence of bytes that encodes the object <var>obj</var>. The
procedure <code>u8vector->object</code> decodes the sequence of bytes
contained in the u8vector <var>u8vector</var>, which was produced by the
procedure <code>object->u8vector</code>, and reconstructs an object
structurally equal to the original object. In other words the
procedures <code>object->u8vector</code> and <code>u8vector->object</code>
respectively perform serialization and deserialization of Scheme
objects. Note that some objects are non-serializable (e.g. threads,
wills, some types of ports, and any object containing a
non-serializable object).
</p>
<p>The optional <var>encoder</var> and <var>decoder</var> parameters are single
parameter procedures which default to the identity function. The
<var>encoder</var> procedure is called during serialization. As the
serializer walks through <var>obj</var>, it calls the <var>encoder</var>
procedure on each sub-object <var>X</var> that is encountered. The
<var>encoder</var> transforms the object <var>X</var> into an object <var>Y</var>
that will be serialized instead of <var>X</var>. Similarly the
<var>decoder</var> procedure is called during deserialization. When an
object <var>Y</var> is encountered, the <var>decoder</var> procedure is called
to transform it into the object <var>X</var> that is the result of
deserialization.
</p>
<p>The <var>encoder</var> and <var>decoder</var> procedures are useful to customize
the serialized representation of objects. In particular, it can be
used to define the semantics of serializing objects, such as threads
and ports, that would otherwise not be serializable. The
<var>decoder</var> procedure is typically the inverse of the <var>encoder</var>
procedure, i.e. <code>(<var>decoder</var> (<var>encoder</var> <var>X</var>))</code> =
<code><var>X</var></code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (make-adder x) (lambda (y) (+ x y)))</b>
> <b>(define f (make-adder 10))</b>
> <b>(define a (object->u8vector f))</b>
> <b>(define b (u8vector->object a))</b>
> <b>(u8vector-length a)</b>
1639
> <b>(f 5)</b>
15
> <b>(b 5)</b>
15
> <b>(pp b)</b>
(lambda (y) (+ x y))
</pre></td></tr></table>
<hr size="6">
<a name="Hashing-and-weak-references"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Hashing" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Homogeneous-vectors" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Records" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Hashing-and-weak-references-1"></a>
<h1 class="chapter">11. Hashing and weak references</h1>
<a name="index-hashing"></a>
<a name="index-weak-references"></a>
<a name="index-tables"></a>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Hashing">11.1 Hashing</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Weak-references">11.2 Weak references</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Hashing"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Weak-references" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Records" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Hashing-1"></a>
<h2 class="section">11.1 Hashing</h2>
<a name="Definition_of_object-%3Eserial-number"></a><a name="Procedure_object-%3Eserial-number"></a><a name="index-object_002d_003eserial_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_object-%3Eserial-number">object->serial-number</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_serial-number-%3Eobject"></a><a name="Procedure_serial-number-%3Eobject"></a><a name="index-serial_002dnumber_002d_003eobject"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_serial-number-%3Eobject">serial-number->object</a></b></code><i> <var>n</var> <span class="roman">[</span><var>default</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>All Scheme objects are uniquely identified with a serial number which
is a nonnegative exact integer. The <code>object->serial-number</code> procedure
returns the serial number of object <var>obj</var>. This serial number is
only allocated the first time the <code>object->serial-number</code>
procedure is called on that object. Objects which do not have an
external textual representation that can be read by the <code>read</code>
procedure, use an external textual representation that includes a
serial number of the form <code>#<var>n</var></code>. Consequently, the
procedures <code>write</code>, <code>pretty-print</code>, etc will call the
<code>object->serial-number</code> procedure to get the serial number, and
this may cause the serial number to be allocated.
</p>
<p>The <code>serial-number->object</code> procedure takes an exact integer
parameter <var>n</var> and returns the object whose serial number is
<var>n</var>. If no object currently exists with that serial number,
<var>default</var> is returned if it is specified, otherwise an
unbound-serial-number-exception object is raised. The reader defines
the following abbreviation for calling <code>serial-number->object</code>:
the syntax <code>#<var>n</var></code>, where <var>n</var> is a sequence of decimal
digits and it is not followed by ‘<samp><code>=</code></samp>’ or ‘<samp><code>#</code></samp>’,
is equivalent to the list <code>(serial-number->object <var>n</var>)</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define z (list (lambda (x) (* x x)) (lambda (y) (/ 1 y))))</b>
> <b>z</b>
(#<procedure #2> #<procedure #3>)
> <b>(#3 10)</b>
1/10
> <b>'(#3 10)</b>
((serial-number->object 3) 10)
> <b>car</b>
#<procedure #4 car>
> <b>(#4 z)</b>
#<procedure #2>
</pre></td></tr></table>
<a name="Definition_of_unbound-serial-number-exception?"></a><a name="Procedure_unbound-serial-number-exception?"></a><a name="index-unbound_002dserial_002dnumber_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-serial-number-exception?">unbound-serial-number-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbound-serial-number-exception-procedure"></a><a name="Procedure_unbound-serial-number-exception-procedure"></a><a name="index-unbound_002dserial_002dnumber_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-serial-number-exception-procedure">unbound-serial-number-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbound-serial-number-exception-arguments"></a><a name="Procedure_unbound-serial-number-exception-arguments"></a><a name="index-unbound_002dserial_002dnumber_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-serial-number-exception-arguments">unbound-serial-number-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Unbound-serial-number-exception objects are raised by the procedure
<code>serial-number->object</code> when no object currently exists with that
serial number. The parameter <var>exc</var> must be an
unbound-serial-number-exception object.
</p>
<p>The procedure <code>unbound-serial-number-exception?</code> returns
<code>#t</code> when <var>obj</var> is a unbound-serial-number-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>unbound-serial-number-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>unbound-serial-number-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (unbound-serial-number-exception? exc)
(list (unbound-serial-number-exception-procedure exc)
(unbound-serial-number-exception-arguments exc))
'not-unbound-serial-number-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (serial-number->object 1000)))</b>
(#<procedure #2 serial-number->object> (1000))
</pre></td></tr></table>
<a name="Definition_of_symbol-hash"></a><a name="Procedure_symbol-hash"></a><a name="index-symbol_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_symbol-hash">symbol-hash</a></b></code><i> <var>symbol</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>symbol-hash</code> procedure returns the hash number of the symbol
<var>symbol</var>. The hash number is a small exact integer (fixnum).
When <var>symbol</var> is an interned symbol the value returned is the same
as <code>(string=?-hash (symbol->string <var>symbol</var>))</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(symbol-hash 'car)</b>
444471047
</pre></td></tr></table>
<a name="Definition_of_keyword-hash"></a><a name="Procedure_keyword-hash"></a><a name="index-keyword_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_keyword-hash">keyword-hash</a></b></code><i> <var>keyword</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>keyword-hash</code> procedure returns the hash number of the
keyword <var>keyword</var>. The hash number is a small exact integer
(fixnum). When <var>keyword</var> is an interned keyword the value
returned is the same as <code>(string=?-hash (keyword->string
<var>keyword</var>))</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(keyword-hash car:)</b>
444471047
</pre></td></tr></table>
<a name="Definition_of_string=?-hash"></a><a name="Procedure_string=?-hash"></a><a name="index-string_003d_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string=?-hash">string=?-hash</a></b></code><i> <var>string</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>string=?-hash</code> procedure returns the hash number of the
string <var>string</var>. The hash number is a small exact integer
(fixnum). For any two strings <var>s1</var> and <var>s2</var>, <code>(string=?
<var>s1</var> <var>s2</var>)</code> implies <code>(= (string=?-hash <var>s1</var>)
(string=?-hash <var>s2</var>))</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(string=?-hash "car")</b>
444471047
</pre></td></tr></table>
<a name="Definition_of_string-ci=?-hash"></a><a name="Procedure_string-ci=?-hash"></a><a name="index-string_002dci_003d_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci=?-hash">string-ci=?-hash</a></b></code><i> <var>string</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>string-ci=?-hash</code> procedure returns the hash number of the
string <var>string</var>. The hash number is a small exact integer
(fixnum). For any two strings <var>s1</var> and <var>s2</var>, <code>(string-ci=?
<var>s1</var> <var>s2</var>)</code> implies <code>(= (string-ci=?-hash <var>s1</var>)
(string-ci=?-hash <var>s2</var>))</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(string-ci=?-hash "CaR")</b>
444471047
</pre></td></tr></table>
<a name="Definition_of_eq?-hash"></a><a name="Procedure_eq?-hash"></a><a name="index-eq_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_eq?-hash">eq?-hash</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>eq?-hash</code> procedure returns the hash number of the object
<var>obj</var>. The hash number is a small exact integer (fixnum). For
any two objects <var>o1</var> and <var>o2</var>, <code>(eq? <var>o1</var> <var>o2</var>)</code>
implies <code>(= (eq?-hash <var>o1</var>) (eq?-hash <var>o2</var>))</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(eq?-hash #t)</b>
536870910
</pre></td></tr></table>
<a name="Definition_of_eqv?-hash"></a><a name="Procedure_eqv?-hash"></a><a name="index-eqv_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_eqv?-hash">eqv?-hash</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>eqv?-hash</code> procedure returns the hash number of the object
<var>obj</var>. The hash number is a small exact integer (fixnum). For
any two objects <var>o1</var> and <var>o2</var>, <code>(eqv? <var>o1</var> <var>o2</var>)</code>
implies <code>(= (eqv?-hash <var>o1</var>) (eqv?-hash <var>o2</var>))</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(eqv?-hash 1.5)</b>
496387656
</pre></td></tr></table>
<a name="Definition_of_equal?-hash"></a><a name="Procedure_equal?-hash"></a><a name="index-equal_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_equal?-hash">equal?-hash</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>equal?-hash</code> procedure returns the hash number of the object
<var>obj</var>. The hash number is a small exact integer (fixnum). For
any two objects <var>o1</var> and <var>o2</var>, <code>(equal? <var>o1</var> <var>o2</var>)</code>
implies <code>(= (equal?-hash <var>o1</var>) (equal?-hash <var>o2</var>))</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(equal?-hash (list 1 2 3))</b>
442438567
</pre></td></tr></table>
<hr size="6">
<a name="Weak-references"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Hashing" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Wills" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Records" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Weak-references-1"></a>
<h2 class="section">11.2 Weak references</h2>
<p>The garbage collector is responsible for reclaiming objects that are
no longer needed by the program. This is done by analyzing the
reachability graph of all objects from the roots (i.e. the global
variables, the runnable threads, permanently allocated objects such as
procedures defined in a compiled file, nonexecutable wills, etc). If
a root or a reachable object <var>X</var> contains a reference to an object
<var>Y</var> then <var>Y</var> is reachable. As a general rule, unreachable
objects are reclaimed by the garbage collector.
</p>
<p>There are two types of references: strong references and weak
references. Most objects, including pairs, vectors, records and
closures, contain strong references. An object <var>X</var> is
<em>strongly reachable</em> if there is a path from the roots to <var>X</var>
that traverses only strong references. Weak references only occur in
wills and tables. There are two types of weak references: will-weak
references and table-weak references. If all paths from the roots to
an object <var>Y</var> traverse at least one table-weak reference, then
<var>Y</var> will be reclaimed by the garbage collector. The will-weak
references are used for finalization and are explained in the next
section.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Wills">11.2.1 Wills</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Tables">11.2.2 Tables</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Wills"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Weak-references" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Tables" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Weak-references" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Records" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Wills-1"></a>
<h3 class="subsection">11.2.1 Wills</h3>
<p>The following procedures implement the <em>will</em> data type. Will
objects provide support for finalization. A will is an object that
contains a will-weak reference to a <var>testator</var> object (the object
attached to the will), and a strong reference to an <var>action</var>
procedure which is a one parameter procedure which is called when the
will is executed.
</p>
<a name="Definition_of_make-will"></a><a name="Procedure_make-will"></a><a name="index-make_002dwill"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-will">make-will</a></b></code><i> <var>testator</var> <var>action</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_will?"></a><a name="Procedure_will?"></a><a name="index-will_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_will?">will?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_will-testator"></a><a name="Procedure_will-testator"></a><a name="index-will_002dtestator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_will-testator">will-testator</a></b></code><i> <var>will</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_will-execute!"></a><a name="Procedure_will-execute!"></a><a name="index-will_002dexecute_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_will-execute!">will-execute!</a></b></code><i> <var>will</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>make-will</code> procedure creates a will object with the given
<var>testator</var> object and <var>action</var> procedure. The <code>will?</code>
procedure tests if <var>obj</var> is a will object. The
<code>will-testator</code> procedure gets the testator object attached to
the <var>will</var>. The <code>will-execute!</code> procedure executes
<var>will</var>.
</p>
<p>A will becomes <em>executable</em> when its <var>testator</var> object is not
strongly reachable (i.e. the <var>testator</var> object is either
unreachable or only reachable using paths from the roots that traverse
at least one weak reference). Some objects, including symbols, small
exact integers (fixnums), booleans and characters, are considered to
be always strongly reachable.
</p>
<p>When the runtime system detects that a will has become executable the
current computation is interrupted, the will’s testator is set to
<code>#f</code> and the will’s action procedure is called with the will’s
testator as the sole argument. Currently only the garbage collector
detects when wills become executable but this may change in future
versions of Gambit (for example the compiler could perform an analysis
to infer will executability at compile time). The garbage collector
builds a list of all executable wills. Shortly after a garbage
collection, the action procedures of these wills will be called. The
link from the will to the action procedure is severed when the action
procedure is called.
</p>
<p>Note that the testator object will not be reclaimed during the garbage
collection that determined executability of the will. It is only when
an object is not reachable from the roots that it is reclaimed by the
garbage collector.
</p>
<p>A remarkable feature of wills is that an action procedure can
“resurrect” an object. An action procedure could for example assign
the testator object to a global variable or create a new will with the
same testator object.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define a (list 123))</b>
> <b>(set-cdr! a a) <span class="roman"><i>; create a circular list</i></span></b>
> <b>(define b (vector a))</b>
> <b>(define c #f)</b>
> <b>(define w
(let ((obj a))
(make-will obj
(lambda (x) ; x will be eq? to obj
(display "executing action procedure")
(newline)
(set! c x)))))</b>
> <b>(will? w)</b>
#t
> <b>(car (will-testator w))</b>
123
> <b>(##gc)</b>
> <b>(set! a #f)</b>
> <b>(##gc)</b>
> <b>(set! b #f)</b>
> <b>(##gc)</b>
executing action procedure
> <b>(will-testator w)</b>
#f
> <b>(car c)</b>
123
</pre></td></tr></table>
<hr size="6">
<a name="Tables"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Wills" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Records" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Weak-references" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Records" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Tables-1"></a>
<h3 class="subsection">11.2.2 Tables</h3>
<p>The following procedures implement the <em>table</em> data type. Tables
are heterogenous structures whose elements are indexed by keys which
are arbitrary objects. Tables are similar to association lists but
are abstract and the access time for large tables is typically smaller.
Each key contained in the table is bound to a value. The length of
the table is the number of key/value bindings it contains. New
key/value bindings can be added to a table, the value bound to a key
can be changed, and existing key/value bindings can be removed.
</p>
<p>The references to the keys can either be all strong or all table-weak
and the references to the values can either be all strong or all
table-weak. The garbage collector removes key/value bindings from a
table when 1) the key is a table-weak reference and the key is
unreachable or only reachable using paths from the roots that traverse
at least one table-weak reference, or 2) the value is a table-weak
reference and the value is unreachable or only reachable using paths
from the roots that traverse at least one table-weak reference.
Key/value bindings that are removed by the garbage collector are
reclaimed immediately.
</p>
<p>Although there are several possible ways of implementing tables, the
current implementation uses hashing with open-addressing. This is
space efficient and provides constant-time access. Hash tables are
automatically resized to maintain the load within specified bounds.
The load is the number of active entries (the length of the table)
divided by the total number of entries in the hash table.
</p>
<p>Tables are parameterized with a key comparison procedure. By default
the <code>equal?</code> procedure is used, but <code>eq?</code>, <code>eqv?</code>,
<code>string=?</code>, <code>string-ci=?</code>, or a user defined procedure can
also be used. To support arbitrary key comparison procedures, tables
are also parameterized with a hashing procedure accepting a key as its
single parameter and returning a fixnum result. The hashing procedure
<var>hash</var> must be consistent with the key comparison procedure
<var>test</var>, that is, for any two keys <var>k1</var> and <var>k2</var> in the
table, <code>(<var>test</var> <var>k1</var> <var>k2</var>)</code> implies <code>(=
(<var>hash</var> <var>k1</var>) (<var>hash</var> <var>k2</var>))</code>. A default hashing
procedure consistent with the key comparison procedure is provided by
the system. The default hashing procedure generally gives good
performance when the key comparison procedure is <code>eq?</code>,
<code>eqv?</code>, <code>equal?</code>, <code>string=?</code>, and <code>string-ci=?</code>.
However, for user defined key comparison procedures, the default
hashing procedure always returns 0. This degrades the performance of
the table to a linear search.
</p>
<p>Tables can be compared for equality using the <code>equal?</code> procedure.
Two tables <code><var>X</var></code> and <code><var>Y</var></code> are considered equal by
<code>equal?</code> when they have the same weakness attributes, the same
key comparison procedure, the same hashing procedure, the same length,
and for all the keys <code><var>k</var></code> in <code><var>X</var></code>, <code>(equal?
(table-ref <var>X</var> <var>k</var>) (table-ref <var>Y</var> <var>k</var>))</code>.
</p>
<a name="Definition_of_make-table"></a><a name="Procedure_make-table"></a><a name="index-make_002dtable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-table">make-table</a></b></code><i> <span class="roman">[</span><code>size:</code> <var>size</var><span class="roman">]</span> <span class="roman">[</span><code>init:</code> <var>init</var><span class="roman">]</span> <span class="roman">[</span><code>weak-keys:</code> <var>weak-keys</var><span class="roman">]</span> <span class="roman">[</span><code>weak-values:</code> <var>weak-values</var><span class="roman">]</span> <span class="roman">[</span><code>test:</code> <var>test</var><span class="roman">]</span> <span class="roman">[</span><code>hash:</code> <var>hash</var><span class="roman">]</span> <span class="roman">[</span><code>min-load:</code> <var>min-load</var><span class="roman">]</span> <span class="roman">[</span><code>max-load:</code> <var>max-load</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>make-table</code> returns a new table. The optional keyword
parameters specify various parameters of the table.
</p>
<p>The <var>size</var> parameter is a nonnegative exact integer indicating
the expected length of the table. The system uses <var>size</var> to
choose an appropriate initial size of the hash table so that it does not
need to be resized too often.
</p>
<p>The <var>init</var> parameter indicates a value that is associated to keys
that are not in the table. When <var>init</var> is not specified, no value
is associated to keys that are not in the table.
</p>
<p>The <var>weak-keys</var> and <var>weak-values</var> parameters are extended
booleans indicating respectively whether the keys and values are
table-weak references (true) or strong references (false). By default
the keys and values are strong references.
</p>
<p>The <var>test</var> parameter indicates the key comparison procedure. The
default key comparison procedure is <code>equal?</code>. The key comparison
procedures <code>eq?</code>, <code>eqv?</code>, <code>equal?</code>, <code>string=?</code>,
and <code>string-ci=?</code> are special because the system will use a
reasonably good hash procedure when none is specified.
</p>
<p>The <var>hash</var> parameter indicates the hash procedure. This procedure
must accept a single key parameter, return a fixnum, and be consistent
with the key comparison procedure. When <var>hash</var> is not specified, a
default hash procedure is used. The default hash procedure is
reasonably good when the key comparison procedure is <code>eq?</code>,
<code>eqv?</code>, <code>equal?</code>, <code>string=?</code>, or <code>string-ci=?</code>.
</p>
<p>The <var>min-load</var> and <var>max-load</var> parameters are real numbers that
indicate the minimum and maximum load of the table respectively. The
table is resized when adding or deleting a key/value binding would
bring the table’s load outside of this range. The <var>min-load</var>
parameter must be no less than 0.05 and the <var>max-load</var> parameter
must be no greater than 0.95. Moreover the difference between
<var>min-load</var> and <var>max-load</var> must be at least 0.20. When
<var>min-load</var> is not specified, the value 0.45 is used. When
<var>max-load</var> is not specified, the value 0.90 is used.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (make-table))</b>
> <b>(table? t)</b>
#t
> <b>(table-length t)</b>
0
> <b>(table-set! t (list 1 2) 3)</b>
> <b>(table-set! t (list 4 5) 6)</b>
> <b>(table-ref t (list 1 2))</b>
3
> <b>(table-length t)</b>
2
</pre></td></tr></table>
<a name="Definition_of_table?"></a><a name="Procedure_table?"></a><a name="index-table_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table?">table?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table?</code> returns <code>#t</code> when <var>obj</var> is a
table and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(table? (make-table))</b>
#t
> <b>(table? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_table-length"></a><a name="Procedure_table-length"></a><a name="index-table_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-length">table-length</a></b></code><i> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table-length</code> returns the number of key/value
bindings contained in the table <var>table</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (make-table weak-keys: #t))</b>
> <b>(define x (list 1 2))</b>
> <b>(define y (list 3 4))</b>
> <b>(table-set! t x 111)</b>
> <b>(table-set! t y 222)</b>
> <b>(table-length t)</b>
2
> <b>(table-set! t x)</b>
> <b>(table-length t)</b>
1
> <b>(##gc)</b>
> <b>(table-length t)</b>
1
> <b>(set! y #f)</b>
> <b>(##gc)</b>
> <b>(table-length t)</b>
0
</pre></td></tr></table>
<a name="Definition_of_table-ref"></a><a name="Procedure_table-ref"></a><a name="index-table_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-ref">table-ref</a></b></code><i> <var>table</var> <var>key</var> <span class="roman">[</span><var>default</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table-ref</code> returns the value bound to the object
<var>key</var> in the table <var>table</var>. When <var>key</var> is not bound and
<var>default</var> is specified, <var>default</var> is returned. When
<var>default</var> is not specified but an <var>init</var> parameter was
specified when <var>table</var> was created, <var>init</var> is returned.
Otherwise an unbound-table-key-exception object is raised.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t1 (make-table init: 999))</b>
> <b>(table-set! t1 (list 1 2) 3)</b>
> <b>(table-ref t1 (list 1 2))</b>
3
> <b>(table-ref t1 (list 4 5))</b>
999
> <b>(table-ref t1 (list 4 5) #f)</b>
#f
> <b>(define t2 (make-table))</b>
> <b>(table-ref t2 (list 4 5))</b>
*** ERROR IN (console)@7.1 -- Unbound table key
(table-ref '#<table #2> '(4 5))
</pre></td></tr></table>
<a name="Definition_of_table-set!"></a><a name="Procedure_table-set!"></a><a name="index-table_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-set!">table-set!</a></b></code><i> <var>table</var> <var>key</var> <span class="roman">[</span><var>value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table-set!</code> binds the object <var>key</var> to
<var>value</var> in the table <var>table</var>. When <var>value</var> is not
specified, if <var>table</var> contains a binding for <var>key</var> then the
binding is removed from <var>table</var>. The procedure <code>table-set!</code>
returns an unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (make-table))</b>
> <b>(table-set! t (list 1 2) 3)</b>
> <b>(table-set! t (list 4 5) 6)</b>
> <b>(table-set! t (list 4 5))</b>
> <b>(table-set! t (list 7 8))</b>
> <b>(table-ref t (list 1 2))</b>
3
> <b>(table-ref t (list 4 5))</b>
*** ERROR IN (console)@7.1 -- Unbound table key
(table-ref '#<table #2> '(4 5))
</pre></td></tr></table>
<a name="Definition_of_table-search"></a><a name="Procedure_table-search"></a><a name="index-table_002dsearch"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-search">table-search</a></b></code><i> <var>proc</var> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table-search</code> searches the table <var>table</var> for a
key/value binding for which the two parameter procedure <var>proc</var>
returns a non false result. For each key/value binding visited by
<code>table-search</code> the procedure <var>proc</var> is called with the key as
the first parameter and the value as the second parameter. The
procedure <code>table-search</code> returns the first non false value
returned by <var>proc</var>, or <code>#f</code> if <var>proc</var> returned <code>#f</code>
for all key/value bindings in <var>table</var>.
</p>
<p>The order in which the key/value bindings are visited is unspecified
and may vary from one call of <code>table-search</code> to the next. While
a call to <code>table-search</code> is being performed on <var>table</var>, it is
an error to call any of the following procedures on <var>table</var>:
<code>table-ref</code>, <code>table-set!</code>, <code>table-search</code>,
<code>table-for-each</code>, <code>table-copy</code>, <code>table-merge</code>,
<code>table-merge!</code>, and <code>table->list</code>. It is also an error to
compare with <code>equal?</code> (directly or indirectly with <code>member</code>,
<code>assoc</code>, <code>table-ref</code>, etc.) an object that contains
<var>table</var>. All these procedures may cause <var>table</var> to be
reordered and resized. This restriction allows a more efficient
iteration over the key/value bindings.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define square (make-table))</b>
> <b>(table-set! square 2 4)</b>
> <b>(table-set! square 3 9)</b>
> <b>(table-search (lambda (k v) (and (odd? k) v)) square)</b>
9
</pre></td></tr></table>
<a name="Definition_of_table-for-each"></a><a name="Procedure_table-for-each"></a><a name="index-table_002dfor_002deach"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-for-each">table-for-each</a></b></code><i> <var>proc</var> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table-for-each</code> calls the two parameter procedure
<var>proc</var> for each key/value binding in the table <var>table</var>. The
procedure <var>proc</var> is called with the key as the first parameter and
the value as the second parameter. The procedure <code>table-for-each</code>
returns an unspecified value.
</p>
<p>The order in which the key/value bindings are visited is unspecified
and may vary from one call of <code>table-for-each</code> to the next.
While a call to <code>table-for-each</code> is being performed on
<var>table</var>, it is an error to call any of the following procedures on
<var>table</var>: <code>table-ref</code>, <code>table-set!</code>, <code>table-search</code>,
<code>table-for-each</code>, and <code>table->list</code>. It is also an error to
compare with <code>equal?</code> (directly or indirectly with <code>member</code>,
<code>assoc</code>, <code>table-ref</code>, etc.) an object that contains
<var>table</var>. All these procedures may cause <var>table</var> to be
reordered and resized. This restriction allows a more efficient
iteration over the key/value bindings.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define square (make-table))</b>
> <b>(table-set! square 2 4)</b>
> <b>(table-set! square 3 9)</b>
> <b>(table-for-each (lambda (k v) (write (list k v)) (newline)) square)</b>
(2 4)
(3 9)
</pre></td></tr></table>
<a name="Definition_of_table-%3Elist"></a><a name="Procedure_table-%3Elist"></a><a name="index-table_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-%3Elist">table->list</a></b></code><i> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table->list</code> returns an association list
containing the key/value bindings in the table <var>table</var>. Each
key/value binding yields a pair whose car field is the key and whose
cdr field is the value bound to that key. The order of the bindings
in the list is unspecified.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define square (make-table))</b>
> <b>(table-set! square 2 4)</b>
> <b>(table-set! square 3 9)</b>
> <b>(table->list square)</b>
((3 . 9) (2 . 4))
</pre></td></tr></table>
<a name="Definition_of_list-%3Etable"></a><a name="Procedure_list-%3Etable"></a><a name="index-list_002d_003etable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Etable">list->table</a></b></code><i> <var>list</var> <span class="roman">[</span><code>size:</code> <var>size</var><span class="roman">]</span> <span class="roman">[</span><code>init:</code> <var>init</var><span class="roman">]</span> <span class="roman">[</span><code>weak-keys:</code> <var>weak-keys</var><span class="roman">]</span> <span class="roman">[</span><code>weak-values:</code> <var>weak-values</var><span class="roman">]</span> <span class="roman">[</span><code>test:</code> <var>test</var><span class="roman">]</span> <span class="roman">[</span><code>hash:</code> <var>hash</var><span class="roman">]</span> <span class="roman">[</span><code>min-load:</code> <var>min-load</var><span class="roman">]</span> <span class="roman">[</span><code>max-load:</code> <var>max-load</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>list->table</code> returns a new table containing the
key/value bindings in the association list <var>list</var>. The optional
keyword parameters specify various parameters of the table and have
the same meaning as for the <code>make-table</code> procedure.
</p>
<p>Each element of <var>list</var> is a pair whose car field is a key and
whose cdr field is the value bound to that key. If a key appears more
than once in <var>list</var> (tested using the table’s key comparison
procedure) it is the first key/value binding in <var>list</var> that has
precedence.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (list->table '((b . 2) (a . 1) (c . 3) (a . 4))))</b>
> <b>(table->list t)</b>
((a . 1) (b . 2) (c . 3))
</pre></td></tr></table>
<a name="Definition_of_unbound-table-key-exception?"></a><a name="Procedure_unbound-table-key-exception?"></a><a name="index-unbound_002dtable_002dkey_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-table-key-exception?">unbound-table-key-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbound-table-key-exception-procedure"></a><a name="Procedure_unbound-table-key-exception-procedure"></a><a name="index-unbound_002dtable_002dkey_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-table-key-exception-procedure">unbound-table-key-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbound-table-key-exception-arguments"></a><a name="Procedure_unbound-table-key-exception-arguments"></a><a name="index-unbound_002dtable_002dkey_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-table-key-exception-arguments">unbound-table-key-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Unbound-table-key-exception objects are raised by the procedure
<code>table-ref</code> when the key does not have a binding in the table.
The parameter <var>exc</var> must be an unbound-table-key-exception object.
</p>
<p>The procedure <code>unbound-table-key-exception?</code> returns
<code>#t</code> when <var>obj</var> is a unbound-table-key-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>unbound-table-key-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>unbound-table-key-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (make-table))</b>
> <b>(define (handler exc)
(if (unbound-table-key-exception? exc)
(list (unbound-table-key-exception-procedure exc)
(unbound-table-key-exception-arguments exc))
'not-unbound-table-key-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (table-ref t '(1 2))))</b>
(#<procedure #2 table-ref> (#<table #3> (1 2)))
</pre></td></tr></table>
<a name="Definition_of_table-copy"></a><a name="Procedure_table-copy"></a><a name="index-table_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-copy">table-copy</a></b></code><i> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table-copy</code> returns a new table containing the
same key/value bindings as <var>table</var> and the same table parameters
(i.e. hash procedure, key comparison procedure, key and value
weakness, etc).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (list->table '((b . 2) (a . 1) (c . 3))))</b>
> <b>(define x (table-copy t))</b>
> <b>(table-set! t 'b 99)</b>
> <b>(table->list t)</b>
((a . 1) (b . 99) (c . 3))
> <b>(table->list x)</b>
((a . 1) (b . 2) (c . 3))
</pre></td></tr></table>
<a name="Definition_of_table-merge!"></a><a name="Procedure_table-merge!"></a><a name="index-table_002dmerge_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-merge!">table-merge!</a></b></code><i> <var>table1</var> <var>table2</var> <span class="roman">[</span><var>table2-takes-precedence?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table-merge!</code> returns <var>table1</var> after the
key/value bindings contained in <var>table2</var> have been added to it.
When a key exists both in <var>table1</var> and <var>table2</var>, then the
parameter <var>table2-takes-precedence?</var> indicates which binding will
be kept (the one in <var>table1</var> if <var>table2-takes-precedence?</var> is
false, and the one in <var>table2</var> otherwise). If
<var>table2-takes-precedence?</var> is not specified the binding in
<var>table1</var> is kept.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t1 (list->table '((a . 1) (b . 2) (c . 3))))</b>
> <b>(define t2 (list->table '((a . 4) (b . 5) (z . 6))))</b>
> <b>(table->list (table-merge! t1 t2))</b>
((a . 1) (b . 2) (c . 3) (z . 6))
> <b>(define t1 (list->table '((a . 1) (b . 2) (c . 3))))</b>
> <b>(define t2 (list->table '((a . 4) (b . 5) (z . 6))))</b>
> <b>(table->list (table-merge! t1 t2 #t))</b>
((a . 4) (b . 5) (c . 3) (z . 6))
</pre></td></tr></table>
<a name="Definition_of_table-merge"></a><a name="Procedure_table-merge"></a><a name="index-table_002dmerge"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-merge">table-merge</a></b></code><i> <var>table1</var> <var>table2</var> <span class="roman">[</span><var>table2-takes-precedence?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>table-merge</code> returns a copy of <var>table1</var>
(created with <code>table-copy</code>) to which the key/value bindings
contained in <var>table2</var> have been added using <code>table-merge!</code>.
When a key exists both in <var>table1</var> and <var>table2</var>, then the
parameter <var>table2-takes-precedence?</var> indicates which binding will
be kept (the one in <var>table1</var> if <var>table2-takes-precedence?</var> is
false, and the one in <var>table2</var> otherwise). If
<var>table2-takes-precedence?</var> is not specified the binding in
<var>table1</var> is kept.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t1 (list->table '((a . 1) (b . 2) (c . 3))))</b>
> <b>(define t2 (list->table '((a . 4) (b . 5) (z . 6))))</b>
> <b>(table->list (table-merge t1 t2))</b>
((a . 1) (b . 2) (c . 3) (z . 6))
> <b>(table->list (table-merge t1 t2 #t))</b>
((a . 4) (b . 5) (c . 3) (z . 6))
</pre></td></tr></table>
<hr size="6">
<a name="Records"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Tables" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Records-1"></a>
<h1 class="chapter">12. Records</h1>
<a name="Definition_of_define-structure"></a><a name="Special_form_define-structure"></a><a name="index-define_002dstructure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define-structure">define-structure</a></b></code><i> <span class="roman"><i>name</i></span> <span class="roman"><i>field</i></span>…</i><code>)</code></td><td align="right">special form</td></tr></table>
<p>Record data types similar to Pascal records and C <code>struct</code>
types can be defined using the <code>define-structure</code> special form.
The identifier <i>name</i> specifies the name of the new data type. The
structure name is followed by <var>k</var> identifiers naming each field of
the record. The <code>define-structure</code> expands into a set of definitions
of the following procedures:
</p>
<ul>
<li>
‘<tt>make-</tt><i>name</i>’ – A <var>k</var> argument procedure which constructs
a new record from the value of its <var>k</var> fields.
</li><li>
‘<i>name</i><tt>?</tt>’ – A procedure which tests if its single argument
is of the given record type.
</li><li>
‘<i>name</i><tt>-</tt><i>field</i>’ – For each field, a procedure taking
as its single argument a value of the given record type and returning
the content of the corresponding field of the record.
</li><li>
‘<i>name</i><tt>-</tt><i>field</i><tt>-set!</tt>’ – For each field, a two
argument procedure taking as its first argument a value of the given
record type. The second argument gets assigned to the corresponding
field of the record and the void object is returned.
</li></ul>
<p>Record data types have a printed representation that includes the name
of the type and the name and value of each field. Record data types
can not be read by the <code>read</code> procedure.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define-structure point x y color)</b>
> <b>(define p (make-point 3 5 'red))</b>
> <b>p</b>
#<point #2 x: 3 y: 5 color: red>
> <b>(point-x p)</b>
3
> <b>(point-color p)</b>
red
> <b>(point-color-set! p 'black)</b>
> <b>p</b>
#<point #2 x: 3 y: 5 color: black>
</pre></td></tr></table>
<hr size="6">
<a name="Threads"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Records" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Introduction" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Records" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Threads-1"></a>
<h1 class="chapter">13. Threads</h1>
<a name="index-threads"></a>
<p>Gambit supports the execution of multiple Scheme threads. These
threads are managed entirely by Gambit’s runtime and are not related
to the host operating system’s threads. Gambit’s runtime does not
currently take advantage of multiprocessors (i.e. at most one thread is
running).
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Introduction">13.1 Introduction</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Thread-objects">13.2 Thread objects</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Mutex-objects">13.3 Mutex objects</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Condition-variable-objects">13.4 Condition variable objects</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Fairness">13.5 Fairness</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Memory-coherency">13.6 Memory coherency</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Timeouts">13.7 Timeouts</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Primordial-thread">13.8 Primordial thread</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Procedures">13.9 Procedures</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Introduction"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Threads" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Thread-objects" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Introduction-1"></a>
<h2 class="section">13.1 Introduction</h2>
<p>Multithreading is a paradigm that is well suited for building complex
systems such as: servers, GUIs, and high-level operating systems.
Gambit’s thread system offers mechanisms for creating threads of
execution and for synchronizing them. The thread system also supports
features which are useful in a real-time context, such as priorities,
priority inheritance and timeouts.
</p>
<p>The thread system provides the following data types:
</p>
<ul>
<li>
Thread (a virtual processor which shares object space with all other
threads)
</li><li>
Mutex (a mutual exclusion device, also known as a lock and binary
semaphore)
</li><li>
Condition variable (a set of blocked threads)
</li></ul>
<hr size="6">
<a name="Thread-objects"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Introduction" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Mutex-objects" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Thread-objects-1"></a>
<h2 class="section">13.2 Thread objects</h2>
<p>A <em>running thread</em> is a thread that is currently executing. A
<em>runnable thread</em> is a thread that is ready to execute or running.
A thread is <em>blocked</em> if it is waiting for a mutex to become
unlocked, an I/O operation to become possible, the end of a “sleep”
period, etc. A <em>new thread</em> is a thread that has been allocated
but has not yet been initialized. An <em>initialized thread</em> is a
thread that can be made runnable. A new thread becomes runnable when
it is started by calling <code>thread-start!</code>. A <em>terminated
thread</em> is a thread that can no longer become runnable (but
<em>deadlocked threads</em> are not considered terminated). The only
valid transitions between the thread states are from new to
initialized, from initialized to runnable, between runnable and
blocked, and from any state except new to terminated as indicated in
the following diagram:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b> <b>unblock</b>
<b>start</b> <-------
NEW -------> INITIALIZED -------> RUNNABLE -------> BLOCKED
\ | <b>block</b> /
\ v /
+-----> TERMINATED <----+
</pre></td></tr></table>
<p>Each thread has a <em>base priority</em>, which is a real number (where a
higher numerical value means a higher priority), a <em>priority boost</em>,
which is a nonnegative real number representing the priority increase
applied to a thread when it blocks, and a <em>quantum</em>, which is a
nonnegative real number representing a duration in seconds.
</p>
<p>Each thread has a <em>specific field</em> which can be used in an
application specific way to associate data with the thread (some thread
systems call this “thread local storage”).
</p>
<p>Each thread has a <em>mailbox</em> which is used for inter-thread
communication.
</p>
<hr size="6">
<a name="Mutex-objects"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Thread-objects" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Condition-variable-objects" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Mutex-objects-1"></a>
<h2 class="section">13.3 Mutex objects</h2>
<p>A mutex can be in one of four states: <em>locked</em> (either <em>owned</em>
or <em>not owned</em>) and <em>unlocked</em> (either <em>abandoned</em> or
<em>not abandoned</em>).
</p>
<p>An attempt to lock a mutex only succeeds if the mutex is in an unlocked
state, otherwise the current thread will wait. A mutex in the
locked/owned state has an associated <em>owner thread</em>, which by
convention is the thread that is responsible for unlocking the mutex
(this case is typical of critical sections implemented as “lock mutex,
perform operation, unlock mutex”). A mutex in the locked/not-owned
state is not linked to a particular thread.
</p>
<p>A mutex becomes locked when a thread locks it using the
‘<samp>mutex-lock!</samp>’ primitive. A mutex becomes unlocked/abandoned when
the owner of a locked/owned mutex terminates. A mutex becomes
unlocked/not-abandoned when a thread unlocks it using the
‘<samp>mutex-unlock!</samp>’ primitive.
</p>
<p>The mutex primitives do not implement <em>recursive mutex semantics</em>.
An attempt to lock a mutex that is locked implies that the current
thread waits even if the mutex is owned by the current thread (this can
lead to a deadlock if no other thread unlocks the mutex).
</p>
<p>Each mutex has a <em>specific field</em> which can be used in an
application specific way to associate data with the mutex.
</p>
<hr size="6">
<a name="Condition-variable-objects"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Mutex-objects" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Fairness" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Condition-variable-objects-1"></a>
<h2 class="section">13.4 Condition variable objects</h2>
<p>A condition variable represents a set of blocked threads. These blocked
threads are waiting for a certain condition to become true. When a
thread modifies some program state that might make the condition true,
the thread unblocks some number of threads (one or all depending on the
primitive used) so they can check if the condition is now true. This
allows complex forms of interthread synchronization to be expressed more
conveniently than with mutexes alone.
</p>
<p>Each condition variable has a <em>specific field</em> which can be used in
an application specific way to associate data with the condition
variable.
</p>
<hr size="6">
<a name="Fairness"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Condition-variable-objects" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Memory-coherency" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Fairness-1"></a>
<h2 class="section">13.5 Fairness</h2>
<p>In various situations the scheduler must select one thread from a set of
threads (e.g. which thread to run when a running thread blocks or
expires its quantum, which thread to unblock when a mutex becomes
unlocked or a condition variable is signaled). The constraints on the
selection process determine the scheduler’s <em>fairness</em>. The
selection depends on the order in which threads become runnable or
blocked and on the <em>priority</em> attached to the threads.
</p>
<p>The definition of fairness requires the notion of time ordering,
i.e. “event <var>A</var> occured before event <var>B</var>”. For the purpose of
establishing time ordering, the scheduler uses a clock with a discrete,
usually variable, resolution (a “tick”). Events occuring in a given
tick can be considered to be simultaneous (i.e. if event <var>A</var> occured
before event <var>B</var> in real time, then the scheduler will claim that
event <var>A</var> occured before event <var>B</var> unless both events fall
within the same tick, in which case the scheduler arbitrarily chooses a
time ordering).
</p>
<p>Each thread <var>T</var> has three priorities which affect fairness; the
<em>base priority</em>, the <em>boosted priority</em>, and the <em>effective
priority</em>.
</p>
<ul>
<li>
The <em>base priority</em> is the value contained in <var>T</var>’s <em>base
priority</em> field (which is set with the ‘<samp>thread-base-priority-set!</samp>’
primitive).
</li><li>
<var>T</var>’s <em>boosted flag</em> field contains a boolean that affects
<var>T</var>’s <em>boosted priority</em>. When the boosted flag field is false,
the boosted priority is equal to the base priority, otherwise the
boosted priority is equal to the base priority plus the value contained
in <var>T</var>’s <em>priority boost</em> field (which is set with the
‘<samp>thread-priority-boost-set!</samp>’ primitive). The boosted flag field is
set to false when a thread is created, when its quantum expires, and
when <em>thread-yield!</em> is called. The boosted flag field is set to
true when a thread blocks. By carefully choosing the base priority and
priority boost, relatively to the other threads, it is possible to set
up an interactive thread so that it has good I/O response time without
being a CPU hog when it performs long computations.
</li><li>
The <em>effective priority</em> is equal to the maximum of <var>T</var>’s
boosted priority and the effective priority of all the threads that are
blocked on a mutex owned by <var>T</var>. This <em>priority inheritance</em>
avoids priority inversion problems that would prevent a high priority
thread blocked at the entry of a critical section to progress because a
low priority thread inside the critical section is preempted for an
arbitrary long time by a medium priority thread.
</li></ul>
<p>Let <var>P</var>(<var>T</var>) be the effective priority of thread <var>T</var> and
let <var>R</var>(<var>T</var>) be the most recent time when one of the following
events occurred for thread <var>T</var>, thus making it runnable: <var>T</var>
was started by calling ‘<samp>thread-start!</samp>’, <var>T</var> called
‘<samp>thread-yield!</samp>’, <var>T</var> expired its quantum, or <var>T</var> became
unblocked. Let the relation <var>NL</var>(<var>T1</var>,<var>T2</var>), “<var>T1</var>
no later than <var>T2</var>”, be true if
<var>P</var>(<var>T1</var>)<<var>P</var>(<var>T2</var>) or
<var>P</var>(<var>T1</var>)=<var>P</var>(<var>T2</var>) and
<var>R</var>(<var>T1</var>)><var>R</var>(<var>T2</var>), and false otherwise. The
scheduler will schedule the execution of threads in such a way that
whenever there is at least one runnable thread, 1) within a finite
time at least one thread will be running, and 2) there is never a pair
of runnable threads <var>T1</var> and <var>T2</var> for which
<var>NL</var>(<var>T1</var>,<var>T2</var>) is true and <var>T1</var> is not running and
<var>T2</var> is running.
</p>
<p>A thread <var>T</var> expires its quantum when an amount of time equal to
<var>T</var>’s quantum has elapsed since <var>T</var> entered the running state
and <var>T</var> did not block, terminate or call ‘<samp>thread-yield!</samp>’.
At that point <var>T</var> exits the running state to allow other threads to
run. A thread’s quantum is thus an indication of the rate of progress
of the thread relative to the other threads of the same priority.
Moreover, the resolution of the timer measuring the running time may
cause a certain deviation from the quantum, so a thread’s quantum should
only be viewed as an approximation of the time it can run before
yielding to another thread.
</p>
<p>Threads blocked on a given mutex or condition variable will unblock in
an order which is consistent with decreasing priority and increasing
blocking time (i.e. the highest priority thread unblocks first, and
among equal priority threads the one that blocked first unblocks first).
</p>
<hr size="6">
<a name="Memory-coherency"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Fairness" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Timeouts" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Memory-coherency-1"></a>
<h2 class="section">13.6 Memory coherency</h2>
<p>Read and write operations on the store (such as reading and writing a
variable, an element of a vector or a string) are not atomic. It is
an error for a thread to write a location in the store while some
other thread reads or writes that same location. It is the
responsibility of the application to avoid write/read and write/write
races through appropriate uses of the synchronization primitives.
</p>
<p>Concurrent reads and writes to ports are allowed. It is the
responsibility of the implementation to serialize accesses to a given
port using the appropriate synchronization primitives.
</p>
<hr size="6">
<a name="Timeouts"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Memory-coherency" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Primordial-thread" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Timeouts-1"></a>
<h2 class="section">13.7 Timeouts</h2>
<p>All synchronization primitives which take a timeout parameter accept
three types of values as a timeout, with the following meaning:
</p>
<ul>
<li>
a time object represents an absolute point in time
</li><li>
an exact or inexact real number represents a relative time in
seconds from the moment the primitive was called
</li><li>
‘<samp>#f</samp>’ means that there is no timeout
</li></ul>
<p>When a timeout denotes the current time or a time in the past, the
synchronization primitive claims that the timeout has been reached
only after the other synchronization conditions have been checked.
Moreover the thread remains running (it does not enter the blocked
state). For example, <code>(mutex-lock! m 0)</code> will lock mutex
<code>m</code> and return ‘<samp>#t</samp>’ if <code>m</code> is
currently unlocked, otherwise ‘<samp>#f</samp>’ is returned because the
timeout is reached.
</p>
<hr size="6">
<a name="Primordial-thread"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Timeouts" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Procedures" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Primordial-thread-1"></a>
<h2 class="section">13.8 Primordial thread</h2>
<p>The execution of a program is initially under the control of a single
thread known as the <em>primordial thread</em>. The primordial thread has an
unspecified
base priority, priority boost, boosted flag, quantum,
name, specific field, dynamic environment, ‘<samp>dynamic-wind</samp>’
stack, and exception-handler. All threads are terminated when the
primordial thread terminates (normally or not).
</p>
<hr size="6">
<a name="Procedures"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Primordial-thread" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Threads" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Procedures-1"></a>
<h2 class="section">13.9 Procedures</h2>
<a name="Definition_of_current-thread"></a><a name="Procedure_current-thread"></a><a name="index-current_002dthread"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-thread">current-thread</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the current thread. For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(current-thread)</b>
#<thread #1 primordial>
> <b>(eq? (current-thread) (current-thread))</b>
#t
</pre></td></tr></table>
<a name="Definition_of_thread?"></a><a name="Procedure_thread?"></a><a name="index-thread_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread?">thread?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a thread object and
<code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread? (current-thread))</b>
#t
> <b>(thread? 'foo)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_make-thread"></a><a name="Procedure_make-thread"></a><a name="index-make_002dthread"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-thread">make-thread</a></b></code><i> <var>thunk</var> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>thread-group</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_make-root-thread"></a><a name="Procedure_make-root-thread"></a><a name="index-make_002droot_002dthread"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-root-thread">make-root-thread</a></b></code><i> <var>thunk</var> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>thread-group</var> <span class="roman">[</span><var>input-port</var> <span class="roman">[</span><var>output-port</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>make-thread</code> procedure creates and returns an initialized
thread. This thread is not automatically made runnable (the procedure
<code>thread-start!</code> must be used for this). A thread has the
following fields: base priority, priority boost, boosted flag,
quantum, name, specific, end-result, end-exception, and a list of
locked/owned mutexes it owns. The thread’s execution consists of a
call to <var>thunk</var> with the <em>initial continuation</em>. This
continuation causes the (then) current thread to store the result in
its end-result field, abandon all mutexes it owns, and finally
terminate. The ‘<samp>dynamic-wind</samp>’ stack of the initial continuation
is empty. The optional <var>name</var> is an arbitrary Scheme object which
identifies the thread (useful for debugging); it defaults to an
unspecified value. The specific field is set to an unspecified value.
The optional <var>thread-group</var> indicates which thread group this
thread belongs to; it defaults to the thread group of the current
thread. The base priority, priority boost, and quantum of the thread
are set to the same value as the current thread and the boosted flag
is set to false. The thread’s mailbox is initially empty. The thread
inherits the dynamic environment from the current thread. Moreover, in
this dynamic environment the exception-handler is bound to the
<em>initial exception-handler</em> which is a unary procedure which
causes the (then) current thread to store in its end-exception field
an uncaught-exception object whose “reason” is the argument of the
handler, abandon all mutexes it owns, and finally terminate.
</p>
<p>The <code>make-root-thread</code> procedure behaves like the
<code>make-thread</code> procedure except the created thread does not
inherit the dynamic environment from the current thread and the base
priority is set to 0, the priority boost is set to 1.0e-6, and the
quantum is set to 0.02. The dynamic environment of the thread has the
global bindings of the parameter objects, except
<code>current-input-port</code> which is bound to <var>input-port</var>,
<code>current-output-port</code> which is bound to <var>output-port</var>, and
<code>current-directory</code> which is bound to the initial current working
directory of the current process. If <var>input-port</var> is not
specified it defaults to a port corresponding to the standard input
(‘<samp>stdin</samp>’). If <var>output-port</var> is not specified it defaults to
a port corresponding to the standard output (‘<samp>stdout</samp>’).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(make-thread (lambda () (write 'hello)))</b>
#<thread #2>
> <b>(make-root-thread (lambda () (write 'world)) 'a-name)</b>
#<thread #3 a-name>
</pre></td></tr></table>
<a name="Definition_of_thread-name"></a><a name="Procedure_thread-name"></a><a name="index-thread_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-name">thread-name</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the name of the <var>thread</var>. For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-name (make-thread (lambda () #f) 'foo))</b>
foo
</pre></td></tr></table>
<a name="Definition_of_thread-specific"></a><a name="Procedure_thread-specific"></a><a name="index-thread_002dspecific"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-specific">thread-specific</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-specific-set!"></a><a name="Procedure_thread-specific-set!"></a><a name="index-thread_002dspecific_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-specific-set!">thread-specific-set!</a></b></code><i> <var>thread</var> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>thread-specific</code> procedure returns the content of the
<var>thread</var>’s specific field.
</p>
<p>The <code>thread-specific-set!</code> procedure stores <var>obj</var> into the
<var>thread</var>’s specific field and returns an unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-specific-set! (current-thread) "hello")</b>
> <b>(thread-specific (current-thread))</b>
"hello"
</pre></td></tr></table>
<a name="Definition_of_thread-base-priority"></a><a name="Procedure_thread-base-priority"></a><a name="index-thread_002dbase_002dpriority"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-base-priority">thread-base-priority</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-base-priority-set!"></a><a name="Procedure_thread-base-priority-set!"></a><a name="index-thread_002dbase_002dpriority_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-base-priority-set!">thread-base-priority-set!</a></b></code><i> <var>thread</var> <var>priority</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>thread-base-priority</code> returns a real number which
corresponds to the base priority of the <var>thread</var>.
</p>
<p>The procedure <code>thread-base-priority-set!</code> changes the base
priority of the <var>thread</var> to <var>priority</var> and returns an
unspecified value. The <var>priority</var> must be a real number.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-base-priority-set! (current-thread) 12.3)</b>
> <b>(thread-base-priority (current-thread))</b>
12.3
</pre></td></tr></table>
<a name="Definition_of_thread-priority-boost"></a><a name="Procedure_thread-priority-boost"></a><a name="index-thread_002dpriority_002dboost"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-priority-boost">thread-priority-boost</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-priority-boost-set!"></a><a name="Procedure_thread-priority-boost-set!"></a><a name="index-thread_002dpriority_002dboost_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-priority-boost-set!">thread-priority-boost-set!</a></b></code><i> <var>thread</var> <var>priority-boost</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>thread-priority-boost</code> returns a real number which
corresponds to the priority boost of the <var>thread</var>.
</p>
<p>The procedure <code>thread-priority-boost-set!</code> changes the priority
boost of the <var>thread</var> to <var>priority-boost</var> and returns an
unspecified value. The <var>priority-boost</var> must be a nonnegative
real.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-priority-boost-set! (current-thread) 2.5)</b>
> <b>(thread-priority-boost (current-thread))</b>
2.5
</pre></td></tr></table>
<a name="Definition_of_thread-quantum"></a><a name="Procedure_thread-quantum"></a><a name="index-thread_002dquantum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-quantum">thread-quantum</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-quantum-set!"></a><a name="Procedure_thread-quantum-set!"></a><a name="index-thread_002dquantum_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-quantum-set!">thread-quantum-set!</a></b></code><i> <var>thread</var> <var>quantum</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>thread-quantum</code> returns a real number which
corresponds to the quantum of the <var>thread</var>.
</p>
<p>The procedure <code>thread-quantum-set!</code> changes the quantum of the
<var>thread</var> to <var>quantum</var> and returns an unspecified value. The
<var>quantum</var> must be a nonnegative real. A value of zero selects the
smallest quantum supported by the implementation.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-quantum-set! (current-thread) 1.5)</b>
> <b>(thread-quantum (current-thread))</b>
1.5
> <b>(thread-quantum-set! (current-thread) 0)</b>
> <b>(thread-quantum (current-thread))</b>
0.
</pre></td></tr></table>
<a name="Definition_of_thread-start!"></a><a name="Procedure_thread-start!"></a><a name="index-thread_002dstart_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-start!">thread-start!</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure makes <var>thread</var> runnable and returns the
<var>thread</var>. The <var>thread</var> must be an initialized thread.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(let ((t (thread-start! (make-thread (lambda () (write 'a))))))
(write 'b)
(thread-join! t))</b>
ab> <span class="roman"><i>or</i></span> ba>
</pre></td></tr></table>
<p>NOTE: It is useful to separate thread creation and thread activation
to avoid the race condition that would occur if the created thread
tries to examine a table in which the current thread stores the
created thread. See the last example of the <code>thread-terminate!</code>
procedure which contains mutually recursive threads.
</p>
<a name="Definition_of_thread-yield!"></a><a name="Procedure_thread-yield!"></a><a name="index-thread_002dyield_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-yield!">thread-yield!</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure causes the current thread to exit the running state as
if its quantum had expired and returns an unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b><span class="roman"><i>; a busy loop that avoids being too wasteful of the CPU</i></span>
(let loop ()
(if (mutex-lock! m 0) <span class="roman"><i>; try to lock m but don't block</i></span>
(begin
(display "locked mutex m")
(mutex-unlock! m))
(begin
(do-something-else)
(thread-yield!) <span class="roman"><i>; relinquish rest of quantum</i></span>
(loop))))
</pre></td></tr></table>
<a name="Definition_of_thread-sleep!"></a><a name="Procedure_thread-sleep!"></a><a name="index-thread_002dsleep_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-sleep!">thread-sleep!</a></b></code><i> <var>timeout</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure causes the current thread to wait until the timeout is
reached and returns an unspecified value. This blocks the thread only
if <var>timeout</var> represents a point in the future. It is an error for
<var>timeout</var> to be ‘<samp>#f</samp>’.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b><span class="roman"><i>; a clock with a gradual drift:</i></span>
(let loop ((x 1))
(thread-sleep! 1)
(write x)
(loop (+ x 1)))
<span class="roman"><i>; a clock with no drift:</i></span>
(let ((start (time->seconds (current-time)))
(let loop ((x 1))
(thread-sleep! (seconds->time (+ x start)))
(write x)
(loop (+ x 1))))
</pre></td></tr></table>
<a name="Definition_of_thread-terminate!"></a><a name="Procedure_thread-terminate!"></a><a name="index-thread_002dterminate_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-terminate!">thread-terminate!</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure causes an abnormal termination of the <var>thread</var>. If
the <var>thread</var> is not already terminated, all mutexes owned by the
<var>thread</var> become unlocked/abandoned and a
terminated-thread-exception object is stored in the <var>thread</var>’s
end-exception field. If <var>thread</var> is the current thread,
<code>thread-terminate!</code> does not return. Otherwise
<code>thread-terminate!</code> returns an unspecified value; the termination
of the <var>thread</var> will occur at some point between the calling of
<code>thread-terminate!</code> and a finite time in the future (an explicit
thread synchronization is needed to detect termination, see
<code>thread-join!</code>).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (amb thunk1 thunk2)
(let ((result #f)
(result-mutex (make-mutex))
(done-mutex (make-mutex)))
(letrec ((child1
(make-thread
(lambda ()
(let ((x (thunk1)))
(mutex-lock! result-mutex #f #f)
(set! result x)
(thread-terminate! child2)
(mutex-unlock! done-mutex)))))
(child2
(make-thread
(lambda ()
(let ((x (thunk2)))
(mutex-lock! result-mutex #f #f)
(set! result x)
(thread-terminate! child1)
(mutex-unlock! done-mutex))))))
(mutex-lock! done-mutex #f #f)
(thread-start! child1)
(thread-start! child2)
(mutex-lock! done-mutex #f #f)
result)))
</pre></td></tr></table>
<p>NOTE: This operation must be used carefully because it terminates a
thread abruptly and it is impossible for that thread to perform any
kind of cleanup. This may be a problem if the thread is in the middle
of a critical section where some structure has been put in an
inconsistent state. However, another thread attempting to enter this
critical section will raise an abandoned-mutex-exception object
because the mutex is unlocked/abandoned. This helps avoid observing
an inconsistent state. Clean termination can be obtained by polling,
as shown in the example below.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (spawn thunk)
(let ((t (make-thread thunk)))
(thread-specific-set! t #t)
(thread-start! t)
t))
(define (stop! thread)
(thread-specific-set! thread #f)
(thread-join! thread))
(define (keep-going?)
(thread-specific (current-thread)))
(define count!
(let ((m (make-mutex))
(i 0))
(lambda ()
(mutex-lock! m)
(let ((x (+ i 1)))
(set! i x)
(mutex-unlock! m)
x))))
(define (increment-forever!)
(let loop () (count!) (if (keep-going?) (loop))))
(let ((t1 (spawn increment-forever!))
(t2 (spawn increment-forever!)))
(thread-sleep! 1)
(stop! t1)
(stop! t2)
(count!)) ==> 377290
</pre></td></tr></table>
<a name="Definition_of_thread-join!"></a><a name="Procedure_thread-join!"></a><a name="index-thread_002djoin_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-join!">thread-join!</a></b></code><i> thread <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>timeout-val</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure causes the current thread to wait until the
<var>thread</var> terminates (normally or not) or until the timeout is
reached if <var>timeout</var> is supplied. If the timeout is reached,
<var>thread-join!</var> returns <var>timeout-val</var> if it is supplied,
otherwise a join-timeout-exception object is raised. If the
<var>thread</var> terminated normally, the content of the end-result field
is returned, otherwise the content of the end-exception field is
raised.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(let ((t (thread-start! (make-thread (lambda () (expt 2 100))))))
(do-something-else)
(thread-join! t)) ==> 1267650600228229401496703205376
(let ((t (thread-start! (make-thread (lambda () (raise 123))))))
(do-something-else)
(with-exception-handler
(lambda (exc)
(if (uncaught-exception? exc)
(* 10 (uncaught-exception-reason exc))
99999))
(lambda ()
(+ 1 (thread-join! t))))) ==> 1231
(define thread-alive?
(let ((unique (list 'unique)))
(lambda (thread)
; Note: this procedure raises an exception if
; the thread terminated abnormally.
(eq? (thread-join! thread 0 unique) unique))))
(define (wait-for-termination! thread)
(let ((eh (current-exception-handler)))
(with-exception-handler
(lambda (exc)
(if (not (or (terminated-thread-exception? exc)
(uncaught-exception? exc)))
(eh exc))) ; unexpected exceptions are handled by eh
(lambda ()
; The following call to thread-join! will wait until the
; thread terminates. If the thread terminated normally
; thread-join! will return normally. If the thread
; terminated abnormally then one of these two exception
; objects is raised by thread-join!:
; - terminated-thread-exception object
; - uncaught-exception object
(thread-join! thread)
#f)))) ; ignore result of thread-join!
</pre></td></tr></table>
<a name="Definition_of_thread-send"></a><a name="Procedure_thread-send"></a><a name="index-thread_002dsend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-send">thread-send</a></b></code><i> <var>thread</var> <var>msg</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Each thread has a mailbox which stores messages delivered to the
thread in the order delivered.
</p>
<p>The procedure <code>thread-send</code> adds the message <var>msg</var> at the end
of the mailbox of thread <var>thread</var> and returns an unspecified
value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-send (current-thread) 111)</b>
> <b>(thread-send (current-thread) 222)</b>
> <b>(thread-receive)</b>
111
> <b>(thread-receive)</b>
222
</pre></td></tr></table>
<a name="Definition_of_thread-receive"></a><a name="Procedure_thread-receive"></a><a name="index-thread_002dreceive"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-receive">thread-receive</a></b></code><i> <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>default</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-mailbox-next"></a><a name="Procedure_thread-mailbox-next"></a><a name="index-thread_002dmailbox_002dnext"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-mailbox-next">thread-mailbox-next</a></b></code><i> <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>default</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-mailbox-rewind"></a><a name="Procedure_thread-mailbox-rewind"></a><a name="index-thread_002dmailbox_002drewind"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-mailbox-rewind">thread-mailbox-rewind</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_thread-mailbox-extract-and-rewind"></a><a name="Procedure_thread-mailbox-extract-and-rewind"></a><a name="index-thread_002dmailbox_002dextract_002dand_002drewind"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-mailbox-extract-and-rewind">thread-mailbox-extract-and-rewind</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>To allow a thread to examine the messages in its mailbox without
removing them from the mailbox, each thread has a <em>mailbox cursor</em>
which normally points to the last message accessed in the mailbox.
When a mailbox cursor is rewound using the procedure
<code>thread-mailbox-rewind</code> or
<code>thread-mailbox-extract-and-rewind</code> or <code>thread-receive</code>, the
cursor does not point to a message, but the next call to
<code>thread-receive</code> and <code>thread-mailbox-next</code> will set the
cursor to the oldest message in the mailbox.
</p>
<p>The procedure <code>thread-receive</code> advances the mailbox cursor of the
current thread to the next message, removes that message from the
mailbox, rewinds the mailbox cursor, and returns the message. When
<var>timeout</var> is not specified, the current thread will wait until a
message is available in the mailbox. When <var>timeout</var> is specified
and <var>default</var> is not specified, a
mailbox-receive-timeout-exception object is raised if the timeout is
reached before a message is available. When <var>timeout</var> is
specified and <var>default</var> is specified, <var>default</var> is returned if
the timeout is reached before a message is available.
</p>
<p>The procedure <code>thread-mailbox-next</code> behaves like
<code>thread-receive</code> except that the message remains in the mailbox
and the mailbox cursor is not rewound.
</p>
<p>The procedures <code>thread-mailbox-rewind</code> or
<code>thread-mailbox-extract-and-rewind</code> rewind the mailbox cursor of
the current thread so that the next call to <code>thread-mailbox-next</code>
and <code>thread-receive</code> will access the oldest message in the
mailbox. Additionally the procedure
<code>thread-mailbox-extract-and-rewind</code> will remove from the mailbox
the message most recently accessed by a call to
<code>thread-mailbox-next</code>. When <code>thread-mailbox-next</code> has not
been called since the last call to <code>thread-receive</code> or
<code>thread-mailbox-rewind</code> or
<code>thread-mailbox-extract-and-rewind</code>, a call to
<code>thread-mailbox-extract-and-rewind</code> only resets the mailbox
cursor (no message is removed).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-send (current-thread) 111)</b>
> <b>(thread-receive 1 999)</b>
111
> <b>(thread-send (current-thread) 222)</b>
> <b>(thread-send (current-thread) 333)</b>
> <b>(thread-mailbox-next 1 999)</b>
222
> <b>(thread-mailbox-next 1 999)</b>
333
> <b>(thread-mailbox-next 1 999)</b>
999
> <b>(thread-mailbox-extract-and-rewind)</b>
> <b>(thread-receive 1 999)</b>
222
> <b>(thread-receive 1 999)</b>
999
</pre></td></tr></table>
<a name="Definition_of_mailbox-receive-timeout-exception?"></a><a name="Procedure_mailbox-receive-timeout-exception?"></a><a name="index-mailbox_002dreceive_002dtimeout_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mailbox-receive-timeout-exception?">mailbox-receive-timeout-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_mailbox-receive-timeout-exception-procedure"></a><a name="Procedure_mailbox-receive-timeout-exception-procedure"></a><a name="index-mailbox_002dreceive_002dtimeout_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mailbox-receive-timeout-exception-procedure">mailbox-receive-timeout-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_mailbox-receive-timeout-exception-arguments"></a><a name="Procedure_mailbox-receive-timeout-exception-arguments"></a><a name="index-mailbox_002dreceive_002dtimeout_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mailbox-receive-timeout-exception-arguments">mailbox-receive-timeout-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Mailbox-receive-timeout-exception objects are raised by the procedures
<code>thread-receive</code> and <code>thread-mailbox-next</code> when a timeout
expires before a message is available and no default value is
specified. The parameter <var>exc</var> must be a
mailbox-receive-timeout-exception object.
</p>
<p>The procedure <code>mailbox-receive-timeout-exception?</code> returns
<code>#t</code> when <var>obj</var> is a mailbox-receive-timeout-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>mailbox-receive-timeout-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>mailbox-receive-timeout-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (mailbox-receive-timeout-exception? exc)
(list (mailbox-receive-timeout-exception-procedure exc)
(mailbox-receive-timeout-exception-arguments exc))
'not-mailbox-receive-timeout-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (thread-receive 1)))</b>
(#<procedure #2 thread-receive> (1))
</pre></td></tr></table>
<a name="Definition_of_mutex?"></a><a name="Procedure_mutex?"></a><a name="index-mutex_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mutex?">mutex?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a mutex object and
<code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(mutex? (make-mutex))</b>
#t
> <b>(mutex? 'foo)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_make-mutex"></a><a name="Procedure_make-mutex"></a><a name="index-make_002dmutex"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-mutex">make-mutex</a></b></code><i> <span class="roman">[</span><var>name</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a new mutex in the unlocked/not-abandoned
state. The optional <var>name</var> is an arbitrary Scheme object which
identifies the mutex (useful for debugging); it defaults to an
unspecified value. The mutex’s specific field is set to an
unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(make-mutex)</b>
#<mutex #2>
> <b>(make-mutex 'foo)</b>
#<mutex #3 foo>
</pre></td></tr></table>
<a name="Definition_of_mutex-name"></a><a name="Procedure_mutex-name"></a><a name="index-mutex_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mutex-name">mutex-name</a></b></code><i> <var>mutex</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the name of the <var>mutex</var>. For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(mutex-name (make-mutex 'foo))</b>
foo
</pre></td></tr></table>
<a name="Definition_of_mutex-specific"></a><a name="Procedure_mutex-specific"></a><a name="index-mutex_002dspecific"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mutex-specific">mutex-specific</a></b></code><i> <var>mutex</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_mutex-specific-set!"></a><a name="Procedure_mutex-specific-set!"></a><a name="index-mutex_002dspecific_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mutex-specific-set!">mutex-specific-set!</a></b></code><i> <var>mutex</var> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>mutex-specific</code> procedure returns the content of the
<var>mutex</var>’s specific field.
</p>
<p>The <code>mutex-specific-set!</code> procedure stores <var>obj</var> into the
<var>mutex</var>’s specific field and returns an unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define m (make-mutex))</b>
> <b>(mutex-specific-set! m "hello")</b>
> <b>(mutex-specific m)</b>
"hello"
> <b>(define (mutex-lock-recursively! mutex)
(if (eq? (mutex-state mutex) (current-thread))
(let ((n (mutex-specific mutex)))
(mutex-specific-set! mutex (+ n 1)))
(begin
(mutex-lock! mutex)
(mutex-specific-set! mutex 0))))</b>
> <b>(define (mutex-unlock-recursively! mutex)
(let ((n (mutex-specific mutex)))
(if (= n 0)
(mutex-unlock! mutex)
(mutex-specific-set! mutex (- n 1)))))</b>
> <b>(mutex-lock-recursively! m)</b>
> <b>(mutex-lock-recursively! m)</b>
> <b>(mutex-lock-recursively! m)</b>
> <b>(mutex-specific m)</b>
2
</pre></td></tr></table>
<a name="Definition_of_mutex-state"></a><a name="Procedure_mutex-state"></a><a name="index-mutex_002dstate"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mutex-state">mutex-state</a></b></code><i> <var>mutex</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Thos procedure returns information about the state of the <var>mutex</var>.
The possible results are:
</p>
<ul>
<li> thread <var>T</var>:
the <var>mutex</var> is in the locked/owned state
and thread <var>T</var> is the owner of the <var>mutex</var>
</li><li> symbol <code>not-owned</code>:
the <var>mutex</var> is in the locked/not-owned state
</li><li> symbol <code>abandoned</code>:
the <var>mutex</var> is in the unlocked/abandoned
state
</li><li> symbol <code>not-abandoned</code>:
the <var>mutex</var> is in the unlocked/not-abandoned
state
</li></ul>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(mutex-state (make-mutex)) ==> not-abandoned
(define (thread-alive? thread)
(let ((mutex (make-mutex)))
(mutex-lock! mutex #f thread)
(let ((state (mutex-state mutex)))
(mutex-unlock! mutex) ; avoid space leak
(eq? state thread))))
</pre></td></tr></table>
<a name="Definition_of_mutex-lock!"></a><a name="Procedure_mutex-lock!"></a><a name="index-mutex_002dlock_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mutex-lock!">mutex-lock!</a></b></code><i> <var>mutex</var> <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>thread</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure locks <var>mutex</var>. If the <var>mutex</var> is currently
locked, the current thread waits until the <var>mutex</var> is unlocked, or
until the timeout is reached if <var>timeout</var> is supplied. If the
timeout is reached, <code>mutex-lock!</code> returns ‘<samp>#f</samp>’. Otherwise,
the state of the <var>mutex</var> is changed as follows:
</p>
<ul>
<li> if <var>thread</var> is ‘<samp>#f</samp>’ the
<var>mutex</var> becomes locked/not-owned,
</li><li> otherwise, let <var>T</var> be <var>thread</var> (or the
current thread if <var>thread</var> is not
supplied),
<ul>
<li> if <var>T</var> is terminated the <var>mutex</var>
becomes unlocked/abandoned,
</li><li> otherwise <var>mutex</var> becomes locked/owned
with <var>T</var> as the owner.
</li></ul>
</li></ul>
<p>After changing the state of the <var>mutex</var>, an
abandoned-mutex-exception object is raised if the <var>mutex</var> was
unlocked/abandoned before the state change, otherwise
<code>mutex-lock!</code> returns ‘<samp>#t</samp>’. It is not an error if the
<var>mutex</var> is owned by the current thread (but the current thread
will have to wait).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>; an implementation of a mailbox object of depth one; this
; implementation does not behave well in the presence of forced
; thread terminations using thread-terminate! (deadlock can occur
; if a thread is terminated in the middle of a put! or get! operation)
(define (make-empty-mailbox)
(let ((put-mutex (make-mutex)) ; allow put! operation
(get-mutex (make-mutex))
(cell #f))
(define (put! obj)
(mutex-lock! put-mutex #f #f) ; prevent put! operation
(set! cell obj)
(mutex-unlock! get-mutex)) ; allow get! operation
(define (get!)
(mutex-lock! get-mutex #f #f) ; wait until object in mailbox
(let ((result cell))
(set! cell #f) ; prevent space leaks
(mutex-unlock! put-mutex) ; allow put! operation
result))
(mutex-lock! get-mutex #f #f) ; prevent get! operation
(lambda (msg)
(case msg
((put!) put!)
((get!) get!)
(else (error "unknown message"))))))
(define (mailbox-put! m obj) ((m 'put!) obj))
(define (mailbox-get! m) ((m 'get!)))
; an alternate implementation of thread-sleep!
(define (sleep! timeout)
(let ((m (make-mutex)))
(mutex-lock! m #f #f)
(mutex-lock! m timeout #f)))
; a procedure that waits for one of two mutexes to unlock
(define (lock-one-of! mutex1 mutex2)
; this procedure assumes that neither mutex1 or mutex2
; are owned by the current thread
(let ((ct (current-thread))
(done-mutex (make-mutex)))
(mutex-lock! done-mutex #f #f)
(let ((t1 (thread-start!
(make-thread
(lambda ()
(mutex-lock! mutex1 #f ct)
(mutex-unlock! done-mutex)))))
(t2 (thread-start!
(make-thread
(lambda ()
(mutex-lock! mutex2 #f ct)
(mutex-unlock! done-mutex))))))
(mutex-lock! done-mutex #f #f)
(thread-terminate! t1)
(thread-terminate! t2)
(if (eq? (mutex-state mutex1) ct)
(begin
(if (eq? (mutex-state mutex2) ct)
(mutex-unlock! mutex2)) ; don't lock both
mutex1)
mutex2))))
</pre></td></tr></table>
<a name="Definition_of_mutex-unlock!"></a><a name="Procedure_mutex-unlock!"></a><a name="index-mutex_002dunlock_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_mutex-unlock!">mutex-unlock!</a></b></code><i> <var>mutex</var> <span class="roman">[</span><var>condition-variable</var> <span class="roman">[</span><var>timeout</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure unlocks the <var>mutex</var> by making it
unlocked/not-abandoned. It is not an error to unlock an unlocked
mutex and a mutex that is owned by any thread. If
<var>condition-variable</var> is supplied, the current thread is blocked
and added to the <var>condition-variable</var> before unlocking
<var>mutex</var>; the thread can unblock at any time but no later than when
an appropriate call to <code>condition-variable-signal!</code> or
<code>condition-variable-broadcast!</code> is performed (see below), and no
later than the timeout (if <var>timeout</var> is supplied). If there are
threads waiting to lock this <var>mutex</var>, the scheduler selects a
thread, the mutex becomes locked/owned or locked/not-owned, and the
thread is unblocked. <code>mutex-unlock!</code> returns ‘<samp>#f</samp>’ when the
timeout is reached, otherwise it returns ‘<samp>#t</samp>’.
</p>
<p>NOTE: The reason the thread can unblock at any time (when
<var>condition-variable</var> is supplied) is that the scheduler, when it
detects a serious problem such as a deadlock, must interrupt one of
the blocked threads (such as the primordial thread) so that it can
perform some appropriate action. After a thread blocked on a
condition-variable has handled such an interrupt it would be wrong for
the scheduler to return the thread to the blocked state, because any
calls to <code>condition-variable-broadcast!</code> during the interrupt
will have gone unnoticed. It is necessary for the thread to remain
runnable and return from the call to <code>mutex-unlock!</code> with a
result of ‘<samp>#t</samp>’.
</p>
<p>NOTE: <code>mutex-unlock!</code> is related to the “wait” operation on
condition variables available in other thread systems. The main
difference is that “wait” automatically locks <var>mutex</var> just
after the thread is unblocked. This operation is not performed by
<code>mutex-unlock!</code> and so must be done by an explicit call to
<code>mutex-lock!</code>. This has the advantages that a different timeout
and exception-handler can be specified on the <code>mutex-lock!</code> and
<code>mutex-unlock!</code> and the location of all the mutex operations is
clearly apparent.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(let loop ()
(mutex-lock! m)
(if (condition-is-true?)
(begin
(do-something-when-condition-is-true)
(mutex-unlock! m))
(begin
(mutex-unlock! m cv)
(loop))))
</pre></td></tr></table>
<a name="Definition_of_condition-variable?"></a><a name="Procedure_condition-variable?"></a><a name="index-condition_002dvariable_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_condition-variable?">condition-variable?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a
condition-variable object and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(condition-variable? (make-condition-variable))</b>
#t
> <b>(condition-variable? 'foo)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_make-condition-variable"></a><a name="Procedure_make-condition-variable"></a><a name="index-make_002dcondition_002dvariable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-condition-variable">make-condition-variable</a></b></code><i> <span class="roman">[</span><var>name</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a new empty condition variable. The optional
<var>name</var> is an arbitrary Scheme object which identifies the
condition variable (useful for debugging); it defaults to an
unspecified value. The condition variable’s specific field is set to
an unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(make-condition-variable)</b>
#<condition-variable #2>
</pre></td></tr></table>
<a name="Definition_of_condition-variable-name"></a><a name="Procedure_condition-variable-name"></a><a name="index-condition_002dvariable_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_condition-variable-name">condition-variable-name</a></b></code><i> <var>condition-variable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the name of the <var>condition-variable</var>. For
example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(condition-variable-name (make-condition-variable 'foo))</b>
foo
</pre></td></tr></table>
<a name="Definition_of_condition-variable-specific"></a><a name="Procedure_condition-variable-specific"></a><a name="index-condition_002dvariable_002dspecific"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_condition-variable-specific">condition-variable-specific</a></b></code><i> <var>condition-variable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_condition-variable-specific-set!"></a><a name="Procedure_condition-variable-specific-set!"></a><a name="index-condition_002dvariable_002dspecific_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_condition-variable-specific-set!">condition-variable-specific-set!</a></b></code><i> <var>condition-variable</var> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>condition-variable-specific</code> procedure returns the content
of the <var>condition-variable</var>’s specific field.
</p>
<p>The <code>condition-variable-specific-set!</code> procedure stores <var>obj</var>
into the <var>condition-variable</var>’s specific field and returns
an unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define cv (make-condition-variable))</b>
> <b>(condition-variable-specific-set! cv "hello")</b>
> <b>(condition-variable-specific cv)</b>
"hello"
</pre></td></tr></table>
<a name="Definition_of_condition-variable-signal!"></a><a name="Procedure_condition-variable-signal!"></a><a name="index-condition_002dvariable_002dsignal_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_condition-variable-signal!">condition-variable-signal!</a></b></code><i> <var>condition-variable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure unblocks a thread blocked on the
<var>condition-variable</var> (if there is at least one) and returns an
unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>; an implementation of a mailbox object of depth one; this
; implementation behaves gracefully when threads are forcibly
; terminated using thread-terminate! (an abandoned-mutex-exception
; object will be raised when a put! or get! operation is attempted
; after a thread is terminated in the middle of a put! or get!
; operation)
(define (make-empty-mailbox)
(let ((mutex (make-mutex))
(put-condvar (make-condition-variable))
(get-condvar (make-condition-variable))
(full? #f)
(cell #f))
(define (put! obj)
(mutex-lock! mutex)
(if full?
(begin
(mutex-unlock! mutex put-condvar)
(put! obj))
(begin
(set! cell obj)
(set! full? #t)
(condition-variable-signal! get-condvar)
(mutex-unlock! mutex))))
(define (get!)
(mutex-lock! mutex)
(if (not full?)
(begin
(mutex-unlock! mutex get-condvar)
(get!))
(let ((result cell))
(set! cell #f) ; avoid space leaks
(set! full? #f)
(condition-variable-signal! put-condvar)
(mutex-unlock! mutex)
result)))
(lambda (msg)
(case msg
((put!) put!)
((get!) get!)
(else (error "unknown message"))))))
(define (mailbox-put! m obj) ((m 'put!) obj))
(define (mailbox-get! m) ((m 'get!)))
</pre></td></tr></table>
<a name="Definition_of_condition-variable-broadcast!"></a><a name="Procedure_condition-variable-broadcast!"></a><a name="index-condition_002dvariable_002dbroadcast_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_condition-variable-broadcast!">condition-variable-broadcast!</a></b></code><i> <var>condition-variable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure unblocks all the thread blocked on the
<var>condition-variable</var> and returns an unspecified value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (make-semaphore n)
(vector n (make-mutex) (make-condition-variable)))
(define (semaphore-wait! sema)
(mutex-lock! (vector-ref sema 1))
(let ((n (vector-ref sema 0)))
(if (> n 0)
(begin
(vector-set! sema 0 (- n 1))
(mutex-unlock! (vector-ref sema 1)))
(begin
(mutex-unlock! (vector-ref sema 1) (vector-ref sema 2))
(semaphore-wait! sema))))
(define (semaphore-signal-by! sema increment)
(mutex-lock! (vector-ref sema 1))
(let ((n (+ (vector-ref sema 0) increment)))
(vector-set! sema 0 n)
(if (> n 0)
(condition-variable-broadcast! (vector-ref sema 2)))
(mutex-unlock! (vector-ref sema 1))))
</pre></td></tr></table>
<hr size="6">
<a name="Dynamic-environment"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Procedures" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Threads" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Dynamic-environment-1"></a>
<h1 class="chapter">14. Dynamic environment</h1>
<p>The <em>dynamic environment</em> is the structure which allows the system
to find the value returned by the standard procedures
<code>current-input-port</code> and <code>current-output-port</code>. The
standard procedures <code>with-input-from-file</code> and
<code>with-output-to-file</code> extend the dynamic environment to produce a
new dynamic environment which is in effect for the dynamic extent of
the call to the thunk passed as their last argument. These procedures
are essentially special purpose dynamic binding operations on hidden
dynamic variables (one for <code>current-input-port</code> and one for
<code>current-output-port</code>). Gambit generalizes this dynamic binding
mechanism to allow the user to introduce new dynamic variables, called
<em>parameter objects</em>, and dynamically bind them. The parameter
objects implemented by Gambit are compatible with the specification of
the “Parameter objects SRFI” (SRFI 39).
</p>
<p>One important issue is the relationship between the dynamic
environments of the parent and child threads when a thread is created.
Each thread has its own dynamic environment that is accessed when
looking up the value bound to a parameter object by that thread. When
a thread’s dynamic environment is extended it does not affect the
dynamic environment of other threads. When a thread is created it is
given a dynamic environment whose bindings are inherited from the
parent thread. In this inherited dynamic environment the parameter
objects are bound to the same cells as the parent’s dynamic
environment (in other words an assignment of a new value to a
parameter object is visible in the other thread).
</p>
<p>Another important issue is the interaction between the
<code>dynamic-wind</code> procedure and dynamic environments. When a thread
creates a continuation, the thread’s dynamic environment and the
‘<samp>dynamic-wind</samp>’ stack are saved within the continuation (an
alternate but equivalent point of view is that the ‘<samp>dynamic-wind</samp>’
stack is part of the dynamic environment). When this continuation is
invoked the required ‘<samp>dynamic-wind</samp>’ before and after thunks are
called and the saved dynamic environment is reinstated as the dynamic
environment of the current thread. During the call to each required
‘<samp>dynamic-wind</samp>’ before and after thunk, the dynamic environment
and the ‘<samp>dynamic-wind</samp>’ stack in effect when the corresponding
‘<samp>dynamic-wind</samp>’ was executed are reinstated. Note that this
specification precisely defines the semantics of calling
‘<samp>call-with-current-continuation</samp>’ or invoking a continuation
within a before or after thunk. The semantics are well defined even
when a continuation created by another thread is invoked. Below is an
example exercising the subtleties of this semantics.
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(with-output-to-file
"foo"
(lambda ()
(let ((k (call-with-current-continuation
(lambda (exit)
(with-output-to-file
"bar"
(lambda ()
(dynamic-wind
(lambda ()
(write '(b1))
(force-output))
(lambda ()
(let ((x (call-with-current-continuation
(lambda (cont) (exit cont)))))
(write '(t1))
(force-output)
x))
(lambda ()
(write '(a1))
(force-output)))))))))
(if k
(dynamic-wind
(lambda ()
(write '(b2))
(force-output))
(lambda ()
(with-output-to-file
"baz"
(lambda ()
(write '(t2))
(force-output)
; go back inside (with-output-to-file "bar" ...)
(k #f))))
(lambda ()
(write '(a2))
(force-output)))))))
</pre></td></tr></table>
<p>The following actions will occur when this code is executed:
<code>(b1)(a1)</code> is written to “bar”, <code>(b2)</code> is then written to
“foo”, <code>(t2)</code> is then written to “baz”, <code>(a2)</code> is then
written to “foo”, and finally <code>(b1)(t1)(a1)</code> is written to
“bar”.
</p>
<a name="Definition_of_make-parameter"></a><a name="Procedure_make-parameter"></a><a name="index-make_002dparameter"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-parameter">make-parameter</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>filter</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The dynamic environment is composed of two parts: the <em>local
dynamic environment</em> and the <em>global dynamic environment</em>. There
is a single global dynamic environment, and it is used to lookup
parameter objects that can’t be found in the local dynamic
environment.
</p>
<p>The <code>make-parameter</code> procedure returns a new <em>parameter
object</em>. The <var>filter</var> argument is a one argument conversion
procedure. If it is not specified, <var>filter</var> defaults to the
identity function.
</p>
<p>The global dynamic environment is updated to associate the parameter
object to a new cell. The initial content of the cell is the result
of applying the conversion procedure to <var>obj</var>.
</p>
<p>A parameter object is a procedure which accepts zero or one argument.
The cell bound to a particular parameter object in the dynamic
environment is accessed by calling the parameter object. When no
argument is passed, the content of the cell is returned. When one
argument is passed the content of the cell is updated with the result
of applying the parameter object’s conversion procedure to the
argument. Note that the conversion procedure can be used for
guaranteeing the type of the parameter object’s binding and/or to
perform some conversion of the value.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define radix (make-parameter 10))</b>
> <b>(radix)</b>
10
> <b>(radix 2)</b>
> <b>(radix)</b>
2
> <b>(define prompt
(make-parameter
123
(lambda (x)
(if (string? x)
x
(object->string x)))))</b>
> <b>(prompt)</b>
"123"
> <b>(prompt "$")</b>
> <b>(prompt)</b>
"$"
> <b>(define write-shared
(make-parameter
#f
(lambda (x)
(if (boolean? x)
x
(error "only booleans are accepted by write-shared")))))</b>
> <b>(write-shared 123)</b>
*** ERROR IN ##make-parameter -- only booleans are accepted by write-shared
</pre></td></tr></table>
<a name="Definition_of_parameterize"></a><a name="Special_form_parameterize"></a><a name="index-parameterize"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_parameterize">parameterize</a></b></code><i> ((<span class="roman"><i>procedure</i></span> <span class="roman"><i>value</i></span>)…) <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<p>The <code>parameterize</code> form, evaluates all <i>procedure</i> and
<i>value</i> expressions in an unspecified order. All the
<i>procedure</i> expressions must evaluate to procedures, either parameter
objects or procedures accepting zero and one argument. Then,
for each procedure <i>p</i> and in an unspecified order:
</p>
<ul>
<li>
If <i>p</i> is a parameter object a new cell is created, initialized, and
bound to the parameter object in the local dynamic environment. The
value contained in the cell is the result of applying the parameter
object’s conversion procedure to <i>value</i>. The resulting dynamic
environment is then used for processing the remaining bindings (or the
evaluation of <i>body</i> if there are no other bindings).
</li><li>
Otherwise <i>p</i> will be used according to the following protocol: we
say that the call <code>(<span class="roman"><i>p</i></span>)</code> “gets <i>p</i>’s value” and that
the call <code>(<span class="roman"><i>p</i></span> <span class="roman"><i>x</i></span>)</code> “sets <i>p</i>’s value to <i>x</i>”.
First, the <code>parameterize</code> form gets <i>p</i>’s value and saves it in
a local variable. It then sets <i>p</i>’s value to <i>value</i>. It then
processes the remaining bindings (or evaluates <i>body</i> if there are
no other bindings). Then it sets <i>p</i>’s value to the saved value.
These steps are performed in a <code>dynamic-wind</code> so that it is
possible to use continuations to jump into and out of the body
(i.e. the <code>dynamic-wind</code>’s before thunk sets <i>p</i>’s value to
<i>value</i> and the after thunk sets <i>p</i>’s value to the saved value).
</li></ul>
<p>The result(s) of the <code>parameterize</code> form are the result(s) of the
<i>body</i>.
</p>
<p>Note that using procedures instead of parameter objects may lead to
unexpected results in multithreaded programs because the before and
after thunks of the <code>dynamic-wind</code> are not called when control
switches between threads.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define radix (make-parameter 2))</b>
> <b>(define prompt
(make-parameter
123
(lambda (x)
(if (string? x)
x
(object->string x)))))</b>
> <b>(radix)</b>
2
> <b>(parameterize ((radix 16)) (radix))</b>
16
> <b>(radix)</b>
2
> <b>(define (f n) (number->string n (radix)))</b>
> <b>(f 10)</b>
"1010"
> <b>(parameterize ((radix 8)) (f 10))</b>
"12"
> <b>(parameterize ((radix 8) (prompt (f 10))) (prompt))</b>
"1010"
> <b>(define p
(let ((x 1))
(lambda args
(if (null? args) x (set! x (car args))))))</b>
> <b>(let* ((a (p))
(b (parameterize ((p 2)) (list (p))))
(c (p)))
(list a b c))</b>
(1 (2) 1)
</pre></td></tr></table>
<hr size="6">
<a name="Exceptions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Dynamic-environment" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exception_002dhandling" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Dynamic-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exceptions-1"></a>
<h1 class="chapter">15. Exceptions</h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-memory-management">15.2 Exception objects related to memory management</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Exception_002dhandling"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exceptions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exception-objects-related-to-memory-management" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exception_002dhandling-1"></a>
<h2 class="section">15.1 Exception-handling</h2>
<p>Gambit’s exception-handling model is inspired from the withdrawn
“Exception Handling SRFI” (SRFI 12), the “Multithreading support
SRFI” (SRFI 18), and the “Exception Handling for Programs SRFI”
(SRFI 34). The two fundamental operations are the dynamic binding of
an exception handler (i.e. the procedure
<code>with-exception-handler</code>) and the invocation of the exception
handler (i.e. the procedure <code>raise</code>).
</p>
<p>All predefined procedures which check for errors (including type
errors, memory allocation errors, host operating-system errors, etc)
report these errors using the exception-handling system (i.e. they
“raise” an exception that can be handled in a user-defined exception
handler). When an exception is raised and the exception is not
handled by a user-defined exception handler, the predefined exception
handler will display an error message (if the primordial thread raised
the exception) or the thread will silently terminate with no error
message (if it is not the primordial thread that raised the
exception). This default behavior can be changed through the
‘<samp>-:d</samp>’ runtime option (see section <a href="#Runtime-options">Runtime options</a>).
</p>
<p>Predefined procedures normally raise exceptions by performing a
tail-call to the exception handler (the exceptions are “complex”
procedures such as <code>eval</code>, <code>compile-file</code>, <code>read</code>,
<code>write</code>, etc). This means that the continuation of the exception
handler and of the REPL that may be started due to this is normally
the continuation of the predefined procedure that raised the
exception. By exiting the REPL with the <code>,(c <var>expression</var>)</code>
command it is thus possible to resume the program as though the call
to the predefined procedure returned the value of <var>expression</var>.
For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (f x) (+ (car x) 1))</b>
> <b>(f 2) <span class="roman"><i>; typo... we meant to say (f '(2))</i></span></b>
*** ERROR IN f, (console)@1.18 -- (Argument 1) PAIR expected
(car 2)
1> <b>,(c 2)</b>
3
</pre></td></tr></table>
<a name="Definition_of_current-exception-handler"></a><a name="Procedure_current-exception-handler"></a><a name="index-current_002dexception_002dhandler"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-exception-handler">current-exception-handler</a></b></code><i> <span class="roman">[</span><var>new-exception-handler</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-current-exception_002dhandler"></a>
<p>The parameter object <code>current-exception-handler</code> is bound to the
current exception-handler. Calling this procedure with no argument
returns the current exception-handler and calling this procedure with
one argument sets the current exception-handler to
<var>new-exception-handler</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(current-exception-handler)</b>
#<procedure #2 primordial-exception-handler>
> <b>(current-exception-handler (lambda (exc) (pp exc) 999))</b>
> <b>(/ 1 0)</b>
#<divide-by-zero-exception #3>
999
</pre></td></tr></table>
<a name="Definition_of_with-exception-handler"></a><a name="Procedure_with-exception-handler"></a><a name="index-with_002dexception_002dhandler"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-exception-handler">with-exception-handler</a></b></code><i> <var>handler</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the result(s) of calling <var>thunk</var> with no arguments. The
<var>handler</var>, which must be a procedure, is installed as the current
exception-handler in the dynamic environment in effect during the call
to <var>thunk</var>. Note that the dynamic environment in effect during
the call to <var>handler</var> has <var>handler</var> as the exception-handler.
Consequently, an exception raised during the call to <var>handler</var> may
lead to an infinite loop.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-exception-handler
(lambda (e) (write e) 5)
(lambda () (+ 1 (* 2 3) 4)))</b>
11
> <b>(with-exception-handler
(lambda (e) (write e) 5)
(lambda () (+ 1 (* 'foo 3) 4)))</b>
#<type-exception #2>10
> <b>(with-exception-handler
(lambda (e) (write e 9))
(lambda () (+ 1 (* 'foo 3) 4)))</b>
<var>infinite loop</var>
</pre></td></tr></table>
<a name="Definition_of_with-exception-catcher"></a><a name="Procedure_with-exception-catcher"></a><a name="index-with_002dexception_002dcatcher"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-exception-catcher">with-exception-catcher</a></b></code><i> <var>handler</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the result(s) of calling <var>thunk</var> with no arguments. A new
exception-handler is installed as the current exception-handler in the
dynamic environment in effect during the call to <var>thunk</var>. This
new exception-handler will call the <var>handler</var>, which must be a
procedure, with the exception object as an argument and with the same
continuation as the call to <code>with-exception-catcher</code>. This
implies that the dynamic environment in effect during the call to
<var>handler</var> is the same as the one in effect at the call to
<code>with-exception-catcher</code>. Consequently, an exception raised
during the call to <var>handler</var> will not lead to an infinite loop.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-exception-catcher
(lambda (e) (write e) 5)
(lambda () (+ 1 (* 2 3) 4)))</b>
11
> <b>(with-exception-catcher
(lambda (e) (write e) 5)
(lambda () (+ 1 (* 'foo 3) 4)))</b>
#<type-exception #2>5
> <b>(with-exception-catcher
(lambda (e) (write e 9))
(lambda () (+ 1 (* 'foo 3) 4)))</b>
*** ERROR IN (console)@7.1 -- (Argument 2) OUTPUT PORT expected
(write '#<type-exception #3> 9)
</pre></td></tr></table>
<a name="Definition_of_raise"></a><a name="Procedure_raise"></a><a name="index-raise"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_raise">raise</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure tail-calls the current exception-handler with <var>obj</var>
as the sole argument. If the exception-handler returns, the
continuation of the call to <code>raise</code> is invoked.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-exception-handler
(lambda (exc)
(pp exc)
100)
(lambda ()
(+ 1 (raise "hello"))))</b>
"hello"
101
</pre></td></tr></table>
<a name="Definition_of_abort"></a><a name="Procedure_abort"></a><a name="index-abort"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_abort">abort</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_noncontinuable-exception?"></a><a name="Procedure_noncontinuable-exception?"></a><a name="index-noncontinuable_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_noncontinuable-exception?">noncontinuable-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_noncontinuable-exception-reason"></a><a name="Procedure_noncontinuable-exception-reason"></a><a name="index-noncontinuable_002dexception_002dreason"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_noncontinuable-exception-reason">noncontinuable-exception-reason</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>abort</code> calls the current exception-handler with
<var>obj</var> as the sole argument. If the exception-handler returns, the
procedure <code>abort</code> will be tail-called with a
noncontinuable-exception object, whose reason field is <var>obj</var>, as
sole argument.
</p>
<p>Noncontinuable-exception objects are raised by the <code>abort</code>
procedure when the exception-handler returns. The parameter <var>exc</var>
must be a noncontinuable-exception object.
</p>
<p>The procedure <code>noncontinuable-exception?</code> returns
<code>#t</code> when <var>obj</var> is a noncontinuable-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>noncontinuable-exception-reason</code> returns the
argument of the call to <code>abort</code> that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-current-continuation
(lambda (k)
(with-exception-handler
(lambda (exc)
(pp exc)
(if (noncontinuable-exception? exc)
(k (list (noncontinuable-exception-reason exc)))
100))
(lambda ()
(+ 1 (abort "hello"))))))</b>
"hello"
#<noncontinuable-exception #2>
("hello")
</pre></td></tr></table>
<hr size="6">
<a name="Exception-objects-related-to-memory-management"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exception_002dhandling" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exception-objects-related-to-the-host-environment" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exception-objects-related-to-memory-management-1"></a>
<h2 class="section">15.2 Exception objects related to memory management</h2>
<a name="Definition_of_heap-overflow-exception?"></a><a name="Procedure_heap-overflow-exception?"></a><a name="index-heap_002doverflow_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_heap-overflow-exception?">heap-overflow-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Heap-overflow-exception objects are raised when the allocation of an
object would cause the heap to use more memory space than is available.
</p>
<p>The procedure <code>heap-overflow-exception?</code> returns
<code>#t</code> when <var>obj</var> is a heap-overflow-exception
object and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (heap-overflow-exception? exc)
exc
'not-heap-overflow-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(define (f x) (f (cons 1 x)))
(f '())))</b>
#<heap-overflow-exception #2>
</pre></td></tr></table>
<a name="Definition_of_stack-overflow-exception?"></a><a name="Procedure_stack-overflow-exception?"></a><a name="index-stack_002doverflow_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_stack-overflow-exception?">stack-overflow-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Stack-overflow-exception objects are raised when the allocation of a
continuation frame would cause the heap to use more memory space than
is available.
</p>
<p>The procedure <code>stack-overflow-exception?</code> returns
<code>#t</code> when <var>obj</var> is a stack-overflow-exception
object and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (stack-overflow-exception? exc)
exc
'not-stack-overflow-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(define (f) (+ 1 (f)))
(f)))</b>
#<stack-overflow-exception #2>
</pre></td></tr></table>
<hr size="6">
<a name="Exception-objects-related-to-the-host-environment"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exception-objects-related-to-memory-management" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exception-objects-related-to-threads" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exception-objects-related-to-the-host-environment-1"></a>
<h2 class="section">15.3 Exception objects related to the host environment</h2>
<a name="Definition_of_os-exception?"></a><a name="Procedure_os-exception?"></a><a name="index-os_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_os-exception?">os-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_os-exception-procedure"></a><a name="Procedure_os-exception-procedure"></a><a name="index-os_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_os-exception-procedure">os-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_os-exception-arguments"></a><a name="Procedure_os-exception-arguments"></a><a name="index-os_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_os-exception-arguments">os-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_os-exception-code"></a><a name="Procedure_os-exception-code"></a><a name="index-os_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_os-exception-code">os-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_os-exception-message"></a><a name="Procedure_os-exception-message"></a><a name="index-os_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_os-exception-message">os-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Os-exception objects are raised by procedures which access the host
operating-system’s services when the requested operation fails. The
parameter <var>exc</var> must be a os-exception object.
</p>
<p>The procedure <code>os-exception?</code> returns
<code>#t</code> when <var>obj</var> is a os-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>os-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>os-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>os-exception-code</code> returns an exact integer error
code that can be converted to a string by the <code>err-code->string</code>
procedure. Note that the error code is operating-system dependent.
</p>
<p>The procedure <code>os-exception-message</code> returns
<code>#f</code> or a string giving details of the exception in a
human-readable form.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (os-exception? exc)
(list (os-exception-procedure exc)
(os-exception-arguments exc)
(err-code->string (os-exception-code exc))
(os-exception-message exc))
'not-os-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (host-info "x.y.z")))</b>
(#<procedure #2 host-info> ("x.y.z") "Unknown host" #f)
</pre></td></tr></table>
<a name="Definition_of_no-such-file-or-directory-exception?"></a><a name="Procedure_no-such-file-or-directory-exception?"></a><a name="index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_no-such-file-or-directory-exception?">no-such-file-or-directory-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_no-such-file-or-directory-exception-procedure"></a><a name="Procedure_no-such-file-or-directory-exception-procedure"></a><a name="index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_no-such-file-or-directory-exception-procedure">no-such-file-or-directory-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_no-such-file-or-directory-exception-arguments"></a><a name="Procedure_no-such-file-or-directory-exception-arguments"></a><a name="index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_no-such-file-or-directory-exception-arguments">no-such-file-or-directory-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>No-such-file-or-directory-exception objects are raised by procedures
which access the filesystem (such as <code>open-input-file</code> and
<code>directory-files</code>) when the path specified can’t be found on the
filesystem. The parameter <var>exc</var> must be a
no-such-file-or-directory-exception object.
</p>
<p>The procedure <code>no-such-file-or-directory-exception?</code> returns
<code>#t</code> when <var>obj</var> is a no-such-file-or-directory-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>no-such-file-or-directory-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>no-such-file-or-directory-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (no-such-file-or-directory-exception? exc)
(list (no-such-file-or-directory-exception-procedure exc)
(no-such-file-or-directory-exception-arguments exc))
'not-no-such-file-or-directory-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (with-input-from-file "nofile" read)))</b>
(#<procedure #2 with-input-from-file> ("nofile" #<procedure #3 read>))
</pre></td></tr></table>
<a name="Definition_of_unbound-os-environment-variable-exception?"></a><a name="Procedure_unbound-os-environment-variable-exception?"></a><a name="index-unbound_002dos_002denvironment_002dvariable_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-os-environment-variable-exception?">unbound-os-environment-variable-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbound-os-environment-variable-exception-procedure"></a><a name="Procedure_unbound-os-environment-variable-exception-procedure"></a><a name="index-unbound_002dos_002denvironment_002dvariable_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-os-environment-variable-exception-procedure">unbound-os-environment-variable-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbound-os-environment-variable-exception-arguments"></a><a name="Procedure_unbound-os-environment-variable-exception-arguments"></a><a name="index-unbound_002dos_002denvironment_002dvariable_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-os-environment-variable-exception-arguments">unbound-os-environment-variable-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Unbound-os-environment-variable-exception objects are raised when an
unbound operating-system environment variable is accessed by the
procedures <code>getenv</code> and <code>setenv</code>. The parameter <var>exc</var>
must be an unbound-os-environment-variable-exception object.
</p>
<p>The procedure <code>unbound-os-environment-variable-exception?</code> returns
<code>#t</code> when <var>obj</var> is an unbound-os-environment-variable-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>unbound-os-environment-variable-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>unbound-os-environment-variable-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (unbound-os-environment-variable-exception? exc)
(list (unbound-os-environment-variable-exception-procedure exc)
(unbound-os-environment-variable-exception-arguments exc))
'not-unbound-os-environment-variable-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (getenv "DOES_NOT_EXIST")))</b>
(#<procedure #2 getenv> ("DOES_NOT_EXIST"))
</pre></td></tr></table>
<hr size="6">
<a name="Exception-objects-related-to-threads"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exception-objects-related-to-the-host-environment" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exception-objects-related-to-C_002dinterface" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exception-objects-related-to-threads-1"></a>
<h2 class="section">15.4 Exception objects related to threads</h2>
<a name="Definition_of_scheduler-exception?"></a><a name="Procedure_scheduler-exception?"></a><a name="index-scheduler_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_scheduler-exception?">scheduler-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_scheduler-exception-reason"></a><a name="Procedure_scheduler-exception-reason"></a><a name="index-scheduler_002dexception_002dreason"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_scheduler-exception-reason">scheduler-exception-reason</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Scheduler-exception objects are raised by the scheduler when some
operation requested from the host operating system failed
(e.g. checking the status of the devices in order to wake up threads
waiting to perform I/O on these devices). The parameter <var>exc</var>
must be a scheduler-exception object.
</p>
<p>The procedure <code>scheduler-exception?</code> returns
<code>#t</code> when <var>obj</var> is a scheduler-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>scheduler-exception-reason</code> returns the
os-exception object that describes the failure detected by the
scheduler.
</p>
<a name="Definition_of_deadlock-exception?"></a><a name="Procedure_deadlock-exception?"></a><a name="index-deadlock_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_deadlock-exception?">deadlock-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Deadlock-exception objects are raised when the scheduler discovers
that all threads are blocked and can make no further progress. In
that case the scheduler unblocks the primordial-thread and forces it
to raise a deadlock-exception object.
</p>
<p>The procedure <code>deadlock-exception?</code> returns <code>#t</code> when
<var>obj</var> is a deadlock-exception object and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (deadlock-exception? exc)
exc
'not-deadlock-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (read (open-vector))))</b>
#<deadlock-exception #2>
</pre></td></tr></table>
<a name="Definition_of_abandoned-mutex-exception?"></a><a name="Procedure_abandoned-mutex-exception?"></a><a name="index-abandoned_002dmutex_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_abandoned-mutex-exception?">abandoned-mutex-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Abandoned-mutex-exception objects are raised when the current thread
locks a mutex that was owned by a thread which terminated (see
<code>mutex-lock!</code>).
</p>
<p>The procedure <code>abandoned-mutex-exception?</code> returns
<code>#t</code> when <var>obj</var> is a abandoned-mutex-exception
object and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (abandoned-mutex-exception? exc)
exc
'not-abandoned-mutex-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(let ((m (make-mutex)))
(thread-join!
(thread-start!
(make-thread
(lambda () (mutex-lock! m)))))
(mutex-lock! m))))</b>
#<abandoned-mutex-exception #2>
</pre></td></tr></table>
<a name="Definition_of_join-timeout-exception?"></a><a name="Procedure_join-timeout-exception?"></a><a name="index-join_002dtimeout_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_join-timeout-exception?">join-timeout-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_join-timeout-exception-procedure"></a><a name="Procedure_join-timeout-exception-procedure"></a><a name="index-join_002dtimeout_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_join-timeout-exception-procedure">join-timeout-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_join-timeout-exception-arguments"></a><a name="Procedure_join-timeout-exception-arguments"></a><a name="index-join_002dtimeout_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_join-timeout-exception-arguments">join-timeout-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Join-timeout-exception objects are raised when a call to the
<code>thread-join!</code> procedure reaches its timeout before the target
thread terminates and a timeout-value parameter is not specified. The
parameter <var>exc</var> must be a join-timeout-exception object.
</p>
<p>The procedure <code>join-timeout-exception?</code> returns
<code>#t</code> when <var>obj</var> is a join-timeout-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>join-timeout-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>join-timeout-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (join-timeout-exception? exc)
(list (join-timeout-exception-procedure exc)
(join-timeout-exception-arguments exc))
'not-join-timeout-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(thread-join!
(thread-start!
(make-thread
(lambda () (thread-sleep! 10))))
5)))</b>
(#<procedure #2 thread-join!> (#<thread #3> 5))
</pre></td></tr></table>
<a name="Definition_of_started-thread-exception?"></a><a name="Procedure_started-thread-exception?"></a><a name="index-started_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_started-thread-exception?">started-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_started-thread-exception-procedure"></a><a name="Procedure_started-thread-exception-procedure"></a><a name="index-started_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_started-thread-exception-procedure">started-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_started-thread-exception-arguments"></a><a name="Procedure_started-thread-exception-arguments"></a><a name="index-started_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_started-thread-exception-arguments">started-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Started-thread-exception objects are raised when the target thread of
a call to the procedure <code>thread-start!</code> is already started. The
parameter <var>exc</var> must be a started-thread-exception object.
</p>
<p>The procedure <code>started-thread-exception?</code> returns
<code>#t</code> when <var>obj</var> is a started-thread-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>started-thread-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>started-thread-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (started-thread-exception? exc)
(list (started-thread-exception-procedure exc)
(started-thread-exception-arguments exc))
'not-started-thread-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(let ((t (make-thread (lambda () (expt 2 1000)))))
(thread-start! t)
(thread-start! t))))</b>
(#<procedure #2 thread-start!> (#<thread #3>))
</pre></td></tr></table>
<a name="Definition_of_terminated-thread-exception?"></a><a name="Procedure_terminated-thread-exception?"></a><a name="index-terminated_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_terminated-thread-exception?">terminated-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_terminated-thread-exception-procedure"></a><a name="Procedure_terminated-thread-exception-procedure"></a><a name="index-terminated_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_terminated-thread-exception-procedure">terminated-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_terminated-thread-exception-arguments"></a><a name="Procedure_terminated-thread-exception-arguments"></a><a name="index-terminated_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_terminated-thread-exception-arguments">terminated-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Terminated-thread-exception objects are raised when the
<code>thread-join!</code> procedure is called and the target thread has
terminated as a result of a call to the <code>thread-terminate!</code>
procedure. The parameter <var>exc</var> must be a
terminated-thread-exception object.
</p>
<p>The procedure <code>terminated-thread-exception?</code> returns
<code>#t</code> when <var>obj</var> is a terminated-thread-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>terminated-thread-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>terminated-thread-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (terminated-thread-exception? exc)
(list (terminated-thread-exception-procedure exc)
(terminated-thread-exception-arguments exc))
'not-terminated-thread-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(thread-join!
(thread-start!
(make-thread
(lambda () (thread-terminate! (current-thread))))))))</b>
(#<procedure #2 thread-join!> (#<thread #3>))
</pre></td></tr></table>
<a name="Definition_of_uncaught-exception?"></a><a name="Procedure_uncaught-exception?"></a><a name="index-uncaught_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_uncaught-exception?">uncaught-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_uncaught-exception-procedure"></a><a name="Procedure_uncaught-exception-procedure"></a><a name="index-uncaught_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_uncaught-exception-procedure">uncaught-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_uncaught-exception-arguments"></a><a name="Procedure_uncaught-exception-arguments"></a><a name="index-uncaught_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_uncaught-exception-arguments">uncaught-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_uncaught-exception-reason"></a><a name="Procedure_uncaught-exception-reason"></a><a name="index-uncaught_002dexception_002dreason"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_uncaught-exception-reason">uncaught-exception-reason</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Uncaught-exception objects are raised when an object is raised in a
thread and that thread does not handle it (i.e. the thread terminated
because it did not catch an exception it raised). The parameter
<var>exc</var> must be an uncaught-exception object.
</p>
<p>The procedure <code>uncaught-exception?</code> returns
<code>#t</code> when <var>obj</var> is an uncaught-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>uncaught-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>uncaught-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>uncaught-exception-reason</code> returns the object that
was raised by the thread and not handled by that thread.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (uncaught-exception? exc)
(list (uncaught-exception-procedure exc)
(uncaught-exception-arguments exc)
(uncaught-exception-reason exc))
'not-uncaught-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(thread-join!
(thread-start!
(make-thread
(lambda () (open-input-file "data" 99)))))))</b>
(#<procedure #2 thread-join!>
(#<thread #3>)
#<wrong-number-of-arguments-exception #4>)
</pre></td></tr></table>
<hr size="6">
<a name="Exception-objects-related-to-C_002dinterface"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exception-objects-related-to-threads" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exception-objects-related-to-the-reader" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exception-objects-related-to-C_002dinterface-1"></a>
<h2 class="section">15.5 Exception objects related to C-interface</h2>
<a name="Definition_of_cfun-conversion-exception?"></a><a name="Procedure_cfun-conversion-exception?"></a><a name="index-cfun_002dconversion_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception?">cfun-conversion-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_cfun-conversion-exception-procedure"></a><a name="Procedure_cfun-conversion-exception-procedure"></a><a name="index-cfun_002dconversion_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception-procedure">cfun-conversion-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_cfun-conversion-exception-arguments"></a><a name="Procedure_cfun-conversion-exception-arguments"></a><a name="index-cfun_002dconversion_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception-arguments">cfun-conversion-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_cfun-conversion-exception-code"></a><a name="Procedure_cfun-conversion-exception-code"></a><a name="index-cfun_002dconversion_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception-code">cfun-conversion-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_cfun-conversion-exception-message"></a><a name="Procedure_cfun-conversion-exception-message"></a><a name="index-cfun_002dconversion_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception-message">cfun-conversion-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Cfun-conversion-exception objects are raised by the C-interface when
converting between the Scheme representation and the C representation
of a value during a call from Scheme to C. The parameter <var>exc</var>
must be a cfun-conversion-exception object.
</p>
<p>The procedure <code>cfun-conversion-exception?</code> returns <code>#t</code> when
<var>obj</var> is a cfun-conversion-exception object and <code>#f</code>
otherwise.
</p>
<p>The procedure <code>cfun-conversion-exception-procedure</code> returns the
procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>cfun-conversion-exception-arguments</code> returns the
list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>cfun-conversion-exception-code</code> returns an exact
integer error code that can be converted to a string by the
<code>err-code->string</code> procedure.
</p>
<p>The procedure <code>cfun-conversion-exception-message</code> returns
<code>#f</code> or a string giving details of the exception in a
human-readable form.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat test1.scm</b>
(define weird
(c-lambda (char-string) nonnull-char-string
"___return(___arg1);"))
$ <b>gsc test1.scm</b>
$ <b>gsi</b>
Gambit v4.9.3
> <b>(load "test1")</b>
"/Users/feeley/gambit/doc/test1.o1"
> <b>(weird "hello")</b>
"hello"
> <b>(define (handler exc)
(if (cfun-conversion-exception? exc)
(list (cfun-conversion-exception-procedure exc)
(cfun-conversion-exception-arguments exc)
(err-code->string (cfun-conversion-exception-code exc))
(cfun-conversion-exception-message exc))
'not-cfun-conversion-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (weird 'not-a-string)))</b>
(#<procedure #2 weird>
(not-a-string)
"(Argument 1) Can't convert to C char-string"
#f)
> <b>(with-exception-catcher
handler
(lambda () (weird #f)))</b>
(#<procedure #2 weird>
(#f)
"Can't convert result from C nonnull-char-string"
#f)
</pre></td></tr></table>
<a name="Definition_of_sfun-conversion-exception?"></a><a name="Procedure_sfun-conversion-exception?"></a><a name="index-sfun_002dconversion_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception?">sfun-conversion-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_sfun-conversion-exception-procedure"></a><a name="Procedure_sfun-conversion-exception-procedure"></a><a name="index-sfun_002dconversion_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception-procedure">sfun-conversion-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_sfun-conversion-exception-arguments"></a><a name="Procedure_sfun-conversion-exception-arguments"></a><a name="index-sfun_002dconversion_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception-arguments">sfun-conversion-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_sfun-conversion-exception-code"></a><a name="Procedure_sfun-conversion-exception-code"></a><a name="index-sfun_002dconversion_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception-code">sfun-conversion-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_sfun-conversion-exception-message"></a><a name="Procedure_sfun-conversion-exception-message"></a><a name="index-sfun_002dconversion_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception-message">sfun-conversion-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Sfun-conversion-exception objects are raised by the C-interface when
converting between the Scheme representation and the C representation
of a value during a call from C to Scheme. The parameter <var>exc</var>
must be a sfun-conversion-exception object.
</p>
<p>The procedure <code>sfun-conversion-exception?</code> returns <code>#t</code> when
<var>obj</var> is a sfun-conversion-exception object and <code>#f</code>
otherwise.
</p>
<p>The procedure <code>sfun-conversion-exception-procedure</code> returns the
procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>sfun-conversion-exception-arguments</code> returns the
list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>sfun-conversion-exception-code</code> returns an exact
integer error code that can be converted to a string by the
<code>err-code->string</code> procedure.
</p>
<p>The procedure <code>sfun-conversion-exception-message</code> returns
<code>#f</code> or a string giving details of the exception in a
human-readable form.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat test2.scm</b>
(c-define (f str) (nonnull-char-string) int "f" ""
(string->number str))
(define t1 (c-lambda () int "___return(f (\"123\"));"))
(define t2 (c-lambda () int "___return(f (0));"))
(define t3 (c-lambda () int "___return(f (\"1.5\"));"))
$ <b>gsc test2.scm</b>
$ <b>gsi</b>
Gambit v4.9.3
> <b>(load "test2")</b>
"/u/feeley/test2.o1"
> <b>(t1)</b>
123
> <b>(define (handler exc)
(if (sfun-conversion-exception? exc)
(list (sfun-conversion-exception-procedure exc)
(sfun-conversion-exception-arguments exc)
(err-code->string (sfun-conversion-exception-code exc))
(sfun-conversion-exception-message exc))
'not-sfun-conversion-exception))</b>
> <b>(with-exception-catcher handler t2)</b>
(#<procedure #2 f>
()
"(Argument 1) Can't convert from C nonnull-char-string"
#f)
> <b>(with-exception-catcher handler t3)</b>
(#<procedure #2 f> () "Can't convert result to C int" #f)
</pre></td></tr></table>
<a name="Definition_of_multiple-c-return-exception?"></a><a name="Procedure_multiple-c-return-exception?"></a><a name="index-multiple_002dc_002dreturn_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_multiple-c-return-exception?">multiple-c-return-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Multiple-c-return-exception objects are raised by the C-interface when
a C to Scheme procedure call returns and that call’s stack frame is no
longer on the C stack because the call has already returned, or has
been removed from the C stack by a <code>longjump</code>.
</p>
<p>The procedure <code>multiple-c-return-exception?</code> returns <code>#t</code>
when <var>obj</var> is a multiple-c-return-exception object and <code>#f</code>
otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat test3.scm</b>
(c-define (f str) (char-string) scheme-object "f" ""
(pp (list 'entry 'str= str))
(let ((k (call-with-current-continuation (lambda (k) k))))
(pp (list 'exit 'k= k))
k))
(define scheme-to-c-to-scheme-and-back
(c-lambda (char-string) scheme-object
"___return(f (___arg1));"))
$ <b>gsc test3.scm</b>
$ <b>gsi</b>
Gambit v4.9.3
> <b>(load "test3")</b>
"/Users/feeley/gambit/doc/test3.o1"
> <b>(define (handler exc)
(if (multiple-c-return-exception? exc)
exc
'not-multiple-c-return-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(let ((c (scheme-to-c-to-scheme-and-back "hello")))
(pp c)
(c 999))))</b>
(entry str= "hello")
(exit k= #<procedure #2>)
#<procedure #2>
(exit k= 999)
#<multiple-c-return-exception #3>
</pre></td></tr></table>
<hr size="6">
<a name="Exception-objects-related-to-the-reader"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exception-objects-related-to-C_002dinterface" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exception-objects-related-to-evaluation-and-compilation" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exception-objects-related-to-the-reader-1"></a>
<h2 class="section">15.6 Exception objects related to the reader</h2>
<a name="Definition_of_datum-parsing-exception?"></a><a name="Procedure_datum-parsing-exception?"></a><a name="index-datum_002dparsing_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_datum-parsing-exception?">datum-parsing-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_datum-parsing-exception-kind"></a><a name="Procedure_datum-parsing-exception-kind"></a><a name="index-datum_002dparsing_002dexception_002dkind"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_datum-parsing-exception-kind">datum-parsing-exception-kind</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_datum-parsing-exception-parameters"></a><a name="Procedure_datum-parsing-exception-parameters"></a><a name="index-datum_002dparsing_002dexception_002dparameters"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_datum-parsing-exception-parameters">datum-parsing-exception-parameters</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_datum-parsing-exception-readenv"></a><a name="Procedure_datum-parsing-exception-readenv"></a><a name="index-datum_002dparsing_002dexception_002dreadenv"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_datum-parsing-exception-readenv">datum-parsing-exception-readenv</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Datum-parsing-exception objects are raised by the reader (i.e. the
<code>read</code> procedure) when the input does not conform to the grammar
for datum. The parameter <var>exc</var> must be a datum-parsing-exception
object.
</p>
<p>The procedure <code>datum-parsing-exception?</code> returns <code>#t</code> when
<var>obj</var> is a datum-parsing-exception object and <code>#f</code>
otherwise.
</p>
<p>The procedure <code>datum-parsing-exception-kind</code> returns a symbol
denoting the kind of parsing error that was encountered by the
reader when it raised <var>exc</var>. Here is a table of the possible
return values:
</p>
<table>
<tr><td width="50%"><code>datum-or-eof-expected</code></td><td width="50%">Datum or EOF expected</td></tr>
<tr><td width="50%"><code>datum-expected</code></td><td width="50%">Datum expected</td></tr>
<tr><td width="50%"><code>improperly-placed-dot</code></td><td width="50%">Improperly placed dot</td></tr>
<tr><td width="50%"><code>incomplete-form-eof-reached</code></td><td width="50%">Incomplete form, EOF reached</td></tr>
<tr><td width="50%"><code>incomplete-form</code></td><td width="50%">Incomplete form</td></tr>
<tr><td width="50%"><code>character-out-of-range</code></td><td width="50%">Character out of range</td></tr>
<tr><td width="50%"><code>invalid-character-name</code></td><td width="50%">Invalid ’#\’ name</td></tr>
<tr><td width="50%"><code>illegal-character</code></td><td width="50%">Illegal character</td></tr>
<tr><td width="50%"><code>s8-expected</code></td><td width="50%">Signed 8 bit exact integer expected</td></tr>
<tr><td width="50%"><code>u8-expected</code></td><td width="50%">Unsigned 8 bit exact integer expected</td></tr>
<tr><td width="50%"><code>s16-expected</code></td><td width="50%">Signed 16 bit exact integer expected</td></tr>
<tr><td width="50%"><code>u16-expected</code></td><td width="50%">Unsigned 16 bit exact integer expected</td></tr>
<tr><td width="50%"><code>s32-expected</code></td><td width="50%">Signed 32 bit exact integer expected</td></tr>
<tr><td width="50%"><code>u32-expected</code></td><td width="50%">Unsigned 32 bit exact integer expected</td></tr>
<tr><td width="50%"><code>s64-expected</code></td><td width="50%">Signed 64 bit exact integer expected</td></tr>
<tr><td width="50%"><code>u64-expected</code></td><td width="50%">Unsigned 64 bit exact integer expected</td></tr>
<tr><td width="50%"><code>inexact-real-expected</code></td><td width="50%">Inexact real expected</td></tr>
<tr><td width="50%"><code>invalid-hex-escape</code></td><td width="50%">Invalid hexadecimal escape</td></tr>
<tr><td width="50%"><code>invalid-escaped-character</code></td><td width="50%">Invalid escaped character</td></tr>
<tr><td width="50%"><code>open-paren-expected</code></td><td width="50%">’(’ expected</td></tr>
<tr><td width="50%"><code>invalid-token</code></td><td width="50%">Invalid token</td></tr>
<tr><td width="50%"><code>invalid-sharp-bang-name</code></td><td width="50%">Invalid ’#!’ name</td></tr>
<tr><td width="50%"><code>duplicate-label-definition</code></td><td width="50%">Duplicate definition for label</td></tr>
<tr><td width="50%"><code>missing-label-definition</code></td><td width="50%">Missing definition for label</td></tr>
<tr><td width="50%"><code>illegal-label-definition</code></td><td width="50%">Illegal definition of label</td></tr>
<tr><td width="50%"><code>invalid-infix-syntax-character</code></td><td width="50%">Invalid infix syntax character</td></tr>
<tr><td width="50%"><code>invalid-infix-syntax-number</code></td><td width="50%">Invalid infix syntax number</td></tr>
<tr><td width="50%"><code>invalid-infix-syntax</code></td><td width="50%">Invalid infix syntax</td></tr>
</table>
<p>The procedure <code>datum-parsing-exception-parameters</code> returns a list
of the parameters associated with the parsing error that was
encountered by the reader when it raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (datum-parsing-exception? exc)
(list (datum-parsing-exception-kind exc)
(datum-parsing-exception-parameters exc))
'not-datum-parsing-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(with-input-from-string "(s #\\pace)" read)))</b>
(invalid-character-name ("pace"))
</pre></td></tr></table>
<hr size="6">
<a name="Exception-objects-related-to-evaluation-and-compilation"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exception-objects-related-to-the-reader" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exception-objects-related-to-type-checking" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exception-objects-related-to-evaluation-and-compilation-1"></a>
<h2 class="section">15.7 Exception objects related to evaluation and compilation</h2>
<a name="Definition_of_expression-parsing-exception?"></a><a name="Procedure_expression-parsing-exception?"></a><a name="index-expression_002dparsing_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_expression-parsing-exception?">expression-parsing-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_expression-parsing-exception-kind"></a><a name="Procedure_expression-parsing-exception-kind"></a><a name="index-expression_002dparsing_002dexception_002dkind"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_expression-parsing-exception-kind">expression-parsing-exception-kind</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_expression-parsing-exception-parameters"></a><a name="Procedure_expression-parsing-exception-parameters"></a><a name="index-expression_002dparsing_002dexception_002dparameters"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_expression-parsing-exception-parameters">expression-parsing-exception-parameters</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_expression-parsing-exception-source"></a><a name="Procedure_expression-parsing-exception-source"></a><a name="index-expression_002dparsing_002dexception_002dsource"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_expression-parsing-exception-source">expression-parsing-exception-source</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Expression-parsing-exception objects are raised by the evaluator and
compiler (i.e. the procedures <code>eval</code>, <code>compile-file</code>, etc)
when the input does not conform to the grammar for expression. The
parameter <var>exc</var> must be a expression-parsing-exception object.
</p>
<p>The procedure <code>expression-parsing-exception?</code> returns <code>#t</code> when
<var>obj</var> is a expression-parsing-exception object and <code>#f</code>
otherwise.
</p>
<p>The procedure <code>expression-parsing-exception-kind</code> returns a
symbol denoting the kind of parsing error that was encountered by the
evaluator or compiler when it raised <var>exc</var>. Here is a table of
the possible return values:
</p>
<table>
<tr><td width="50%"><code>id-expected</code></td><td width="50%">Identifier expected</td></tr>
<tr><td width="50%"><code>ill-formed-namespace</code></td><td width="50%">Ill-formed namespace</td></tr>
<tr><td width="50%"><code>ill-formed-namespace-prefix</code></td><td width="50%">Ill-formed namespace prefix</td></tr>
<tr><td width="50%"><code>namespace-prefix-must-be-string</code></td><td width="50%">Namespace prefix must be a string</td></tr>
<tr><td width="50%"><code>macro-used-as-variable</code></td><td width="50%">Macro name can’t be used as a variable</td></tr>
<tr><td width="50%"><code>variable-is-immutable</code></td><td width="50%">Variable is immutable</td></tr>
<tr><td width="50%"><code>ill-formed-macro-transformer</code></td><td width="50%">Macro transformer must be a lambda expression</td></tr>
<tr><td width="50%"><code>reserved-used-as-variable</code></td><td width="50%">Reserved identifier can’t be used as a variable</td></tr>
<tr><td width="50%"><code>ill-formed-special-form</code></td><td width="50%">Ill-formed special form</td></tr>
<tr><td width="50%"><code>cannot-open-file</code></td><td width="50%">Can’t open file</td></tr>
<tr><td width="50%"><code>filename-expected</code></td><td width="50%">Filename expected</td></tr>
<tr><td width="50%"><code>ill-placed-define</code></td><td width="50%">Ill-placed ’define’</td></tr>
<tr><td width="50%"><code>ill-placed-**include</code></td><td width="50%">Ill-placed ’##include’</td></tr>
<tr><td width="50%"><code>ill-placed-**define-macro</code></td><td width="50%">Ill-placed ’##define-macro’</td></tr>
<tr><td width="50%"><code>ill-placed-**declare</code></td><td width="50%">Ill-placed ’##declare’</td></tr>
<tr><td width="50%"><code>ill-placed-**namespace</code></td><td width="50%">Ill-placed ’##namespace’</td></tr>
<tr><td width="50%"><code>ill-formed-expression</code></td><td width="50%">Ill-formed expression</td></tr>
<tr><td width="50%"><code>unsupported-special-form</code></td><td width="50%">Interpreter does not support</td></tr>
<tr><td width="50%"><code>ill-placed-unquote</code></td><td width="50%">Ill-placed ’unquote’</td></tr>
<tr><td width="50%"><code>ill-placed-unquote-splicing</code></td><td width="50%">Ill-placed ’unquote-splicing’</td></tr>
<tr><td width="50%"><code>parameter-must-be-id</code></td><td width="50%">Parameter must be an identifier</td></tr>
<tr><td width="50%"><code>parameter-must-be-id-or-default</code></td><td width="50%">Parameter must be an identifier or default binding</td></tr>
<tr><td width="50%"><code>duplicate-parameter</code></td><td width="50%">Duplicate parameter in parameter list</td></tr>
<tr><td width="50%"><code>ill-placed-dotted-rest-parameter</code></td><td width="50%">Ill-placed dotted rest parameter</td></tr>
<tr><td width="50%"><code>parameter-expected-after-rest</code></td><td width="50%">#!rest must be followed by a parameter</td></tr>
<tr><td width="50%"><code>ill-formed-default</code></td><td width="50%">Ill-formed default binding</td></tr>
<tr><td width="50%"><code>ill-placed-optional</code></td><td width="50%">Ill-placed #!optional</td></tr>
<tr><td width="50%"><code>ill-placed-rest</code></td><td width="50%">Ill-placed #!rest</td></tr>
<tr><td width="50%"><code>ill-placed-key</code></td><td width="50%">Ill-placed #!key</td></tr>
<tr><td width="50%"><code>key-expected-after-rest</code></td><td width="50%">#!key expected after rest parameter</td></tr>
<tr><td width="50%"><code>ill-placed-default</code></td><td width="50%">Ill-placed default binding</td></tr>
<tr><td width="50%"><code>duplicate-variable-definition</code></td><td width="50%">Duplicate definition of a variable</td></tr>
<tr><td width="50%"><code>empty-body</code></td><td width="50%">Body must contain at least one expression</td></tr>
<tr><td width="50%"><code>variable-must-be-id</code></td><td width="50%">Defined variable must be an identifier</td></tr>
<tr><td width="50%"><code>else-clause-not-last</code></td><td width="50%">Else clause must be last</td></tr>
<tr><td width="50%"><code>ill-formed-selector-list</code></td><td width="50%">Ill-formed selector list</td></tr>
<tr><td width="50%"><code>duplicate-variable-binding</code></td><td width="50%">Duplicate variable in bindings</td></tr>
<tr><td width="50%"><code>ill-formed-binding-list</code></td><td width="50%">Ill-formed binding list</td></tr>
<tr><td width="50%"><code>ill-formed-call</code></td><td width="50%">Ill-formed procedure call</td></tr>
<tr><td width="50%"><code>ill-formed-cond-expand</code></td><td width="50%">Ill-formed ’cond-expand’</td></tr>
<tr><td width="50%"><code>unfulfilled-cond-expand</code></td><td width="50%">Unfulfilled ’cond-expand’</td></tr>
</table>
<p>The procedure <code>expression-parsing-exception-parameters</code> returns a list
of the parameters associated with the parsing error that was
encountered by the evaluator or compiler when it raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (expression-parsing-exception? exc)
(list (expression-parsing-exception-kind exc)
(expression-parsing-exception-parameters exc))
'not-expression-parsing-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(eval '(+ do 1))))</b>
(reserved-used-as-variable (do))
</pre></td></tr></table>
<a name="Definition_of_unbound-global-exception?"></a><a name="Procedure_unbound-global-exception?"></a><a name="index-unbound_002dglobal_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-global-exception?">unbound-global-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbound-global-exception-variable"></a><a name="Procedure_unbound-global-exception-variable"></a><a name="index-unbound_002dglobal_002dexception_002dvariable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-global-exception-variable">unbound-global-exception-variable</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbound-global-exception-code"></a><a name="Procedure_unbound-global-exception-code"></a><a name="index-unbound_002dglobal_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-global-exception-code">unbound-global-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unbound-global-exception-rte"></a><a name="Procedure_unbound-global-exception-rte"></a><a name="index-unbound_002dglobal_002dexception_002drte"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbound-global-exception-rte">unbound-global-exception-rte</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Unbound-global-exception objects are raised when an unbound global
variable is accessed. The parameter <var>exc</var> must be an
unbound-global-exception object.
</p>
<p>The procedure <code>unbound-global-exception?</code> returns
<code>#t</code> when <var>obj</var> is an unbound-global-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>unbound-global-exception-variable</code> returns a
symbol identifying the unbound global variable.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (unbound-global-exception? exc)
(list 'variable= (unbound-global-exception-variable exc))
'not-unbound-global-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () foo))</b>
(variable= foo)
</pre></td></tr></table>
<hr size="6">
<a name="Exception-objects-related-to-type-checking"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exception-objects-related-to-evaluation-and-compilation" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Exception-objects-related-to-procedure-call" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exception-objects-related-to-type-checking-1"></a>
<h2 class="section">15.8 Exception objects related to type checking</h2>
<a name="Definition_of_type-exception?"></a><a name="Procedure_type-exception?"></a><a name="index-type_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_type-exception?">type-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_type-exception-procedure"></a><a name="Procedure_type-exception-procedure"></a><a name="index-type_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_type-exception-procedure">type-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_type-exception-arguments"></a><a name="Procedure_type-exception-arguments"></a><a name="index-type_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_type-exception-arguments">type-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_type-exception-arg-num"></a><a name="Procedure_type-exception-arg-num"></a><a name="index-type_002dexception_002darg_002dnum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_type-exception-arg-num">type-exception-arg-num</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_type-exception-type-id"></a><a name="Procedure_type-exception-type-id"></a><a name="index-type_002dexception_002dtype_002did"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_type-exception-type-id">type-exception-type-id</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Type-exception objects are raised when a primitive procedure is called
with an argument of incorrect type (i.e. when a run time type-check
fails). The parameter <var>exc</var> must be a type-exception object.
</p>
<p>The procedure <code>type-exception?</code> returns
<code>#t</code> when <var>obj</var> is a type-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>type-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>type-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>type-exception-arg-num</code> returns the position of the
argument whose type is incorrect. Position 1 is the first argument.
</p>
<p>The procedure <code>type-exception-type-id</code> returns an identifier of
the type expected. The type-id can be a symbol, such as <code>number</code>
and <code>string-or-nonnegative-fixnum</code>, or a record type descriptor.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (type-exception? exc)
(list (type-exception-procedure exc)
(type-exception-arguments exc)
(type-exception-arg-num exc)
(type-exception-type-id exc))
'not-type-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (vector-ref '#(a b c) 'foo)))</b>
(#<procedure #2 vector-ref> (#(a b c) foo) 2 exact-integer)
> <b>(with-exception-catcher
handler
(lambda () (time->seconds 'foo)))</b>
(#<procedure #3 time->seconds> (foo) 1 #<type #4 time>)
</pre></td></tr></table>
<a name="Definition_of_range-exception?"></a><a name="Procedure_range-exception?"></a><a name="index-range_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_range-exception?">range-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_range-exception-procedure"></a><a name="Procedure_range-exception-procedure"></a><a name="index-range_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_range-exception-procedure">range-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_range-exception-arguments"></a><a name="Procedure_range-exception-arguments"></a><a name="index-range_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_range-exception-arguments">range-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_range-exception-arg-num"></a><a name="Procedure_range-exception-arg-num"></a><a name="index-range_002dexception_002darg_002dnum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_range-exception-arg-num">range-exception-arg-num</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Range-exception objects are raised when a numeric parameter is not in
the allowed range. The parameter <var>exc</var> must be a range-exception
object.
</p>
<p>The procedure <code>range-exception?</code> returns <code>#t</code> when <var>obj</var>
is a range-exception object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>range-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>range-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>range-exception-arg-num</code> returns the position of
the argument which is not in the allowed range. Position 1 is the
first argument.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (range-exception? exc)
(list (range-exception-procedure exc)
(range-exception-arguments exc)
(range-exception-arg-num exc))
'not-range-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (string-ref "abcde" 10)))</b>
(#<procedure #2 string-ref> ("abcde" 10) 2)
</pre></td></tr></table>
<a name="Definition_of_divide-by-zero-exception?"></a><a name="Procedure_divide-by-zero-exception?"></a><a name="index-divide_002dby_002dzero_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_divide-by-zero-exception?">divide-by-zero-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_divide-by-zero-exception-procedure"></a><a name="Procedure_divide-by-zero-exception-procedure"></a><a name="index-divide_002dby_002dzero_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_divide-by-zero-exception-procedure">divide-by-zero-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_divide-by-zero-exception-arguments"></a><a name="Procedure_divide-by-zero-exception-arguments"></a><a name="index-divide_002dby_002dzero_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_divide-by-zero-exception-arguments">divide-by-zero-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Divide-by-zero-exception objects are raised when a division by zero is
attempted. The parameter <var>exc</var> must be a divide-by-zero-exception
object.
</p>
<p>The procedure <code>divide-by-zero-exception?</code> returns
<code>#t</code> when <var>obj</var> is a divide-by-zero-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>divide-by-zero-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>divide-by-zero-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (divide-by-zero-exception? exc)
(list (divide-by-zero-exception-procedure exc)
(divide-by-zero-exception-arguments exc))
'not-divide-by-zero-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (/ 5 0 7)))</b>
(#<procedure #2 /> (5 0 7))
</pre></td></tr></table>
<a name="Definition_of_improper-length-list-exception?"></a><a name="Procedure_improper-length-list-exception?"></a><a name="index-improper_002dlength_002dlist_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_improper-length-list-exception?">improper-length-list-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_improper-length-list-exception-procedure"></a><a name="Procedure_improper-length-list-exception-procedure"></a><a name="index-improper_002dlength_002dlist_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_improper-length-list-exception-procedure">improper-length-list-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_improper-length-list-exception-arguments"></a><a name="Procedure_improper-length-list-exception-arguments"></a><a name="index-improper_002dlength_002dlist_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_improper-length-list-exception-arguments">improper-length-list-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_improper-length-list-exception-arg-num"></a><a name="Procedure_improper-length-list-exception-arg-num"></a><a name="index-improper_002dlength_002dlist_002dexception_002darg_002dnum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_improper-length-list-exception-arg-num">improper-length-list-exception-arg-num</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Improper-length-list-exception objects are raised by the <code>map</code>
and <code>for-each</code> procedures when they are called with two or more
list arguments and the lists are not of the same length. The
parameter <var>exc</var> must be an improper-length-list-exception object.
</p>
<p>The procedure <code>improper-length-list-exception?</code> returns
<code>#t</code> when <var>obj</var> is an improper-length-list-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>improper-length-list-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>improper-length-list-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>improper-length-list-exception-arg-num</code> returns
the position of the argument whose length is the shortest. Position 1
is the first argument.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (improper-length-list-exception? exc)
(list (improper-length-list-exception-procedure exc)
(improper-length-list-exception-arguments exc)
(improper-length-list-exception-arg-num exc))
'not-improper-length-list-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (map + '(1 2) '(3) '(4 5))))</b>
(#<procedure #2 map> (#<procedure #3 +> (1 2) (3) (4 5)) 3)
</pre></td></tr></table>
<hr size="6">
<a name="Exception-objects-related-to-procedure-call"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exception-objects-related-to-type-checking" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Other-exception-objects" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Exception-objects-related-to-procedure-call-1"></a>
<h2 class="section">15.9 Exception objects related to procedure call</h2>
<a name="Definition_of_wrong-number-of-arguments-exception?"></a><a name="Procedure_wrong-number-of-arguments-exception?"></a><a name="index-wrong_002dnumber_002dof_002darguments_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_wrong-number-of-arguments-exception?">wrong-number-of-arguments-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_wrong-number-of-arguments-exception-procedure"></a><a name="Procedure_wrong-number-of-arguments-exception-procedure"></a><a name="index-wrong_002dnumber_002dof_002darguments_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_wrong-number-of-arguments-exception-procedure">wrong-number-of-arguments-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_wrong-number-of-arguments-exception-arguments"></a><a name="Procedure_wrong-number-of-arguments-exception-arguments"></a><a name="index-wrong_002dnumber_002dof_002darguments_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_wrong-number-of-arguments-exception-arguments">wrong-number-of-arguments-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Wrong-number-of-arguments-exception objects are raised when a
procedure is called with the wrong number of arguments. The parameter
<var>exc</var> must be a wrong-number-of-arguments-exception object.
</p>
<p>The procedure <code>wrong-number-of-arguments-exception?</code> returns
<code>#t</code> when <var>obj</var> is a wrong-number-of-arguments-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>wrong-number-of-arguments-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>wrong-number-of-arguments-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (wrong-number-of-arguments-exception? exc)
(list (wrong-number-of-arguments-exception-procedure exc)
(wrong-number-of-arguments-exception-arguments exc))
'not-wrong-number-of-arguments-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (open-input-file "data" 99)))</b>
(#<procedure #2 open-input-file> ("data" 99))
</pre></td></tr></table>
<a name="Definition_of_number-of-arguments-limit-exception?"></a><a name="Procedure_number-of-arguments-limit-exception?"></a><a name="index-number_002dof_002darguments_002dlimit_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_number-of-arguments-limit-exception?">number-of-arguments-limit-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_number-of-arguments-limit-exception-procedure"></a><a name="Procedure_number-of-arguments-limit-exception-procedure"></a><a name="index-number_002dof_002darguments_002dlimit_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_number-of-arguments-limit-exception-procedure">number-of-arguments-limit-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_number-of-arguments-limit-exception-arguments"></a><a name="Procedure_number-of-arguments-limit-exception-arguments"></a><a name="index-number_002dof_002darguments_002dlimit_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_number-of-arguments-limit-exception-arguments">number-of-arguments-limit-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Number-of-arguments-limit-exception objects are raised by the
<code>apply</code> procedure when the procedure being called is passed more
than 8192 arguments. The parameter <var>exc</var> must be a
number-of-arguments-limit-exception object.
</p>
<p>The procedure <code>number-of-arguments-limit-exception?</code> returns
<code>#t</code> when <var>obj</var> is a number-of-arguments-limit-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>number-of-arguments-limit-exception-procedure</code>
returns the target procedure of the call to <code>apply</code> that raised
<var>exc</var>.
</p>
<p>The procedure <code>number-of-arguments-limit-exception-arguments</code>
returns the list of arguments of the target procedure of the call to
<code>apply</code> that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (iota n) (if (= n 0) '() (cons n (iota (- n 1)))))</b>
> <b>(define (handler exc)
(if (number-of-arguments-limit-exception? exc)
(list (number-of-arguments-limit-exception-procedure exc)
(length (number-of-arguments-limit-exception-arguments exc)))
'not-number-of-arguments-limit-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (apply + 1 2 3 (iota 8190))))</b>
(#<procedure #2 +> 8193)
</pre></td></tr></table>
<a name="Definition_of_nonprocedure-operator-exception?"></a><a name="Procedure_nonprocedure-operator-exception?"></a><a name="index-nonprocedure_002doperator_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception?">nonprocedure-operator-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_nonprocedure-operator-exception-operator"></a><a name="Procedure_nonprocedure-operator-exception-operator"></a><a name="index-nonprocedure_002doperator_002dexception_002doperator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception-operator">nonprocedure-operator-exception-operator</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_nonprocedure-operator-exception-arguments"></a><a name="Procedure_nonprocedure-operator-exception-arguments"></a><a name="index-nonprocedure_002doperator_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception-arguments">nonprocedure-operator-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_nonprocedure-operator-exception-code"></a><a name="Procedure_nonprocedure-operator-exception-code"></a><a name="index-nonprocedure_002doperator_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception-code">nonprocedure-operator-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_nonprocedure-operator-exception-rte"></a><a name="Procedure_nonprocedure-operator-exception-rte"></a><a name="index-nonprocedure_002doperator_002dexception_002drte"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception-rte">nonprocedure-operator-exception-rte</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Nonprocedure-operator-exception objects are raised when a procedure
call is executed and the operator position is not a procedure. The
parameter <var>exc</var> must be an nonprocedure-operator-exception object.
</p>
<p>The procedure <code>nonprocedure-operator-exception?</code> returns
<code>#t</code> when <var>obj</var> is an nonprocedure-operator-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>nonprocedure-operator-exception-operator</code> returns
the value in operator position of the procedure call that raised
<var>exc</var>.
</p>
<p>The procedure <code>nonprocedure-operator-exception-arguments</code> returns
the list of arguments of the procedure call that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (nonprocedure-operator-exception? exc)
(list (nonprocedure-operator-exception-operator exc)
(nonprocedure-operator-exception-arguments exc))
'not-nonprocedure-operator-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (11 22 33)))</b>
(11 (22 33))
</pre></td></tr></table>
<a name="Definition_of_unknown-keyword-argument-exception?"></a><a name="Procedure_unknown-keyword-argument-exception?"></a><a name="index-unknown_002dkeyword_002dargument_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unknown-keyword-argument-exception?">unknown-keyword-argument-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unknown-keyword-argument-exception-procedure"></a><a name="Procedure_unknown-keyword-argument-exception-procedure"></a><a name="index-unknown_002dkeyword_002dargument_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unknown-keyword-argument-exception-procedure">unknown-keyword-argument-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unknown-keyword-argument-exception-arguments"></a><a name="Procedure_unknown-keyword-argument-exception-arguments"></a><a name="index-unknown_002dkeyword_002dargument_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unknown-keyword-argument-exception-arguments">unknown-keyword-argument-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Unknown-keyword-argument-exception objects are raised when a procedure
accepting keyword arguments is called and one of the keywords supplied
is not among those that are expected. The parameter <var>exc</var> must be
an unknown-keyword-argument-exception object.
</p>
<p>The procedure <code>unknown-keyword-argument-exception?</code> returns
<code>#t</code> when <var>obj</var> is an unknown-keyword-argument-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>unknown-keyword-argument-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>unknown-keyword-argument-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (unknown-keyword-argument-exception? exc)
(list (unknown-keyword-argument-exception-procedure exc)
(unknown-keyword-argument-exception-arguments exc))
'not-unknown-keyword-argument-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () ((lambda (#!key (foo 5)) foo) bar: 11)))</b>
(#<procedure #2> (bar: 11))
</pre></td></tr></table>
<a name="Definition_of_keyword-expected-exception?"></a><a name="Procedure_keyword-expected-exception?"></a><a name="index-keyword_002dexpected_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_keyword-expected-exception?">keyword-expected-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_keyword-expected-exception-procedure"></a><a name="Procedure_keyword-expected-exception-procedure"></a><a name="index-keyword_002dexpected_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_keyword-expected-exception-procedure">keyword-expected-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_keyword-expected-exception-arguments"></a><a name="Procedure_keyword-expected-exception-arguments"></a><a name="index-keyword_002dexpected_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_keyword-expected-exception-arguments">keyword-expected-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Keyword-expected-exception objects are raised when a procedure
accepting keyword arguments is called and a nonkeyword was supplied
where a keyword was expected. The parameter <var>exc</var> must be an
keyword-expected-exception object.
</p>
<p>The procedure <code>keyword-expected-exception?</code> returns
<code>#t</code> when <var>obj</var> is an keyword-expected-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>keyword-expected-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>keyword-expected-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (keyword-expected-exception? exc)
(list (keyword-expected-exception-procedure exc)
(keyword-expected-exception-arguments exc))
'not-keyword-expected-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () ((lambda (#!key (foo 5)) foo) 11 22)))</b>
(#<procedure #2> (11 22))
</pre></td></tr></table>
<hr size="6">
<a name="Other-exception-objects"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Exception-objects-related-to-procedure-call" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Other-exception-objects-1"></a>
<h2 class="section">15.10 Other exception objects</h2>
<a name="Definition_of_error-exception?"></a><a name="Procedure_error-exception?"></a><a name="index-error_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_error-exception?">error-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_error-exception-message"></a><a name="Procedure_error-exception-message"></a><a name="index-error_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_error-exception-message">error-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_error-exception-parameters"></a><a name="Procedure_error-exception-parameters"></a><a name="index-error_002dexception_002dparameters"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_error-exception-parameters">error-exception-parameters</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_error"></a><a name="Procedure_error"></a><a name="index-error"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_error">error</a></b></code><i> <var>message</var> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Error-exception objects are raised when the <code>error</code> procedure is
called. The parameter <var>exc</var> must be an error-exception
object.
</p>
<p>The procedure <code>error-exception?</code> returns
<code>#t</code> when <var>obj</var> is an error-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>error-exception-message</code> returns the first
argument of the call to <code>error</code> that raised <var>exc</var>.
</p>
<p>The procedure <code>error-exception-parameters</code> returns the list of
arguments, starting with the second argument, of the call to
<code>error</code> that raised <var>exc</var>.
</p>
<p>The <code>error</code> procedure raises an error-exception object whose
message field is <var>message</var> and parameters field is the list of
values <var>obj</var>….
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (error-exception? exc)
(list (error-exception-message exc)
(error-exception-parameters exc))
'not-error-exception))</b>
> <b>(with-exception-catcher
handler
(lambda () (error "unexpected object:" 123)))</b>
("unexpected object:" (123))
</pre></td></tr></table>
<hr size="6">
<a name="Host-environment"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Other-exception-objects" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Handling-of-file-names" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Exceptions" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Host-environment-1"></a>
<h1 class="chapter">16. Host environment</h1>
<p>The host environment is the set of resources, such as the filesystem,
network and processes, that are managed by the operating system within
which the Scheme program is executing. This chapter specifies how the
host environment can be accessed from within the Scheme program.
</p>
<p>In this chapter we say that the Scheme program being executed is a
process, even though the concept of process does not exist in some
operating systems supported by Gambit (e.g. MSDOS).
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Shell-command-execution">16.3 Shell command execution</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Process-termination">16.4 Process termination</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Command-line-arguments">16.5 Command line arguments</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Environment-variables">16.6 Environment variables</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#File-information">16.8 File information</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Group-information">16.9 Group information</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#User-information">16.10 User information</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Host-information">16.11 Host information</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Service-information">16.12 Service information</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Network-information">16.14 Network information</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Handling-of-file-names"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Host-environment" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Filesystem-operations" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Handling-of-file-names-1"></a>
<h2 class="section">16.1 Handling of file names</h2>
<a name="index-file-names"></a>
<a name="index-current-working-directory"></a>
<a name="index-absolute-path"></a>
<a name="index-relative-path"></a>
<a name="index-home-directory"></a>
<a name="index-central-installation-directory"></a>
<a name="index-installation-directories"></a>
<p>Gambit uses a naming convention for files that is compatible with
the one used by the host environment but extended to allow
referring to the <em>home directory</em> of the current user or some
specific user and the <em>installation directories</em>.
</p>
<p>A <em>path</em> is a string that denotes a file, for example
<code>"src/readme.txt"</code>. Each component of a path is separated by a
‘<samp>/</samp>’ under UNIX and Mac OS X and by a ‘<samp>/</samp>’ or ‘<samp>\</samp>’ under
MSDOS and Microsoft Windows. A leading separator indicates an
absolute path under UNIX, Mac OS X, MSDOS and Microsoft Windows. A
path which does not contain a path separator is relative to the
<em>current working directory</em> on all operating systems. A volume
specifier such as ‘<samp>C:</samp>’ may prefix a file name under MSDOS and
Microsoft Windows.
</p>
<a name="index-_007e_007e"></a>
<p>A path which starts with the characters ‘<samp>~~</samp>’ denotes a file in an
installation directory. If nothing follows the ‘<samp>~~</samp>’ then the
directory denoted is the central installation directory. Otherwise
what follows the ‘<samp>~~</samp>’ is the name of the installation directory,
for example ‘<samp>~~lib</samp>’ denotes the ‘<samp>lib</samp>’ installation
directory. Note that the location of the installation directories may
be overridden by using the ‘<samp>-:=<var>DIRECTORY</var></samp>’ and
‘<samp>-:~~<var>DIR</var>=<var>DIRECTORY</var></samp>’ runtime options or by defining
the ‘<samp>GAMBOPT</samp>’ environment variable.
</p>
<a name="index-_007e"></a>
<p>A path which starts with the character ‘<samp>~</samp>’ not followed by
‘<samp>~</samp>’ denotes a file in the user’s home directory. The user’s home
directory is contained in the ‘<samp>HOME</samp>’ environment variable under
UNIX, Mac OS X, MSDOS and Microsoft Windows. Under MSDOS and
Microsoft Windows, if the ‘<samp>HOME</samp>’ environment variable is not
defined, the environment variables ‘<samp>HOMEDRIVE</samp>’ and
‘<samp>HOMEPATH</samp>’ are concatenated if they are defined. If this fails
to yield a home directory, the central installation directory is used
instead.
</p>
<a name="index-_007eusername"></a>
<p>A path which starts with the characters ‘<samp>~<var>username</var></samp>’
denotes a file in the home directory of the given user. Under UNIX
and Mac OS X this is found using the password file. There is no
equivalent under MSDOS and Microsoft Windows.
</p>
<a name="Definition_of_current-directory"></a><a name="Procedure_current-directory"></a><a name="index-current_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-directory">current-directory</a></b></code><i> <span class="roman">[</span><var>new-current-directory</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-current-working-directory-1"></a>
<p>The parameter object <code>current-directory</code> is bound to the current
working directory. Calling this procedure with no argument returns
the absolute <em>normalized path</em> of the directory and calling this
procedure with one argument sets the directory to
<var>new-current-directory</var>. The initial binding of this parameter
object is the current working directory of the current process. The
path returned by <code>current-directory</code> always contains a trailing
directory separator. Modifications of the parameter object do not
change the current working directory of the current process (i.e.
that is accessible with the UNIX <code>getcwd()</code> function and the
Microsoft Windows <code>GetCurrentDirectory</code> function). It is an
error to mutate the string returned by <code>current-directory</code>.
</p>
<p>For example under UNIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(current-directory)</b>
"/Users/feeley/gambit/doc/"
> <b>(current-directory "..")</b>
> <b>(current-directory)</b>
"/Users/feeley/gambit/"
> <b>(path-expand "foo" "~~")</b>
"/usr/local/Gambit/foo"
> <b>(parameterize ((current-directory "~~")) (path-expand "foo"))</b>
"/usr/local/Gambit/foo"
</pre></td></tr></table>
<a name="Definition_of_path-expand"></a><a name="Procedure_path-expand"></a><a name="index-path_002dexpand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_path-expand">path-expand</a></b></code><i> <var>path</var> <span class="roman">[</span><var>origin-directory</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-absolute-path-1"></a>
<a name="index-relative-path-1"></a>
<p>The procedure <code>path-expand</code> takes the path of a file or directory
and returns an expanded path, which is an absolute path when
<var>path</var> or <var>origin-directory</var> are absolute paths.
The optional <var>origin-directory</var> parameter, which defaults
to the current working directory, is the directory used to resolve
relative paths. Components of the paths <var>path</var> and
<var>origin-directory</var> need not exist.
</p>
<p>For example under UNIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(path-expand "foo")</b>
"/Users/feeley/gambit/doc/foo"
> <b>(path-expand "~/foo")</b>
"/Users/feeley/foo"
> <b>(path-expand "~~lib/foo")</b>
"/usr/local/Gambit/lib/foo"
> <b>(path-expand "../foo")</b>
"/Users/feeley/gambit/doc/../foo"
> <b>(path-expand "foo" "")</b>
"foo"
> <b>(path-expand "foo" "/tmp")</b>
"/tmp/foo"
> <b>(path-expand "this/file/does/not/exist")</b>
"/Users/feeley/gambit/doc/this/file/does/not/exist"
> <b>(path-expand "")</b>
"/Users/feeley/gambit/doc/"
</pre></td></tr></table>
<a name="Definition_of_path-normalize"></a><a name="Procedure_path-normalize"></a><a name="index-path_002dnormalize"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_path-normalize">path-normalize</a></b></code><i> <var>path</var> <span class="roman">[</span><var>allow-relative?</var> <span class="roman">[</span><var>origin-directory</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-normalized-path"></a>
<p>The procedure <code>path-normalize</code> takes a path of a file or
directory and returns its normalized path. The optional
<var>origin-directory</var> parameter, which defaults to the current
working directory, is the directory used to resolve relative paths.
All components of the paths <var>path</var> and
<var>origin-directory</var> must exist, except possibly the last
component of <var>path</var>. A normalized path is a path
containing no redundant parts and which is consistent with the current
structure of the filesystem. A normalized path of a directory will
always end with a path separator (i.e. ‘<samp>/</samp>’, ‘<samp>\</samp>’, or ‘<samp>:</samp>’
depending on the operating system). The optional
<var>allow-relative?</var> parameter, which defaults to <code>#f</code>,
indicates if the path returned can be expressed relatively to
<var>origin-directory</var>: a <code>#f</code> requests an absolute path,
the symbol <code>shortest</code> requests the shortest of the absolute and
relative paths, and any other value requests the relative path. The
shortest path is useful for interaction with the user because short
relative paths are typically easier to read than long absolute paths.
</p>
<p>For example under UNIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(path-expand "../foo")</b>
"/Users/feeley/gambit/doc/../foo"
> <b>(path-normalize "../foo")</b>
"/Users/feeley/gambit/foo"
> <b>(path-normalize "this/file/does/not/exist")</b>
*** ERROR IN (console)@3.1 -- No such file or directory
(path-normalize "this/file/does/not/exist")
</pre></td></tr></table>
<a name="Definition_of_path-extension"></a><a name="Procedure_path-extension"></a><a name="index-path_002dextension"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_path-extension">path-extension</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_path-strip-extension"></a><a name="Procedure_path-strip-extension"></a><a name="index-path_002dstrip_002dextension"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_path-strip-extension">path-strip-extension</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_path-directory"></a><a name="Procedure_path-directory"></a><a name="index-path_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_path-directory">path-directory</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_path-strip-directory"></a><a name="Procedure_path-strip-directory"></a><a name="index-path_002dstrip_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_path-strip-directory">path-strip-directory</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_path-strip-trailing-directory-separator"></a><a name="Procedure_path-strip-trailing-directory-separator"></a><a name="index-path_002dstrip_002dtrailing_002ddirectory_002dseparator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_path-strip-trailing-directory-separator">path-strip-trailing-directory-separator</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_path-volume"></a><a name="Procedure_path-volume"></a><a name="index-path_002dvolume"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_path-volume">path-volume</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_path-strip-volume"></a><a name="Procedure_path-strip-volume"></a><a name="index-path_002dstrip_002dvolume"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_path-strip-volume">path-strip-volume</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures extract various parts of a path, which need not be a
normalized path. The procedure <code>path-extension</code> returns the file
extension (including the period) or the empty string if there is no
extension. The procedure <code>path-strip-extension</code> returns the path
with the extension stripped off. The procedure <code>path-directory</code>
returns the file’s directory (including the last path separator) or
the empty string if no directory is specified in the path. The
procedure <code>path-strip-directory</code> returns the path with the
directory stripped off. The procedure
<code>path-strip-trailing-directory-separator</code> returns the path with
the directory separator stripped off if one is at the end of the path.
The procedure <code>path-volume</code> returns the file’s volume (including
the last path separator) or the empty string if no volume is specified
in the path. The procedure <code>path-strip-volume</code> returns the path
with the volume stripped off.
</p>
<p>For example under UNIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(path-extension "/tmp/foo")</b>
""
> <b>(path-extension "/tmp/foo.txt")</b>
".txt"
> <b>(path-strip-extension "/tmp/foo.txt")</b>
"/tmp/foo"
> <b>(path-directory "/tmp/foo.txt")</b>
"/tmp/"
> <b>(path-strip-directory "/tmp/foo.txt")</b>
"foo.txt"
> <b>(path-strip-trailing-directory-separator "/usr/local/bin/")</b>
"/usr/local/bin"
> <b>(path-strip-trailing-directory-separator "/usr/local/bin")</b>
"/usr/local/bin"
> <b>(path-volume "/tmp/foo.txt")</b>
""
> <b>(path-volume "C:/tmp/foo.txt")</b>
"" <span class="roman"><i>; result is</i></span> "C:" <span class="roman"><i>under Microsoft Windows</i></span>
> <b>(path-strip-volume "C:/tmp/foo.txt")</b>
"C:/tmp/foo.txt" <span class="roman"><i>; result is</i></span> "/tmp/foo.txt" <span class="roman"><i>under Microsoft Windows</i></span>
</pre></td></tr></table>
<hr size="6">
<a name="Filesystem-operations"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Handling-of-file-names" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Shell-command-execution" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Filesystem-operations-1"></a>
<h2 class="section">16.2 Filesystem operations</h2>
<a name="Definition_of_create-directory"></a><a name="Procedure_create-directory"></a><a name="index-create_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_create-directory">create-directory</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure creates a directory. The argument
<var>path-or-settings</var> is either a string denoting a filesystem path
or a list of port settings which must contain a <code>path:</code> setting.
Here are the settings allowed:
</p>
<ul>
<li>
<code>path:</code> <var>string</var>
<p>This setting indicates the location of the directory to create in the
filesystem. There is no default value for this setting.
</p>
</li><li>
<code>permissions:</code> <var>12-bit-exact-integer</var>
<p>This setting controls the UNIX permissions that will be attached to
the file if it is created. The default value of this setting is
<code>#o777</code>.
</p>
</li></ul>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(create-directory "newdir")</b>
> <b>(create-directory "newdir")</b>
*** ERROR IN (console)@2.1 -- File exists
(create-directory "newdir")
</pre></td></tr></table>
<a name="Definition_of_create-fifo"></a><a name="Procedure_create-fifo"></a><a name="index-create_002dfifo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_create-fifo">create-fifo</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure creates a FIFO. The argument <var>path-or-settings</var> is
either a string denoting a filesystem path or a list of port settings
which must contain a <code>path:</code> setting. Here are the settings
allowed:
</p>
<ul>
<li>
<code>path:</code> <var>string</var>
<p>This setting indicates the location of the FIFO to create in the
filesystem. There is no default value for this setting.
</p>
</li><li>
<code>permissions:</code> <var>12-bit-exact-integer</var>
<p>This setting controls the UNIX permissions that will be attached to
the file if it is created. The default value of this setting is
<code>#o666</code>.
</p>
</li></ul>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(create-fifo "fifo")</b>
> <b>(define a (open-input-file "fifo"))</b>
> <b>(define b (open-output-file "fifo"))</b>
> <b>(display "1 22 333" b)</b>
> <b>(force-output b)</b>
> <b>(read a)</b>
1
> <b>(read a)</b>
22
</pre></td></tr></table>
<a name="Definition_of_create-link"></a><a name="Procedure_create-link"></a><a name="index-create_002dlink"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_create-link">create-link</a></b></code><i> <var>source-path</var> <var>destination-path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure creates a hard link between <var>source-path</var> and
<var>destination-path</var>. The argument <var>source-path</var> must be a
string denoting the path of an existing file. The argument
<var>destination-path</var> must be a string denoting the path of the link
to create.
</p>
<a name="Definition_of_create-symbolic-link"></a><a name="Procedure_create-symbolic-link"></a><a name="index-create_002dsymbolic_002dlink"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_create-symbolic-link">create-symbolic-link</a></b></code><i> <var>source-path</var> <var>destination-path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure creates a symbolic link between <var>source-path</var> and
<var>destination-path</var>. The argument <var>source-path</var> must be a
string denoting the path of an existing file. The argument
<var>destination-path</var> must be a string denoting the path of the
symbolic link to create.
</p>
<a name="Definition_of_rename-file"></a><a name="Procedure_rename-file"></a><a name="index-rename_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_rename-file">rename-file</a></b></code><i> <var>source-path</var> <var>destination-path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure renames the file <var>source-path</var> to
<var>destination-path</var>. The argument <var>source-path</var> must be a
string denoting the path of an existing file. The argument
<var>destination-path</var> must be a string denoting the new path of the
file.
</p>
<a name="Definition_of_copy-file"></a><a name="Procedure_copy-file"></a><a name="index-copy_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_copy-file">copy-file</a></b></code><i> <var>source-path</var> <var>destination-path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure copies the file <var>source-path</var> to
<var>destination-path</var>. The argument <var>source-path</var> must be a
string denoting the path of an existing file. The argument
<var>destination-path</var> must be a string denoting the path of the
file to create.
</p>
<a name="Definition_of_delete-file"></a><a name="Procedure_delete-file"></a><a name="index-delete_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_delete-file">delete-file</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure deletes the file <var>path</var>. The argument <var>path</var>
must be a string denoting the path of an existing file.
</p>
<a name="Definition_of_delete-directory"></a><a name="Procedure_delete-directory"></a><a name="index-delete_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_delete-directory">delete-directory</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure deletes the directory <var>path</var>. The argument
<var>path</var> must be a string denoting the path of an existing
directory.
</p>
<a name="Definition_of_directory-files"></a><a name="Procedure_directory-files"></a><a name="index-directory_002dfiles"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_directory-files">directory-files</a></b></code><i> <span class="roman">[</span><var>path-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the list of the files in a directory. The
argument <var>path-or-settings</var> is either a string denoting a
filesystem path to a directory or a list of settings which must
contain a <code>path:</code> setting. If it is not specified,
<var>path-or-settings</var> defaults to the current directory (the value
bound to the <code>current-directory</code> parameter object). Here are the
settings allowed:
</p>
<ul>
<li>
<code>path:</code> <var>string</var>
<p>This setting indicates the location of the directory in the filesystem.
There is no default value for this setting.
</p>
</li><li>
<code>ignore-hidden:</code> ( <code>#f</code> | <code>#t</code> | <code>dot-and-dot-dot</code> )
<p>This setting controls whether hidden-files will be returned. Under
UNIX and Mac OS X hidden-files are those that start with a period
(such as ‘<samp>.</samp>’, ‘<samp>..</samp>’, and ‘<samp>.profile</samp>’). Under Microsoft
Windows hidden files are the ‘<samp>.</samp>’ and ‘<samp>..</samp>’ entries and the
files whose “hidden file” attribute is set. A setting of <code>#f</code>
will enumerate all the files. A setting of <code>#t</code> will only
enumerate the files that are not hidden. A setting of
<code>dot-and-dot-dot</code> will enumerate all the files except for the
‘<samp>.</samp>’ and ‘<samp>..</samp>’ hidden files. The default value of this
setting is <code>#t</code>.
</p>
</li></ul>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(directory-files)</b>
("complex" "README" "simple")
> <b>(directory-files "../include")</b>
("config.h" "config.h.in" "gambit.h" "makefile" "makefile.in")
> <b>(directory-files (list path: "../include" ignore-hidden: #f))</b>
("." ".." "config.h" "config.h.in" "gambit.h" "makefile" "makefile.in")
</pre></td></tr></table>
<hr size="6">
<a name="Shell-command-execution"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Filesystem-operations" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Process-termination" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Shell-command-execution-1"></a>
<h2 class="section">16.3 Shell command execution</h2>
<a name="Definition_of_shell-command"></a><a name="Procedure_shell-command"></a><a name="index-shell_002dcommand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_shell-command">shell-command</a></b></code><i> <var>command</var> <span class="roman">[</span><var>capture?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>shell-command</code> calls up the shell to execute
<var>command</var> which must be a string. The argument <var>capture?</var>,
which defaults to <code>#f</code>, indicates if the output of the command is
captured as a string. If <var>capture?</var> is <code>#f</code>, this procedure
returns the exit status of the shell in the form that the C library’s
<code>system</code> routine returns. If <var>capture?</var> is not <code>#f</code>,
this procedure returns a pair consisting of the exit status of the
shell in the <code>car</code> field, and the captured output in the
<code>cdr</code> field. Be advised that the shell that is used, and
consequently the syntax of <var>command</var>, depends on the operating
system. On Unix, the shell <code>/bin/sh</code> is usually invoked. On Windows,
the shell <code>cmd.exe</code> is usually invoked.
</p>
<p>For example under UNIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(shell-command "ls -sk f*.scm")</b>
4 fact.scm 4 fib.scm
0
> <b>(shell-command "ls -sk f*.scm" #t)</b>
(0 . "4 fact.scm 4 fib.scm\n")
> <b>(shell-command "echo x\\\\\\\\y $HOME" #t)</b>
(0 . "x\\y /Users/feeley\n")
</pre></td></tr></table>
<p>For example under Windows:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(shell-command "echo x\\\\\\\\y %HOME%" #t)</b>
(0 . "x\\\\\\\\y C:\\Users\\feeley\r\n")
</pre></td></tr></table>
<hr size="6">
<a name="Process-termination"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Shell-command-execution" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Command-line-arguments" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Process-termination-1"></a>
<h2 class="section">16.4 Process termination</h2>
<a name="Definition_of_exit"></a><a name="Procedure_exit"></a><a name="index-exit"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_exit">exit</a></b></code><i> <span class="roman">[</span><var>status</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>exit</code> causes the process to terminate with the
status <var>status</var> which must be an exact integer in the range 0 to
255 or <code>#f</code>. If it is not specified, <var>status</var> defaults to 0.
When <var>status</var> is <code>#f</code> the process terminates with an error status.
</p>
<p>For example under UNIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi</b>
Gambit v4.9.3
> <b>(exit #f)</b>
$ <b>echo $?</b>
70
</pre></td></tr></table>
<hr size="6">
<a name="Command-line-arguments"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Process-termination" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Environment-variables" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Command-line-arguments-1"></a>
<h2 class="section">16.5 Command line arguments</h2>
<a name="Definition_of_command-line"></a><a name="Procedure_command-line"></a><a name="index-command_002dline-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_command-line">command-line</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns a list of strings corresponding to the command
line arguments, including the program file name as the first element
of the list. When the interpreter executes a Scheme script, the list
returned by <code>command-line</code> contains the script’s absolute path
followed by the remaining command line arguments.
</p>
<p>For example under UNIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi -:d -e "(pretty-print (command-line))"</b>
("gsi" "-e" "(pretty-print (command-line))")
$ <b>cat foo</b>
#!/usr/local/Gambit/bin/gsi-script
(pretty-print (command-line))
$ <b>./foo 1 2 "3 4"</b>
("/u/feeley/./foo" "1" "2" "3 4")
</pre></td></tr></table>
<hr size="6">
<a name="Environment-variables"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Command-line-arguments" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Measuring-time" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Environment-variables-1"></a>
<h2 class="section">16.6 Environment variables</h2>
<a name="Definition_of_getenv"></a><a name="Procedure_getenv"></a><a name="index-getenv"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_getenv">getenv</a></b></code><i> <var>name</var> <span class="roman">[</span><var>default</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_setenv"></a><a name="Procedure_setenv"></a><a name="index-setenv"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_setenv">setenv</a></b></code><i> <var>name</var> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>getenv</code> returns the value of the environment
variable <var>name</var> of the current process. Variable names are
denoted with strings. A string is returned if the environment
variable is bound, otherwise <var>default</var> is returned if it is
specified, otherwise an exception is raised.
</p>
<p>The procedure <code>setenv</code> changes the binding of the environment
variable <var>name</var> to <var>new-value</var> which must be a string.
If <var>new-value</var> is not specified the binding is removed.
</p>
<p>For example under UNIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(getenv "HOME")</b>
"/Users/feeley"
> <b>(getenv "DOES_NOT_EXIST" #f)</b>
#f
> <b>(setenv "DOES_NOT_EXIST" "it does now")</b>
> <b>(getenv "DOES_NOT_EXIST" #f)</b>
"it does now"
> <b>(setenv "DOES_NOT_EXIST")</b>
> <b>(getenv "DOES_NOT_EXIST" #f)</b>
#f
> <b>(getenv "DOES_NOT_EXIST")</b>
*** ERROR IN (console)@7.1 -- Unbound OS environment variable
(getenv "DOES_NOT_EXIST")
</pre></td></tr></table>
<hr size="6">
<a name="Measuring-time"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Environment-variables" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#File-information" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Measuring-time-1"></a>
<h2 class="section">16.7 Measuring time</h2>
<p>Procedures are available for measuring real time (aka “wall” time)
and cpu time (the amount of time the cpu has been executing the
process). The resolution of the real time and cpu time clock is
operating system dependent. Typically the resolution of the cpu time
clock is rather coarse (measured in “ticks” of 1/60th or 1/100th of
a second). Real time is internally computed relative to some
arbitrary point in time using floating point numbers, which means that
there is a gradual loss of resolution as time elapses. Moreover, some
operating systems report time in number of ticks using a 32 bit
integer so the value returned by the time related procedures may
wraparound much before any significant loss of resolution occurs (for
example 2.7 years if ticks are 1/50th of a second).
</p>
<a name="Definition_of_current-time"></a><a name="Procedure_current-time"></a><a name="index-current_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-time">current-time</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_time?"></a><a name="Procedure_time?"></a><a name="index-time_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_time?">time?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_time-%3Eseconds"></a><a name="Procedure_time-%3Eseconds"></a><a name="index-time_002d_003eseconds"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_time-%3Eseconds">time->seconds</a></b></code><i> <var>time</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_seconds-%3Etime"></a><a name="Procedure_seconds-%3Etime"></a><a name="index-seconds_002d_003etime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_seconds-%3Etime">seconds->time</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>current-time</code> returns a <em>time object</em>
representing the current point in real time.
</p>
<p>The procedure <code>time?</code> returns <code>#t</code> when <var>obj</var> is a time
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>time->seconds</code> converts the time object <var>time</var>
into an inexact real number representing the number of seconds elapsed
since the “epoch” (which is 00:00:00 Coordinated Universal Time
01-01-1970).
</p>
<p>The procedure <code>seconds->time</code> converts the real number <var>x</var>
representing the number of seconds elapsed since the “epoch” into a
time object.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(current-time)</b>
#<time #2>
> <b>(time? (current-time))</b>
#t
> <b>(time? 123)</b>
#f
> <b>(time->seconds (current-time))</b>
1083118758.63973
> <b>(time->seconds (current-time))</b>
1083118759.909163
> <b>(seconds->time (+ 10 (time->seconds (current-time))</b>
#<time #3> <span class="roman"><i>; a time object representing 10 seconds in the future</i></span>
</pre></td></tr></table>
<a name="Definition_of_process-times"></a><a name="Procedure_process-times"></a><a name="index-process_002dtimes"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_process-times">process-times</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_cpu-time"></a><a name="Procedure_cpu-time"></a><a name="index-cpu_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_cpu-time">cpu-time</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_real-time"></a><a name="Procedure_real-time"></a><a name="index-real_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_real-time">real-time</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>process-times</code> returns a three element f64vector
containing the cpu time that has been used by the program and the real
time that has elapsed since it was started. The first element
corresponds to “user” time in seconds, the second element
corresponds to “system” time in seconds and the third element is the
elapsed real time in seconds. On operating systems that can’t
differentiate user and system time, the system time is zero. On
operating systems that can’t measure cpu time, the user time is equal
to the elapsed real time and the system time is zero.
</p>
<p>The procedure <code>cpu-time</code> returns the cpu time in seconds that has
been used by the program (user time plus system time).
</p>
<p>The procedure <code>real-time</code> returns the real time that has elapsed
since the program was started.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(process-times)</b>
#f64(.02794 .021754 .159926176071167)
> <b>(cpu-time)</b>
.051223
> <b>(real-time)</b>
.40660619735717773
</pre></td></tr></table>
<a name="Definition_of_time"></a><a name="Special_form_time"></a><a name="index-time"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_time">time</a></b></code><i> <span class="roman"><i>expr</i></span> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">special form</td></tr></table>
<p>The <code>time</code> special form evaluates <i>expr</i> and returns the
result. As a side effect it displays a message on the port <var>port</var>
which indicates various statistics about the evaluation of <i>expr</i>
including how long the evaluation took (in real time and cpu time),
how much time was spent in the garbage collector, how much memory was
allocated during the evaluation and how many minor and major page
faults occured (0 is reported if not running under UNIX). If it is
not specified, <var>port</var> defaults to the interaction channel
(i.e. the output will appear at the REPL).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (f x)
(let loop ((x x) (lst '()))
(if (= x 0)
lst
(loop (- x 1) (cons x lst)))))</b>
> <b>(length (time (f 100000)))</b>
(time (f 100000))
683 ms real time
558 ms cpu time (535 user, 23 system)
8 collections accounting for 102 ms real time (70 user, 5 system)
6400160 bytes allocated
no minor faults
no major faults
100000
</pre></td></tr></table>
<hr size="6">
<a name="File-information"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Measuring-time" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Group-information" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="File-information-1"></a>
<h2 class="section">16.8 File information</h2>
<a name="Definition_of_file-exists?"></a><a name="Procedure_file-exists?"></a><a name="index-file_002dexists_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-exists?">file-exists?</a></b></code><i> <var>path</var> <span class="roman">[</span><var>chase?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <var>path</var> argument must be a string. This procedure returns
<code>#t</code> when a file by that name exists, and returns <code>#f</code>
otherwise.
</p>
<p>When <var>chase?</var> is present and <code>#f</code>, symbolic links will not be
chased, in other words if <var>path</var> refers to a symbolic link,
<code>file-exists?</code> will return <code>#t</code> whether or not it points to
an existing file.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-exists? "nofile")</b>
#f
</pre></td></tr></table>
<a name="Definition_of_file-info"></a><a name="Procedure_file-info"></a><a name="index-file_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info">file-info</a></b></code><i> <var>path</var> <span class="roman">[</span><var>chase?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure accesses the filesystem to get information about the
file whose location is given by the string <var>path</var>. A
file-information record is returned that contains the file’s type, the
device number, the inode number, the mode (permission bits), the
number of links, the file’s user id, the file’s group id, the file’s
size in bytes, the times of last-access, last-modification and
last-change, the attributes, and the creation time.
</p>
<p>When <var>chase?</var> is present and <code>#f</code>, symbolic links will not be
chased, in other words if <var>path</var> refers to a symbolic link the
<code>file-info</code> procedure will return information about the link
rather than the file it links to.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info "/dev/tty")</b>
#<file-info #2
type: character-special
device: 19513156
inode: 20728196
mode: 438
number-of-links: 1
owner: 0
group: 0
size: 0
last-access-time: #<time #3>
last-modification-time: #<time #4>
last-change-time: #<time #5>
attributes: 128
creation-time: #<time #6>>
</pre></td></tr></table>
<a name="Definition_of_file-info?"></a><a name="Procedure_file-info?"></a><a name="index-file_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info?">file-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a file-information
record and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info? (file-info "/dev/tty"))</b>
#t
> <b>(file-info? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_file-info-type"></a><a name="Procedure_file-info-type"></a><a name="index-file_002dinfo_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-type">file-info-type</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the type field of the file-information record
<var>file-info</var>. The type is denoted by a symbol.
The following types are possible:
</p>
<dl compact="compact">
<dt> <code>regular</code></dt>
<dd><p>Regular file
</p></dd>
<dt> <code>directory</code></dt>
<dd><p>Directory
</p></dd>
<dt> <code>character-special</code></dt>
<dd><p>Character special device
</p></dd>
<dt> <code>block-special</code></dt>
<dd><p>Block special device
</p></dd>
<dt> <code>fifo</code></dt>
<dd><p>FIFO
</p></dd>
<dt> <code>symbolic-link</code></dt>
<dd><p>Symbolic link
</p></dd>
<dt> <code>socket</code></dt>
<dd><p>Socket
</p></dd>
<dt> <code>unknown</code></dt>
<dd><p>File is of an unknown type
</p></dd>
</dl>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-type (file-info "/dev/tty"))</b>
character-special
> <b>(file-info-type (file-info "/dev"))</b>
directory
</pre></td></tr></table>
<a name="Definition_of_file-info-device"></a><a name="Procedure_file-info-device"></a><a name="index-file_002dinfo_002ddevice"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-device">file-info-device</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the device field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-device (file-info "/dev/tty"))</b>
19513156
</pre></td></tr></table>
<a name="Definition_of_file-info-inode"></a><a name="Procedure_file-info-inode"></a><a name="index-file_002dinfo_002dinode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-inode">file-info-inode</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the inode field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-inode (file-info "/dev/tty"))</b>
20728196
</pre></td></tr></table>
<a name="Definition_of_file-info-mode"></a><a name="Procedure_file-info-mode"></a><a name="index-file_002dinfo_002dmode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-mode">file-info-mode</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the mode field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-mode (file-info "/dev/tty"))</b>
438
</pre></td></tr></table>
<a name="Definition_of_file-info-number-of-links"></a><a name="Procedure_file-info-number-of-links"></a><a name="index-file_002dinfo_002dnumber_002dof_002dlinks"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-number-of-links">file-info-number-of-links</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the number-of-links field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-number-of-links (file-info "/dev/tty"))</b>
1
</pre></td></tr></table>
<a name="Definition_of_file-info-owner"></a><a name="Procedure_file-info-owner"></a><a name="index-file_002dinfo_002downer"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-owner">file-info-owner</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the owner field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-owner (file-info "/dev/tty"))</b>
0
</pre></td></tr></table>
<a name="Definition_of_file-info-group"></a><a name="Procedure_file-info-group"></a><a name="index-file_002dinfo_002dgroup"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-group">file-info-group</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the group field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-group (file-info "/dev/tty"))</b>
0
</pre></td></tr></table>
<a name="Definition_of_file-info-size"></a><a name="Procedure_file-info-size"></a><a name="index-file_002dinfo_002dsize"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-size">file-info-size</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the size field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-size (file-info "/dev/tty"))</b>
0
</pre></td></tr></table>
<a name="Definition_of_file-info-last-access-time"></a><a name="Procedure_file-info-last-access-time"></a><a name="index-file_002dinfo_002dlast_002daccess_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-last-access-time">file-info-last-access-time</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the last-access-time field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-last-access-time (file-info "/dev/tty"))</b>
#<time #2>
</pre></td></tr></table>
<a name="Definition_of_file-info-last-modification-time"></a><a name="Procedure_file-info-last-modification-time"></a><a name="index-file_002dinfo_002dlast_002dmodification_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-last-modification-time">file-info-last-modification-time</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the last-modification-time field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-last-modification-time (file-info "/dev/tty"))</b>
#<time #2>
</pre></td></tr></table>
<a name="Definition_of_file-info-last-change-time"></a><a name="Procedure_file-info-last-change-time"></a><a name="index-file_002dinfo_002dlast_002dchange_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-last-change-time">file-info-last-change-time</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the last-change-time field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-last-change-time (file-info "/dev/tty"))</b>
#<time #2>
</pre></td></tr></table>
<a name="Definition_of_file-info-attributes"></a><a name="Procedure_file-info-attributes"></a><a name="index-file_002dinfo_002dattributes"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-attributes">file-info-attributes</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the attributes field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-attributes (file-info "/dev/tty"))</b>
128
</pre></td></tr></table>
<a name="Definition_of_file-info-creation-time"></a><a name="Procedure_file-info-creation-time"></a><a name="index-file_002dinfo_002dcreation_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-info-creation-time">file-info-creation-time</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the creation-time field of the file-information record
<var>file-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-creation-time (file-info "/dev/tty"))</b>
#<time #2>
</pre></td></tr></table>
<a name="Definition_of_file-type"></a><a name="Procedure_file-type"></a><a name="index-file_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-type">file-type</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-device"></a><a name="Procedure_file-device"></a><a name="index-file_002ddevice"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-device">file-device</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-inode"></a><a name="Procedure_file-inode"></a><a name="index-file_002dinode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-inode">file-inode</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-mode"></a><a name="Procedure_file-mode"></a><a name="index-file_002dmode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-mode">file-mode</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-number-of-links"></a><a name="Procedure_file-number-of-links"></a><a name="index-file_002dnumber_002dof_002dlinks"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-number-of-links">file-number-of-links</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-owner"></a><a name="Procedure_file-owner"></a><a name="index-file_002downer"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-owner">file-owner</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-group"></a><a name="Procedure_file-group"></a><a name="index-file_002dgroup"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-group">file-group</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-size"></a><a name="Procedure_file-size"></a><a name="index-file_002dsize"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-size">file-size</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-last-access-time"></a><a name="Procedure_file-last-access-time"></a><a name="index-file_002dlast_002daccess_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-last-access-time">file-last-access-time</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-last-modification-time"></a><a name="Procedure_file-last-modification-time"></a><a name="index-file_002dlast_002dmodification_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-last-modification-time">file-last-modification-time</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-last-change-time"></a><a name="Procedure_file-last-change-time"></a><a name="index-file_002dlast_002dchange_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-last-change-time">file-last-change-time</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-attributes"></a><a name="Procedure_file-attributes"></a><a name="index-file_002dattributes"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-attributes">file-attributes</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_file-creation-time"></a><a name="Procedure_file-creation-time"></a><a name="index-file_002dcreation_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-creation-time">file-creation-time</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures combine a call to the <code>file-info</code> procedure and
a call to a file-information record field accessor. For instance
<code>(file-type <var>path</var>)</code> is equivalent to <code>(file-info-type
(file-info <var>path</var>))</code>.
</p>
<a name="Definition_of_file-last-access-and-modification-times-set!"></a><a name="Procedure_file-last-access-and-modification-times-set!"></a><a name="index-file_002dlast_002daccess_002dand_002dmodification_002dtimes_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_file-last-access-and-modification-times-set!">file-last-access-and-modification-times-set!</a></b></code><i> <var>path</var> <span class="roman">[</span><var>atime</var> <span class="roman">[</span><var>mtime</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure changes the last-access and last-modification times of
the file whose location is given by the string <var>path</var>. Time is
specified either with a time object indicating an absolute point in
time or a real number indicating the number of seconds relative to the
moment the procedure is called. When <var>atime</var> and <var>mtime</var> are
not specified, the last-access and last-modification times are set to
the current time. When <var>mtime</var> is not specified, the last-access
and last-modification times are set to <var>atime</var>. Otherwise the
last-access time is set to <var>atime</var> and the last-modification time
is set to <var>mtime</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (t path)
(list (time->seconds (file-last-access-time path))
(time->seconds (file-last-modification-time path))))</b>
> <b>(with-output-to-file "nl.txt" newline)</b>
> <b>(t "nl.txt")</b>
(1429547027. 1429547027.)
> <b>(t "nl.txt")</b>
(1429547027. 1429547027.)
> <b>(file-last-access-and-modification-times-set! "nl.txt")</b>
> <b>(t "nl.txt")</b>
(1429547039. 1429547039.)
> <b>(file-last-access-and-modification-times-set! "nl.txt" -60)</b>
> <b>(t "nl.txt")</b>
(1429547006. 1429547006.)
> <b>(file-last-access-and-modification-times-set! "nl.txt" -60 0)</b>
> <b>(t "nl.txt")</b>
(1429547049. 1429547109.)
</pre></td></tr></table>
<hr size="6">
<a name="Group-information"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#File-information" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#User-information" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Group-information-1"></a>
<h2 class="section">16.9 Group information</h2>
<a name="Definition_of_group-info"></a><a name="Procedure_group-info"></a><a name="index-group_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_group-info">group-info</a></b></code><i> <var>group-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure accesses the group database to get information about the
group identified by <var>group-name-or-id</var>, which is the group’s symbolic
name (string) or the group’s GID (exact integer). A group-information
record is returned that contains the group’s symbolic name, the group’s
id (GID), and the group’s members (list of symbolic user names).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info "staff")</b>
#<group-info #2 name: "staff" gid: 20 members: ("root")>
> <b>(group-info 29)</b>
#<group-info #3
name: "certusers"
gid: 29
members: ("root" "jabber" "postfix" "cyrusimap")>
> <b>(group-info 5000)</b>
*** ERROR IN (console)@3.1 -- Resource temporarily unavailable
(group-info 5000)
</pre></td></tr></table>
<a name="Definition_of_group-info?"></a><a name="Procedure_group-info?"></a><a name="index-group_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_group-info?">group-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a group-information
record and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info? (group-info "daemon"))</b>
#t
> <b>(group-info? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_group-info-name"></a><a name="Procedure_group-info-name"></a><a name="index-group_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_group-info-name">group-info-name</a></b></code><i> <var>group-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the symbolic name field of the group-information record
<var>group-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info-name (group-info 29))</b>
"certusers"
</pre></td></tr></table>
<a name="Definition_of_group-info-gid"></a><a name="Procedure_group-info-gid"></a><a name="index-group_002dinfo_002dgid"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_group-info-gid">group-info-gid</a></b></code><i> <var>group-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the group id field of the group-information record
<var>group-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info-gid (group-info "staff"))</b>
20
</pre></td></tr></table>
<a name="Definition_of_group-info-members"></a><a name="Procedure_group-info-members"></a><a name="index-group_002dinfo_002dmembers"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_group-info-members">group-info-members</a></b></code><i> <var>group-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the members field of the group-information record
<var>group-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info-members (group-info "staff"))</b>
("root")
</pre></td></tr></table>
<hr size="6">
<a name="User-information"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Group-information" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Host-information" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="User-information-1"></a>
<h2 class="section">16.10 User information</h2>
<a name="Definition_of_user-name"></a><a name="Procedure_user-name"></a><a name="index-user_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_user-name">user-name</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the user’s name as a string.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-name)</b>
"feeley"
</pre></td></tr></table>
<a name="Definition_of_user-info"></a><a name="Procedure_user-info"></a><a name="index-user_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_user-info">user-info</a></b></code><i> <var>user-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure accesses the user database to get information about the
user identified by <var>user-name-or-id</var>, which is the user’s symbolic
name (string) or the user’s UID (exact integer). A user-information
record is returned that contains the user’s symbolic name, the user’s
id (UID), the user’s group id (GID), the path to the user’s home
directory, and the user’s login shell.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info "feeley")</b>
#<user-info #2
name: "feeley"
uid: 506
gid: 506
home: "/Users/feeley"
shell: "/bin/bash">
> <b>(user-info 0)</b>
#<user-info #3 name: "root" uid: 0 gid: 0 home: "/var/root" shell: "/bin/sh">
> <b>(user-info 5000)</b>
*** ERROR IN (console)@3.1 -- Resource temporarily unavailable
(user-info 5000)
</pre></td></tr></table>
<a name="Definition_of_user-info?"></a><a name="Procedure_user-info?"></a><a name="index-user_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_user-info?">user-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a user-information
record and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info? (user-info "feeley"))</b>
#t
> <b>(user-info? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_user-info-name"></a><a name="Procedure_user-info-name"></a><a name="index-user_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_user-info-name">user-info-name</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the symbolic name field of the user-information record
<var>user-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-name (user-info 0))</b>
"root"
</pre></td></tr></table>
<a name="Definition_of_user-info-uid"></a><a name="Procedure_user-info-uid"></a><a name="index-user_002dinfo_002duid"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_user-info-uid">user-info-uid</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the user id field of the user-information record
<var>user-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-uid (user-info "feeley"))</b>
506
</pre></td></tr></table>
<a name="Definition_of_user-info-gid"></a><a name="Procedure_user-info-gid"></a><a name="index-user_002dinfo_002dgid"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_user-info-gid">user-info-gid</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the group id field of the user-information record
<var>user-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-gid (user-info "feeley"))</b>
506
</pre></td></tr></table>
<a name="Definition_of_user-info-home"></a><a name="Procedure_user-info-home"></a><a name="index-user_002dinfo_002dhome"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_user-info-home">user-info-home</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the home directory field of the user-information record
<var>user-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-home (user-info 0))</b>
"/var/root"
</pre></td></tr></table>
<a name="Definition_of_user-info-shell"></a><a name="Procedure_user-info-shell"></a><a name="index-user_002dinfo_002dshell"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_user-info-shell">user-info-shell</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the shell field of the user-information record
<var>user-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-shell (user-info 0))</b>
"/bin/sh"
</pre></td></tr></table>
<hr size="6">
<a name="Host-information"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#User-information" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Service-information" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Host-information-1"></a>
<h2 class="section">16.11 Host information</h2>
<a name="Definition_of_host-name"></a><a name="Procedure_host-name"></a><a name="index-host_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_host-name">host-name</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the machine’s host name as a string.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-name)</b>
"mega.iro.umontreal.ca"
</pre></td></tr></table>
<a name="Definition_of_host-info"></a><a name="Procedure_host-info"></a><a name="index-host_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_host-info">host-info</a></b></code><i> <var>host-name</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure accesses the internet host database to get information
about the machine whose name is denoted by the string <var>host-name</var>.
A host-information record is returned that contains the official name
of the machine, a list of aliases (alternative names), and a non-empty
list of IP addresses for this machine. An exception is raised when
<var>host-name</var> does not appear in the database.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info "www.google.com")</b>
#<host-info #2
name: "www.l.google.com"
aliases: ("www.google.com")
addresses: (#u8(66 249 85 99) #u8(66 249 85 104))>
> <b>(host-info "unknown.domain")</b>
*** ERROR IN (console)@2.1 -- Unknown host
(host-info "unknown.domain")
</pre></td></tr></table>
<a name="Definition_of_host-info?"></a><a name="Procedure_host-info?"></a><a name="index-host_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_host-info?">host-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a host-information
record and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info? (host-info "www.google.com"))</b>
#t
> <b>(host-info? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_host-info-name"></a><a name="Procedure_host-info-name"></a><a name="index-host_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_host-info-name">host-info-name</a></b></code><i> <var>host-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the official name field of the host-information record
<var>host-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info-name (host-info "www.google.com"))</b>
"www.l.google.com"
</pre></td></tr></table>
<a name="Definition_of_host-info-aliases"></a><a name="Procedure_host-info-aliases"></a><a name="index-host_002dinfo_002daliases"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_host-info-aliases">host-info-aliases</a></b></code><i> <var>host-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the aliases field of the host-information record
<var>host-info</var>. This field is a possibly empty list of strings.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info-aliases (host-info "www.google.com"))</b>
("www.google.com")
</pre></td></tr></table>
<a name="Definition_of_host-info-addresses"></a><a name="Procedure_host-info-addresses"></a><a name="index-host_002dinfo_002daddresses"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_host-info-addresses">host-info-addresses</a></b></code><i> <var>host-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the addresses field of the host-information record
<var>host-info</var>. This field is a non-empty list of u8vectors
denoting IP addresses.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info-addresses (host-info "www.google.com"))</b>
(#u8(66 249 85 99) #u8(66 249 85 104))
</pre></td></tr></table>
<a name="Definition_of_address-infos"></a><a name="Procedure_address-infos"></a><a name="index-address_002dinfos"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_address-infos">address-infos</a></b></code><i> <span class="roman">[</span><code>host:</code> <var>host</var><span class="roman">]</span> <span class="roman">[</span><code>service:</code> <var>service</var><span class="roman">]</span> <span class="roman">[</span><code>family:</code> <var>family</var><span class="roman">]</span> <span class="roman">[</span><code>socket-type:</code> <var>socket-type</var><span class="roman">]</span> <span class="roman">[</span><code>protocol:</code> <var>protocol</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure is an interface to the <code>getaddrinfo</code> system call.
It accesses the internet host database to get information about the
machine whose name is denoted by the string <var>host</var> and service is
denoted by the string <var>service</var> and network address family is
<var>family</var> (<code>INET</code> or <code>INET6</code>) and network socket-type is
<var>socket-type</var> (<code>STREAM</code> or <code>DGRAM</code> or <code>RAW</code>) and
network protocol is <var>socket-type</var> (<code>TCP</code> or <code>UDP</code>). A
list of address-information records is returned.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(address-infos host: "ftp.at.debian.org")</b>
(#<address-info #2
family: INET6
socket-type: DGRAM
protocol: UDP
socket-info:
#<socket-info #3
family: INET6
port-number: 0
address: #u16(8193 2136 2 1 0 0 0 16)>>
#<address-info #4
family: INET6
socket-type: STREAM
protocol: TCP
socket-info:
#<socket-info #5
family: INET6
port-number: 0
address: #u16(8193 2136 2 1 0 0 0 16)>>
#<address-info #6
family: INET
socket-type: DGRAM
protocol: UDP
socket-info:
#<socket-info #7
family: INET
port-number: 0
address: #u8(213 129 232 18)>>
#<address-info #8
family: INET
socket-type: STREAM
protocol: TCP
socket-info:
#<socket-info #9
family: INET
port-number: 0
address: #u8(213 129 232 18)>>)
> <b>(address-infos host: "ftp.at.debian.org"
family: 'INET
protocol: 'TCP)</b>
(#<address-info #10
family: INET
socket-type: STREAM
protocol: TCP
socket-info:
#<socket-info #11
family: INET
port-number: 0
address: #u8(213 129 232 18)>>)
> <b>(address-infos host: "unknown.domain")</b>
*** ERROR IN (console)@5.1 -- nodename nor servname provided, or not known
(address-infos host: "unknown.domain")
</pre></td></tr></table>
<a name="Definition_of_address-info?"></a><a name="Procedure_address-info?"></a><a name="index-address_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_address-info?">address-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is an address-information
record and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info?
(address-infos host: "ftp.at.debian.org"))</b>
(#t #t #t #t)
> <b>(address-info? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_address-info-family"></a><a name="Procedure_address-info-family"></a><a name="index-address_002dinfo_002dfamily"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_address-info-family">address-info-family</a></b></code><i> <var>address-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the family field of the address-information record
<var>address-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info-family
(address-infos host: "ftp.at.debian.org"))</b>
(INET6 INET6 INET INET)
</pre></td></tr></table>
<a name="Definition_of_address-info-socket-type"></a><a name="Procedure_address-info-socket-type"></a><a name="index-address_002dinfo_002dsocket_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_address-info-socket-type">address-info-socket-type</a></b></code><i> <var>address-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the socket-type field of the address-information record
<var>address-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info-socket-type
(address-infos host: "ftp.at.debian.org"))</b>
(DGRAM STREAM DGRAM STREAM)
</pre></td></tr></table>
<a name="Definition_of_address-info-protocol"></a><a name="Procedure_address-info-protocol"></a><a name="index-address_002dinfo_002dprotocol"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_address-info-protocol">address-info-protocol</a></b></code><i> <var>address-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the protocol field of the address-information record
<var>address-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info-protocol
(address-infos host: "ftp.at.debian.org"))</b>
(UDP TCP UDP TCP)
</pre></td></tr></table>
<a name="Definition_of_address-info-socket-info"></a><a name="Procedure_address-info-socket-info"></a><a name="index-address_002dinfo_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_address-info-socket-info">address-info-socket-info</a></b></code><i> <var>address-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the socket-info field of the address-information record
<var>address-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info-socket-info
(address-infos host: "ftp.at.debian.org"))</b>
(#<socket-info #2
family: INET6
port-number: 0
address: #u16(8193 2136 2 1 0 0 0 16)>
#<socket-info #3
family: INET6
port-number: 0
address: #u16(8193 2136 2 1 0 0 0 16)>
#<socket-info #4
family: INET
port-number: 0
address: #u8(213 129 232 18)>
#<socket-info #5
family: INET
port-number: 0
address: #u8(213 129 232 18)>)
</pre></td></tr></table>
<hr size="6">
<a name="Service-information"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Host-information" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Protocol-information" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Service-information-1"></a>
<h2 class="section">16.12 Service information</h2>
<a name="Definition_of_service-info"></a><a name="Procedure_service-info"></a><a name="index-service_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_service-info">service-info</a></b></code><i> <var>service-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure accesses the service database to get information about
the service identified by <var>service-name-or-id</var>, which is the
service’s symbolic name (string) or the service’s port number (exact
integer). A service-information record is returned that contains the
service’s symbolic name, a list of aliases (alternative names), the
port number (exact integer), and the protocol name (string). An
exception is raised when <var>service-name-or-id</var> does not appear in
the database.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info "http")</b>
#<service-info #2
name: "http"
aliases: ("www" "www-http")
port-number: 80
protocol: "udp">
> <b>(service-info 80)</b>
#<service-info #3
name: "http"
aliases: ("www" "www-http")
port-number: 80
protocol: "udp">
</pre></td></tr></table>
<a name="Definition_of_service-info?"></a><a name="Procedure_service-info?"></a><a name="index-service_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_service-info?">service-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a service-information
record and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info? (service-info "http"))</b>
#t
> <b>(service-info? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_service-info-name"></a><a name="Procedure_service-info-name"></a><a name="index-service_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_service-info-name">service-info-name</a></b></code><i> <var>service-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the symbolic name field of the service-information record
<var>service-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info-name (service-info 80))</b>
"http"
</pre></td></tr></table>
<a name="Definition_of_service-info-aliases"></a><a name="Procedure_service-info-aliases"></a><a name="index-service_002dinfo_002daliases"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_service-info-aliases">service-info-aliases</a></b></code><i> <var>service-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the aliases field of the service-information record
<var>service-info</var>. This field is a possibly empty list of strings.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info-aliases (service-info "http"))</b>
("www" "www-http")
</pre></td></tr></table>
<a name="Definition_of_service-info-port-number"></a><a name="Procedure_service-info-port-number"></a><a name="index-service_002dinfo_002dport_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_service-info-port-number">service-info-port-number</a></b></code><i> <var>service-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the service port number field of the service-information
record <var>service-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info-port-number (service-info "http"))</b>
80
</pre></td></tr></table>
<a name="Definition_of_service-info-protocol"></a><a name="Procedure_service-info-protocol"></a><a name="index-service_002dinfo_002dprotocol"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_service-info-protocol">service-info-protocol</a></b></code><i> <var>service-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the service protocol name field of the service-information
record <var>service-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info-protocol (service-info "http"))</b>
"udp"
</pre></td></tr></table>
<hr size="6">
<a name="Protocol-information"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Service-information" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Network-information" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Protocol-information-1"></a>
<h2 class="section">16.13 Protocol information</h2>
<a name="Definition_of_protocol-info"></a><a name="Procedure_protocol-info"></a><a name="index-protocol_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_protocol-info">protocol-info</a></b></code><i> <var>protocol-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure accesses the protocol database to get information about
the protocol identified by <var>protocol-name-or-id</var>, which is the
protocol’s symbolic name (string) or the protocol’s number (exact
integer). A protocol-information record is returned that contains the
protocol’s symbolic name, a list of aliases (alternative names), and
the protocol number (32 bit unsigned exact integer). An exception is
raised when <var>protocol-name-or-id</var> does not appear in the database.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info "tcp")</b>
#<protocol-info #2 name: "tcp" aliases: ("TCP") number: 6>
> <b>(protocol-info 6)</b>
#<protocol-info #2 name: "tcp" aliases: ("TCP") number: 6>
</pre></td></tr></table>
<a name="Definition_of_protocol-info?"></a><a name="Procedure_protocol-info?"></a><a name="index-protocol_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_protocol-info?">protocol-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a protocol-information
record and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info? (protocol-info "tcp"))</b>
#t
> <b>(protocol-info? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_protocol-info-name"></a><a name="Procedure_protocol-info-name"></a><a name="index-protocol_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_protocol-info-name">protocol-info-name</a></b></code><i> <var>protocol-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the symbolic name field of the protocol-information record
<var>protocol-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info-name (protocol-info 6))</b>
"tcp"
</pre></td></tr></table>
<a name="Definition_of_protocol-info-aliases"></a><a name="Procedure_protocol-info-aliases"></a><a name="index-protocol_002dinfo_002daliases"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_protocol-info-aliases">protocol-info-aliases</a></b></code><i> <var>protocol-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the aliases field of the protocol-information record
<var>protocol-info</var>. This field is a possibly empty list of strings.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info-aliases (protocol-info "tcp"))</b>
("TCP")
</pre></td></tr></table>
<a name="Definition_of_protocol-info-number"></a><a name="Procedure_protocol-info-number"></a><a name="index-protocol_002dinfo_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_protocol-info-number">protocol-info-number</a></b></code><i> <var>protocol-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the protocol number field of the protocol-information record
<var>protocol-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info-number (protocol-info "tcp"))</b>
6
</pre></td></tr></table>
<hr size="6">
<a name="Network-information"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Protocol-information" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Network-information-1"></a>
<h2 class="section">16.14 Network information</h2>
<a name="Definition_of_network-info"></a><a name="Procedure_network-info"></a><a name="index-network_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_network-info">network-info</a></b></code><i> <var>network-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure accesses the network database to get information about
the network identified by <var>network-name-or-id</var>, which is the
network’s symbolic name (string) or the network’s number (exact
integer). A network-information record is returned that contains the
network’s symbolic name, a list of aliases (alternative names), and
the network number (32 bit unsigned exact integer). An exception is
raised when <var>network-name-or-id</var> does not appear in the database.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info "loopback")</b>
#<network-info #2
name: "loopback"
aliases: ("loopback-net")
number: 127>
> <b>(network-info 127)</b>
#<network-info #3
name: "loopback"
aliases: ("loopback-net")
number: 127>
</pre></td></tr></table>
<a name="Definition_of_network-info?"></a><a name="Procedure_network-info?"></a><a name="index-network_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_network-info?">network-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a network-information
record and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info? (network-info "loopback"))</b>
#t
> <b>(network-info? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_network-info-name"></a><a name="Procedure_network-info-name"></a><a name="index-network_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_network-info-name">network-info-name</a></b></code><i> <var>network-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the symbolic name field of the network-information record
<var>network-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info-name (network-info 127))</b>
"loopback"
</pre></td></tr></table>
<a name="Definition_of_network-info-aliases"></a><a name="Procedure_network-info-aliases"></a><a name="index-network_002dinfo_002daliases"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_network-info-aliases">network-info-aliases</a></b></code><i> <var>network-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the aliases field of the network-information record
<var>network-info</var>. This field is a possibly empty list of strings.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info-aliases (network-info "loopback"))</b>
("loopback-net")
</pre></td></tr></table>
<a name="Definition_of_network-info-number"></a><a name="Procedure_network-info-number"></a><a name="index-network_002dinfo_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_network-info-number">network-info-number</a></b></code><i> <var>network-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Returns the network number field of the network-information record
<var>network-info</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info-number (network-info "loopback"))</b>
127
</pre></td></tr></table>
<hr size="6">
<a name="I_002fO-and-ports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Network-information" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Unidirectional-and-bidirectional-ports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Host-environment" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="I_002fO-and-ports-1"></a>
<h1 class="chapter">17. I/O and ports</h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Unidirectional-and-bidirectional-ports">17.1 Unidirectional and bidirectional ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Port-classes">17.2 Port classes</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Port-settings">17.3 Port settings</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Object_002dports">17.4 Object-ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Character_002dports">17.5 Character-ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Byte_002dports">17.6 Byte-ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Device_002dports">17.7 Device-ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Directory_002dports">17.8 Directory-ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#String_002dports">17.10 String-ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Unidirectional-and-bidirectional-ports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Port-classes" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Unidirectional-and-bidirectional-ports-1"></a>
<h2 class="section">17.1 Unidirectional and bidirectional ports</h2>
<p>Unidirectional ports allow communication between a producer of
information and a consumer. An input-port’s producer is typically a
resource managed by the operating system (such as a file, a process or
a network connection) and the consumer is the Scheme program. The
roles are reversed for an output-port.
</p>
<p>Associated with each port are settings that affect I/O operations on
that port (encoding of characters to bytes, end-of-line encoding, type
of buffering, etc). Port settings are specified when the port is
created. Some port settings can be changed after a port is created.
</p>
<p>Bidirectional ports, also called input-output-ports, allow
communication in both directions. They are best viewed as an object
that groups two separate unidirectional ports (one in each direction).
Each direction has its own port settings and can be closed
independently from the other direction.
</p>
<hr size="6">
<a name="Port-classes"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Unidirectional-and-bidirectional-ports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Port-settings" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Port-classes-1"></a>
<h2 class="section">17.2 Port classes</h2>
<p>The four classes of ports listed below form an inheritance hierarchy.
Operations possible for a certain class of port are also possible for
the subclasses. Only device-ports are connected to a device managed
by the operating system. For instance it is possible to create ports
that behave as a FIFO where the Scheme program is both the producer
and consumer of information (possibly one thread is the producer and
another thread is the consumer).
</p>
<ol>
<li>
An <em>object-port</em> (or simply a port) provides operations to read
and write Scheme data (i.e. any Scheme object) to/from the port. It
also provides operations to force output to occur, to change the way
threads block on the port, and to close the port. Note that the class
of objects for which write/read invariance is guaranteed depends on
the particular class of port.
</li><li>
A <em>character-port</em> provides all the operations of an object-port,
and also operations to read and write individual characters to/from
the port. When a Scheme object is written to a character-port, it is
converted into the sequence of characters that corresponds to its
external-representation. When reading a Scheme object, an inverse
conversion occurs. Note that some Scheme objects do not have an
external textual representation that can be read back.
</li><li>
A <em>byte-port</em> provides all the operations of a character-port, and
also operations to read and write individual bytes to/from the port.
When a character is written to a byte-port, some encoding of that
character into a sequence of bytes will occur (for example,
<code>#\newline</code> will be encoded as the 2 bytes CR-LF when using
ISO-8859-1 character encoding and <code>cr-lf</code> end-of-line encoding, and
a non-ASCII character will generate more than 1 byte when using UTF-8
character encoding). When reading a character, a similar decoding
occurs.
</li><li>
A <em>device-port</em> provides all the operations of a byte-port, and
also operations to control the operating system managed device (file,
network connection, terminal, etc) that is connected to the port.
</li></ol>
<hr size="6">
<a name="Port-settings"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Port-classes" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Object_002dports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Port-settings-1"></a>
<h2 class="section">17.3 Port settings</h2>
<p>Some port settings are only valid for specific port classes whereas
some others are valid for all ports. Port settings are specified when
a port is created. The settings that are not specified will default
to some reasonable values. Keyword objects are used to name the
settings to be set. As a simple example, a device-port connected to
the file <code>"foo"</code> can be created using the call
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(open-input-file "foo")
</pre></td></tr></table>
<p>This will use default settings for the character encoding, buffering,
etc. If the UTF-8 character encoding is desired, then the port could
be opened using the call
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(open-input-file (list path: "foo" char-encoding: 'UTF-8))
</pre></td></tr></table>
<p>Here the argument of the procedure <code>open-input-file</code> has been
replaced by a <em>port settings list</em> which specifies the value of
each port setting that should not be set to the default value. Note
that some port settings have no useful default and it is therefore
required to specify a value for them, such as the <code>path:</code> in the
case of the file opening procedures. All port creation procedures
(i.e. named <code>open-...</code>) take a single argument that can either
be a port settings list or a value of a type that depends on the kind
of port being created (a path string for files, an IP port number for
socket servers, etc).
</p>
<hr size="6">
<a name="Object_002dports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Port-settings" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Object_002dport-settings" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Object_002dports-1"></a>
<h2 class="section">17.4 Object-ports</h2>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Object_002dport-settings">17.4.1 Object-port settings</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Object_002dport-settings"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Object_002dports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Object_002dport-operations" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Object_002dports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Object_002dport-settings-1"></a>
<h3 class="subsection">17.4.1 Object-port settings</h3>
<p>The following is a list of port settings that are valid for all types
of ports.
</p>
<ul>
<li>
<code>direction:</code> ( <code>input</code> | <code>output</code> | <code>input-output</code> )
<p>This setting controls the direction of the port. The symbol
<code>input</code> indicates a unidirectional input-port, the symbol
<code>output</code> indicates a unidirectional output-port, and the symbol
<code>input-output</code> indicates a bidirectional port. The default
value of this setting depends on the port creation procedure.
</p>
</li><li>
<code>buffering:</code> ( <code>#f</code> | <code>#t</code> | <code>line</code> )
<p>This setting controls the buffering of the port. To set each
direction separately the keywords <code>input-buffering:</code> and
<code>output-buffering:</code> must be used instead of <code>buffering:</code>.
The value <code>#f</code> selects unbuffered I/O, the value <code>#t</code>
selects fully buffered I/O, and the symbol <code>line</code> selects line
buffered I/O (the output buffer is drained when a <code>#\newline</code>
character is written). Line buffered I/O only applies to
character-ports. The default value of this setting is operating
system dependent except consoles which are unbuffered.
</p>
</li></ul>
<hr size="6">
<a name="Object_002dport-operations"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Object_002dport-settings" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Character_002dports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Object_002dports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Object_002dport-operations-1"></a>
<h3 class="subsection">17.4.2 Object-port operations</h3>
<a name="Definition_of_input-port?"></a><a name="Procedure_input-port?"></a><a name="index-input_002dport_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port?">input-port?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_output-port?"></a><a name="Procedure_output-port?"></a><a name="index-output_002dport_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_output-port?">output-port?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_port?"></a><a name="Procedure_port?"></a><a name="index-port_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_port?">port?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>input-port?</code> returns <code>#t</code> when <var>obj</var> is a
unidirectional input-port or a bidirectional port and <code>#f</code>
otherwise.
</p>
<p>The procedure <code>output-port?</code> returns <code>#t</code> when <var>obj</var> is a
unidirectional output-port or a bidirectional port and <code>#f</code>
otherwise.
</p>
<p>The procedure <code>port?</code> returns <code>#t</code> when <var>obj</var> is a port
(either unidirectional or bidirectional) and <code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(input-port? (current-input-port))</b>
#t
> <b>(call-with-input-string "some text" output-port?)</b>
#f
> <b>(port? (current-output-port))</b>
#t
</pre></td></tr></table>
<a name="Definition_of_read"></a><a name="Procedure_read"></a><a name="index-read"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_read">read</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure reads and returns the next Scheme datum from the
input-port <var>port</var>. The end-of-file object is returned when the
end of the stream is reached. If it is not specified, <var>port</var>
defaults to the current input-port.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-string "some text" read)</b>
some
> <b>(call-with-input-string "" read)</b>
#!eof
</pre></td></tr></table>
<a name="Definition_of_read-all"></a><a name="Procedure_read-all"></a><a name="index-read_002dall"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_read-all">read-all</a></b></code><i> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>reader</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure repeatedly calls the procedure <var>reader</var> with
<var>port</var> as the sole argument and accumulates a list of each value
returned up to the end-of-file object. The procedure <code>read-all</code>
returns the accumulated list without the end-of-file object. If it is
not specified, <var>port</var> defaults to the current input-port. If it
is not specified, <var>reader</var> defaults to the procedure <code>read</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-string "3,2,1\ngo!" read-all)</b>
(3 ,2 ,1 go!)
> <b>(call-with-input-string "3,2,1\ngo!"
(lambda (p) (read-all p read-char)))</b>
(#\3 #\, #\2 #\, #\1 #\newline #\g #\o #\!)
> <b>(call-with-input-string "3,2,1\ngo!"
(lambda (p) (read-all p read-line)))</b>
("3,2,1" "go!")
</pre></td></tr></table>
<a name="Definition_of_write"></a><a name="Procedure_write"></a><a name="index-write"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_write">write</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure writes the Scheme datum <var>obj</var> to the output-port
<var>port</var> and the value returned is unspecified. If it is not
specified, <var>port</var> defaults to the current output-port.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(write (list 'compare (list 'quote '@x) 'and (list 'unquote '@x))) </b>
(compare '@x and , @x)>
</pre></td></tr></table>
<a name="Definition_of_newline"></a><a name="Procedure_newline"></a><a name="index-newline"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_newline">newline</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure writes an “object separator” to the output-port
<var>port</var> and the value returned is unspecified. The separator
ensures that the next Scheme datum written with the <code>write</code>
procedure will not be confused with the latest datum that was written.
On character-ports this is done by writing the character
<code>#\newline</code>. On ports where successive objects are implicitly
distinct (such as “vector ports”) this procedure does nothing.
</p>
<p>Regardless of the class of a port <var>p</var> and assuming that the
external textual representation of the object <var>x</var> is readable, the
expression <code>(begin (write <var>x</var> <var>p</var>) (newline <var>p</var>))</code>
will write to <var>p</var> a representation of <var>x</var> that can be read
back with the procedure <code>read</code>. If it is not specified,
<var>port</var> defaults to the current output-port.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(begin (write 123) (newline) (write 456) (newline))</b>
123
456
</pre></td></tr></table>
<a name="Definition_of_force-output"></a><a name="Procedure_force-output"></a><a name="index-force_002doutput"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_force-output">force-output</a></b></code><i> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>level</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>force-output</code> causes the data that was written to
the output-port <var>port</var> to be moved closer to its destination
according to <var>level</var>, an exact integer in the range 0 to 2. If
<var>port</var> is not specified, the current output-port is used. If
<var>level</var> is not specified, it defaults to 0. Values of <var>level</var>
above 0 are equivalent to <var>level</var> = 0 except for device ports as
explained below.
</p>
<p>When <var>level</var> is 0, the output buffers of <var>port</var> which are
managed in the Scheme process are drained (i.e. the output operation
that was delayed due to buffering is actually performed). In the case
of a device port the data is passed to the operating system and it
becomes its responsibility to transmit the data to the device. The
operating system may implement its own buffering approach which delays
the transmission of the data to the device.
</p>
<p>When <var>level</var> is 1, in addition to the operations for <var>level</var> =
0 and if the operating system supports the functionality, the
operating system is requested to transmit the data to the device. On
UNIX this corresponds to a <code>fsync</code> system call.
</p>
<p>When <var>level</var> is 2, in addition to the operations for <var>level</var> =
1 and if the operating system supports the functionality, the
operating system is requested to wait until the device reports that
the data was saved by the device (e.g. actually written to disk in the
case of a file). This operation can take a long time on some
operating systems. On Mac OS X this corresponds to a <code>fcntl</code>
system call with operation <code>F_FULLFSYNC</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-tcp-client "www.iro.umontreal.ca:80"))</b>
> <b>(display "GET /\n" p)</b>
> <b>(force-output p)</b>
> <b>(read-line p)</b>
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\""
</pre></td></tr></table>
<a name="Definition_of_close-input-port"></a><a name="Procedure_close-input-port"></a><a name="index-close_002dinput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_close-input-port">close-input-port</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_close-output-port"></a><a name="Procedure_close-output-port"></a><a name="index-close_002doutput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_close-output-port">close-output-port</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_close-port"></a><a name="Procedure_close-port"></a><a name="index-close_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_close-port">close-port</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <var>port</var> argument of these procedures must be a unidirectional
or a bidirectional port. For all three procedures the value returned
is unspecified.
</p>
<p>The procedure <code>close-input-port</code> closes the input-port side of
<var>port</var>, which must not be a unidirectional output-port.
</p>
<p>The procedure <code>close-output-port</code> closes the output-port side of
<var>port</var>, which must not be a unidirectional input-port. The ouput
buffers are drained before <var>port</var> is closed.
</p>
<p>The procedure <code>close-port</code> closes all sides of the <var>port</var>.
Unless <var>port</var> is a unidirectional input-port, the output buffers
are drained before <var>port</var> is closed.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-tcp-client "www.iro.umontreal.ca:80"))</b>
> <b>(display "GET /\n" p)</b>
> <b>(close-output-port p)</b>
> <b>(read-line p)</b>
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\""
</pre></td></tr></table>
<a name="Definition_of_input-port-timeout-set!"></a><a name="Procedure_input-port-timeout-set!"></a><a name="index-input_002dport_002dtimeout_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port-timeout-set!">input-port-timeout-set!</a></b></code><i> <var>port</var> <var>timeout</var> <span class="roman">[</span><var>thunk</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_output-port-timeout-set!"></a><a name="Procedure_output-port-timeout-set!"></a><a name="index-output_002dport_002dtimeout_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_output-port-timeout-set!">output-port-timeout-set!</a></b></code><i> <var>port</var> <var>timeout</var> <span class="roman">[</span><var>thunk</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>When a thread tries to perform an I/O operation on a port, the
requested operation may not be immediately possible and the thread
must wait. For example, the thread may be trying to read a line of
text from the console and the user has not typed anything yet, or the
thread may be trying to write to a network connection faster than the
network can handle. In such situations the thread normally blocks
until the operation becomes possible.
</p>
<p>It is sometimes necessary to guarantee that the thread will not block
too long. For this purpose, to each input-port and output-port is
attached a <em>timeout</em> and <em>timeout-thunk</em>. The timeout
indicates the point in time beyond which the thread should stop
waiting on an input and output operation respectively. When the
timeout is reached, the thread calls the port’s timeout-thunk. If the
timeout-thunk returns <code>#f</code> the thread abandons trying to perform
the operation (in the case of an input operation an end-of-file is
read and in the case of an output operation an exception is raised).
Otherwise, the thread will block again waiting for the operation to
become possible (note that if the port’s timeout has not changed the
thread will immediately call the timeout-thunk again).
</p>
<p>The procedure <code>input-port-timeout-set!</code> sets the timeout of the
input-port <var>port</var> to <var>timeout</var> and the timeout-thunk to
<var>thunk</var>. The procedure <code>output-port-timeout-set!</code> sets the
timeout of the output-port <var>port</var> to <var>timeout</var> and the
timeout-thunk to <var>thunk</var>. If it is not specified, the <var>thunk</var>
defaults to a thunk that returns <code>#f</code>. The <var>timeout</var> is
either a time object indicating an absolute point in time, or it is a
real number which indicates the number of seconds relative to the
moment the procedure is called. For both procedures the value
returned is unspecified.
</p>
<p>When a port is created the timeout is set to infinity (<code>+inf.0</code>).
This causes the thread to wait as long as needed for the operation to
become possible. Setting the timeout to a point in the past
(<code>-inf.0</code>) will cause the thread to attempt the I/O operation and
never block (i.e. the timeout-thunk is called if the operation is not
immediately possible).
</p>
<p>The following example shows how to cause the REPL to terminate
when the user does not enter an expression within the next 60 seconds.
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(input-port-timeout-set! (repl-input-port) 60)</b>
>
*** EOF again to exit
</pre></td></tr></table>
<hr size="6">
<a name="Character_002dports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Object_002dport-operations" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Character_002dport-settings" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Character_002dports-1"></a>
<h2 class="section">17.5 Character-ports</h2>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Character_002dport-settings">17.5.1 Character-port settings</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Character_002dport-settings"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Character_002dports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Character_002dport-operations" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Character_002dports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Character_002dport-settings-1"></a>
<h3 class="subsection">17.5.1 Character-port settings</h3>
<p>The following is a list of port settings that are valid for
character-ports.
</p>
<ul>
<li>
<code>readtable:</code> <var>readtable</var>
<p>This setting determines the readtable attached to the character-port.
To set each direction separately the keywords <code>input-readtable:</code>
and <code>output-readtable:</code> must be used instead of
<code>readtable:</code>. Readtables control the external textual
representation of Scheme objects, that is the encoding of Scheme
objects using characters. The behavior of the <code>read</code> procedure
depends on the port’s input-readtable and the behavior of the
procedures <code>write</code>, <code>pretty-print</code>, and related procedures
is affected by the port’s output-readtable. The default value of this
setting is the value bound to the parameter object
<code>current-readtable</code>.
</p>
</li><li>
<code>output-width:</code> <var>positive-integer</var>
<p>This setting indicates the width of the character output-port in
number of characters. This information is used by the pretty-printer.
The default value of this setting is 80.
</p>
</li></ul>
<hr size="6">
<a name="Character_002dport-operations"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Character_002dport-settings" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Byte_002dports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Character_002dports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Character_002dport-operations-1"></a>
<h3 class="subsection">17.5.2 Character-port operations</h3>
<a name="Definition_of_input-port-line"></a><a name="Procedure_input-port-line"></a><a name="index-input_002dport_002dline"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port-line">input-port-line</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_input-port-column"></a><a name="Procedure_input-port-column"></a><a name="index-input_002dport_002dcolumn"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port-column">input-port-column</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_output-port-line"></a><a name="Procedure_output-port-line"></a><a name="index-output_002dport_002dline"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_output-port-line">output-port-line</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_output-port-column"></a><a name="Procedure_output-port-column"></a><a name="index-output_002dport_002dcolumn"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_output-port-column">output-port-column</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The current character location of a character input-port is the
location of the next character to read. The current character
location of a character output-port is the location of the next
character to write. Location is denoted by a line number (the first
line is line 1) and a column number, that is the location on the
current line (the first column is column 1). The procedures
<code>input-port-line</code> and <code>input-port-column</code> return the line
location and the column location respectively of the character
input-port <var>port</var>. The procedures <code>output-port-line</code> and
<code>output-port-column</code> return the line location and the column
location respectively of the character output-port <var>port</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-output-string
(lambda (p)
(display "abc\n123def" p)
(write (list (output-port-line p) (output-port-column p))
p)))</b>
"abc\n123def(2 7)"
</pre></td></tr></table>
<a name="Definition_of_output-port-width"></a><a name="Procedure_output-port-width"></a><a name="index-output_002dport_002dwidth"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_output-port-width">output-port-width</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the width, in characters, of the character
output-port <var>port</var>. The value returned is the port’s output-width
setting.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(output-port-width (repl-output-port))</b>
80
</pre></td></tr></table>
<a name="Definition_of_read-char"></a><a name="Procedure_read-char"></a><a name="index-read_002dchar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_read-char">read-char</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure reads the character input-port <var>port</var> and returns
the character at the current character location and advances the
current character location to the next character, unless the
<var>port</var> is already at end-of-file in which case <code>read-char</code>
returns the end-of-file object. If it is not specified, <var>port</var>
defaults to the current input-port.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-string
"some text"
(lambda (p)
(let ((a (read-char p))) (list a (read-char p)))))</b>
(#\s #\o)
> <b>(call-with-input-string "" read-char)</b>
#!eof
</pre></td></tr></table>
<a name="Definition_of_peek-char"></a><a name="Procedure_peek-char"></a><a name="index-peek_002dchar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_peek-char">peek-char</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the same result as <code>read-char</code> but it does
not advance the current character location of the input-port
<var>port</var>. If it is not specified, <var>port</var> defaults to the
current input-port.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-string
"some text"
(lambda (p)
(let ((a (peek-char p))) (list a (read-char p)))))</b>
(#\s #\s)
> <b>(call-with-input-string "" peek-char)</b>
#!eof
</pre></td></tr></table>
<a name="Definition_of_write-char"></a><a name="Procedure_write-char"></a><a name="index-write_002dchar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_write-char">write-char</a></b></code><i> <var>char</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure writes the character <var>char</var> to the character
output-port <var>port</var> and advances the current character location of
that output-port. The value returned is unspecified. If it is not
specified, <var>port</var> defaults to the current output-port.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(write-char #\=)</b>
=>
</pre></td></tr></table>
<a name="Definition_of_read-line"></a><a name="Procedure_read-line"></a><a name="index-read_002dline"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_read-line">read-line</a></b></code><i> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>separator</var> <span class="roman">[</span><var>include-separator?</var> <span class="roman">[</span><var>max-length</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure reads characters from the character input-port
<var>port</var> until a specific <var>separator</var> or the end-of-file is
encountered and returns a string containing the sequence of characters
read. If it is specified, <var>max-length</var> must be a nonnegative
exact integer and it places an upper limit on the number of characters
that are read.
</p>
<p>The <var>separator</var> is included at the end of the string only
if it was the last character read and <var>include-separator?</var> is not
<code>#f</code>. The <var>separator</var> must be a character or <code>#f</code> (in
which case all the characters until the end-of-file are read). If it
is not specified, <var>port</var> defaults to the current input-port. If
it is not specified, <var>separator</var> defaults to <code>#\newline</code>. If
it is not specified, <var>include-separator?</var> defaults to <code>#f</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (split sep)
(lambda (str)
(call-with-input-string
str
(lambda (p)
(read-all p (lambda (p) (read-line p sep)))))))</b>
> <b>((split #\,) "a,b,c")</b>
("a" "b" "c")
> <b>(map (split #\,)
(call-with-input-string "1,2,3\n4,5"
(lambda (p) (read-all p read-line))))</b>
(("1" "2" "3") ("4" "5"))
> <b>(read-line (current-input-port) #\newline #f 2)1234</b>
"12"
> 34
</pre></td></tr></table>
<a name="Definition_of_read-substring"></a><a name="Procedure_read-substring"></a><a name="index-read_002dsubstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_read-substring">read-substring</a></b></code><i> <var>string</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>need</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_write-substring"></a><a name="Procedure_write-substring"></a><a name="index-write_002dsubstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_write-substring">write-substring</a></b></code><i> <var>string</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures support bulk character I/O. The part of the string
<var>string</var> starting at index <var>start</var> and ending just before
index <var>end</var> is used as a character buffer that will be the target
of <code>read-substring</code> or the source of the <code>write-substring</code>.
The <code>read-substring</code> also accepts a <var>need</var> parameter which
must be a nonnegative fixnum. Up to <var>end</var>-<var>start</var> characters
will be transferred. The number of characters transferred, possibly
zero, is returned by these procedures. Fewer characters will be read
by <code>read-substring</code> if an end-of-file is read, or a timeout
occurs before all the requested characters are transferred and the
timeout thunk returns <code>#f</code> (see the procedure
<code>input-port-timeout-set!</code>), or <var>need</var> is specified and at
least that many characters have been read (in other words the
procedure does not block for more characters but may transfer more
characters if they are immediately available). Fewer characters will
be written by <code>write-substring</code> if a timeout occurs before all
the requested characters are transferred and the timeout thunk returns
<code>#f</code> (see the procedure <code>output-port-timeout-set!</code>). If it
is not specified, <var>port</var> defaults to the current input-port and
current output-port respectively.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (make-string 10 #\x))</b>
> <b>(read-substring s 2 5)123456789</b>
3
> 456789
> <b>s</b>
"xx123xxxxx"
> <b>(read-substring s 2 10 (current-input-port) 3)abcd</b>
5
> <b>s</b>
"xxabcd\nxxx"
</pre></td></tr></table>
<a name="Definition_of_input-port-readtable"></a><a name="Procedure_input-port-readtable"></a><a name="index-input_002dport_002dreadtable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port-readtable">input-port-readtable</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_output-port-readtable"></a><a name="Procedure_output-port-readtable"></a><a name="index-output_002dport_002dreadtable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_output-port-readtable">output-port-readtable</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures return the readtable attached to the character-port
<var>port</var>. The <var>port</var> parameter of <code>input-port-readtable</code>
must be an input-port. The <var>port</var> parameter of
<code>output-port-readtable</code> must be an output-port.
</p>
<a name="Definition_of_input-port-readtable-set!"></a><a name="Procedure_input-port-readtable-set!"></a><a name="index-input_002dport_002dreadtable_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port-readtable-set!">input-port-readtable-set!</a></b></code><i> <var>port</var> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_output-port-readtable-set!"></a><a name="Procedure_output-port-readtable-set!"></a><a name="index-output_002dport_002dreadtable_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_output-port-readtable-set!">output-port-readtable-set!</a></b></code><i> <var>port</var> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures change the readtable attached to the character-port
<var>port</var> to the readtable <var>readtable</var>. The <var>port</var> parameter
of <code>input-port-readtable-set!</code> must be an input-port. The
<var>port</var> parameter of <code>output-port-readtable-set!</code> must be an
output-port. The value returned is unspecified.
</p>
<hr size="6">
<a name="Byte_002dports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Character_002dport-operations" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Byte_002dport-settings" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Byte_002dports-1"></a>
<h2 class="section">17.6 Byte-ports</h2>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Byte_002dport-settings">17.6.1 Byte-port settings</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Byte_002dport-settings"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Byte_002dports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Byte_002dport-operations" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Byte_002dports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Byte_002dport-settings-1"></a>
<h3 class="subsection">17.6.1 Byte-port settings</h3>
<p>The following is a list of port settings that are valid for
byte-ports.
</p>
<ul>
<li>
<code>char-encoding:</code> <var>encoding</var>
<p>This setting controls the character encoding of the byte-port. For
bidirectional byte-ports, the character encoding for input and output
is set. To set each direction separately the keywords
<code>input-char-encoding:</code> and <code>output-char-encoding:</code> must be
used instead of <code>char-encoding:</code>. The default value of this
setting is operating system dependent, but this can be overridden
through the runtime options (see section <a href="#Runtime-options">Runtime options</a>). The following
encodings are supported:
</p>
<dl compact="compact">
<dt> <code>ISO-8859-1</code></dt>
<dd><p>ISO-8859-1 character encoding. Each character is encoded by a single byte.
Only Unicode characters with a code in the range 0 to 255 are allowed.
</p>
</dd>
<dt> <code>ASCII</code></dt>
<dd><p>ASCII character encoding. Each character is encoded by a single byte.
In principle only Unicode characters with a code in the range 0 to 127
are allowed but most types of ports treat this exactly like <code>ISO-8859-1</code>.
</p>
</dd>
<dt> <code>UTF-8</code></dt>
<dd><p>UTF-8 character encoding. Each character is encoded by a sequence of one
to four bytes. The minimum length UTF-8 encoding is used. If a BOM is
needed at the beginning of the stream then it must be explicitly
written.
</p>
</dd>
<dt> <code>UTF-16</code></dt>
<dd><p>UTF-16 character encoding. Each character is encoded by one or two 16
bit integers (2 or 4 bytes). The 16 bit integers may be encoded using
little-endian encoding or big-endian encoding. If the port is an
input-port and the first two bytes read are a BOM (“Byte Order Mark”
character with hexadecimal code FEFF) then the BOM will be discarded
and the endianness will be set accordingly, otherwise the endianness
depends on the operating system and how the Gambit runtime was
compiled. If the port is an output-port then a BOM will be output at
the beginning of the stream and the endianness depends on the
operating system and how the Gambit runtime was compiled.
</p>
</dd>
<dt> <code>UTF-16LE</code></dt>
<dd><p>UTF-16 character encoding with little-endian endianness. It is like
<code>UTF-16</code> except the endianness is set to little-endian and there is no
BOM processing. If a BOM is needed at the beginning of the stream
then it must be explicitly written.
</p>
</dd>
<dt> <code>UTF-16BE</code></dt>
<dd><p>UTF-16 character encoding with big-endian endianness. It is like
<code>UTF-16LE</code> except the endianness is set to big-endian.
</p>
</dd>
<dt> <code>UTF / UTF-fallback-ASCII / UTF-fallback-ISO-8859-1 / UTF-fallback-UTF-16 / UTF-fallback-UTF-16LE / UTF-fallback-UTF-16BE</code></dt>
<dd><p>These encodings combine the UTF-8 and UTF-16 encodings. When one of
these character encodings is used for an output port, characters will
be encoded using the UTF-8 encoding. The first character, if there is
one, is prefixed with a UTF-8 BOM (the three byte sequence EF BB BF in
hexadecimal). When one of these character encodings is used for an
input port, the character encoding depends on the first few bytes. If
the first bytes of the stream are a UTF-16LE BOM (FF FE in
hexadecimal), or a UTF-16BE BOM (FE FF in hexadecimal), or a UTF-8 BOM
(EF BB BF in hexadecimal), then the BOM is discarded and the remaining
bytes of the stream are decoded using the corresponding character
encoding. If a BOM is not present, then the stream is decoded using
the fallback encoding specified. The encoding <code>UTF</code> is a synonym
for <code>UTF-fallback-UTF-8</code>. Note that the <code>UTF</code> character
encoding for input will correctly handle streams produced using the
encodings <code>UTF</code>, <code>UTF-8</code>, <code>UTF-16</code>, <code>ASCII</code>, and
if an explicit BOM is output, the encodings <code>UTF-16LE</code>, and
<code>UTF-16BE</code>.
</p>
</dd>
<dt> <code>UCS-2</code></dt>
<dd><p>UCS-2 character encoding. Each character is encoded by a 16 bit
integer (2 bytes). The 16 bit integers may be encoded using
little-endian encoding or big-endian encoding. If the port is an
input-port and the first two bytes read are a BOM (“Byte Order Mark”
character with hexadecimal code FEFF) then the BOM will be discarded
and the endianness will be set accordingly, otherwise the endianness
depends on the operating system and how the Gambit runtime was
compiled. If the port is an output-port then a BOM will be output at
the beginning of the stream and the endianness depends on the
operating system and how the Gambit runtime was compiled.
</p>
</dd>
<dt> <code>UCS-2LE</code></dt>
<dd><p>UCS-2 character encoding with little-endian endianness. It is like
<code>UCS-2</code> except the endianness is set to little-endian and there is no
BOM processing. If a BOM is needed at the beginning of the stream
then it must be explicitly written.
</p>
</dd>
<dt> <code>UCS-2BE</code></dt>
<dd><p>UCS-2 character encoding with big-endian endianness. It is like
<code>UCS-2LE</code> except the endianness is set to big-endian.
</p>
</dd>
<dt> <code>UCS-4</code></dt>
<dd><p>UCS-4 character encoding. Each character is encoded by a 32 integer
(4 bytes). The 32 bit integers may be encoded using little-endian
encoding or big-endian encoding. If the port is an input-port and the
first four bytes read are a BOM (“Byte Order Mark” character with
hexadecimal code 0000FEFF) then the BOM will be discarded and the
endianness will be set accordingly, otherwise the endianness depends
on the operating system and how the Gambit runtime was compiled. If
the port is an output-port then a BOM will be output at the beginning
of the stream and the endianness depends on the operating system and
how the Gambit runtime was compiled.
</p>
</dd>
<dt> <code>UCS-4LE</code></dt>
<dd><p>UCS-4 character encoding with little-endian endianness. It is like
<code>UCS-4</code> except the endianness is set to little-endian and there is no
BOM processing. If a BOM is needed at the beginning of the stream
then it must be explicitly written.
</p>
</dd>
<dt> <code>UCS-4BE</code></dt>
<dd><p>UCS-4 character encoding with big-endian endianness. It is like
<code>UCS-4LE</code> except the endianness is set to big-endian.
</p>
</dd>
</dl>
</li><li>
<code>char-encoding-errors:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting controls whether illegal character encodings are silently
replaced with the Unicode character #xfffd (replacement character) or
raise an error. To set each direction separately the keywords
<code>input-char-encoding-errors:</code> and
<code>output-char-encoding-errors:</code> must be used instead of
<code>char-encoding-errors:</code>. The default value of this setting is
<code>#t</code>.
</p>
</li><li>
<code>eol-encoding:</code> <var>encoding</var>
<p>This setting controls the end-of-line encoding of the byte-port. To
set each direction separately the keywords <code>input-eol-encoding:</code>
and <code>output-eol-encoding:</code> must be used instead of
<code>eol-encoding:</code>. The default value of this setting is operating
system dependent, but this can be overridden through the runtime
options (see section <a href="#Runtime-options">Runtime options</a>). Note that for output-ports the
end-of-line encoding is applied before the character encoding, and for
input-ports it is applied after. The following encodings are
supported:
</p>
<dl compact="compact">
<dt> <code>lf</code></dt>
<dd><p>For an output-port, writing a <code>#\newline</code> character outputs a
<code>#\linefeed</code> character to the stream (Unicode character code 10).
For an input-port, a <code>#\newline</code> character is read when a
<code>#\linefeed</code> character is encountered on the stream. Note that
<code>#\linefeed</code> and <code>#\newline</code> are two names for the same
character, so this end-of-line encoding is actually the identity
function. Text files created by UNIX applications typically use this
end-of-line encoding.
</p>
</dd>
<dt> <code>cr</code></dt>
<dd><p>For an output-port, writing a <code>#\newline</code> character outputs a
<code>#\return</code> character to the stream (Unicode character code 13).
For an input-port, a <code>#\newline</code> character is read when a
<code>#\linefeed</code> character or a <code>#\return</code> character is
encountered on the stream. Text files created by Classic Mac OS
applications typically use this end-of-line encoding.
</p>
</dd>
<dt> <code>cr-lf</code></dt>
<dd><p>For an output-port, writing a <code>#\newline</code> character outputs to
the stream a <code>#\return</code> character followed by a <code>#\linefeed</code>
character. For an input-port, a <code>#\newline</code> character is read
when a <code>#\linefeed</code> character or a <code>#\return</code> character is
encountered on the stream. Moreover, if this character is immediately
followed by the opposite character (<code>#\linefeed</code> followed by
<code>#\return</code> or <code>#\return</code> followed by <code>#\linefeed</code>) then
the second character is ignored. In other words, all four possible
end-of-line encodings are read as a single <code>#\newline</code> character.
Text files created by DOS and Microsoft Windows applications typically
use this end-of-line encoding.
</p>
</dd>
</dl>
</li></ul>
<hr size="6">
<a name="Byte_002dport-operations"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Byte_002dport-settings" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Device_002dports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Byte_002dports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Byte_002dport-operations-1"></a>
<h3 class="subsection">17.6.2 Byte-port operations</h3>
<a name="Definition_of_read-u8"></a><a name="Procedure_read-u8"></a><a name="index-read_002du8"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_read-u8">read-u8</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure reads the byte input-port <var>port</var> and returns the
byte at the current byte location and advances the current byte
location to the next byte, unless the <var>port</var> is already at
end-of-file in which case <code>read-u8</code> returns the end-of-file
object. If it is not specified, <var>port</var> defaults to the current
input-port.
</p>
<p>This procedure must be called when the port’s input character buffer
is empty otherwise the character-stream and byte-stream may be out of
sync due to buffering. The input character buffer is used for bulk
decoding of encoded characters (i.e. to translate the byte-stream into
a character-stream). The input character buffer is initially empty.
It is only when characters are read that it is filled with characters
obtained by decoding the byte-stream.
</p>
<p>One way to ensure that the port’s input character buffer is empty is
to call <code>read-u8</code> strictly before any use of the port in a character
input operation (i.e. a call to the procedures <code>read</code>,
<code>read-char</code>, <code>peek-char</code>, etc). Alternatively
<code>input-port-characters-buffered</code> can be used to get the number of
characters in the port’s input character buffer, and to empty the
buffer with calls to <code>read-char</code> or <code>read-substring</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-u8vector
'#u8(11 22 33 44)
(lambda (p)
(let ((a (read-u8 p))) (list a (read-u8 p)))))</b>
(11 22)
> <b>(call-with-input-u8vector '#u8() read-u8)</b>
#!eof
</pre></td></tr></table>
<a name="Definition_of_write-u8"></a><a name="Procedure_write-u8"></a><a name="index-write_002du8"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_write-u8">write-u8</a></b></code><i> <var>n</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure writes the byte <var>n</var> to the byte output-port
<var>port</var> and advances the current byte location of that output-port.
The value returned is unspecified. If it is not specified, <var>port</var>
defaults to the current output-port.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-output-u8vector (lambda (p) (write-u8 33 p)))</b>
#u8(33)
</pre></td></tr></table>
<a name="Definition_of_read-subu8vector"></a><a name="Procedure_read-subu8vector"></a><a name="index-read_002dsubu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_read-subu8vector">read-subu8vector</a></b></code><i> <var>u8vector</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>need</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_write-subu8vector"></a><a name="Procedure_write-subu8vector"></a><a name="index-write_002dsubu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_write-subu8vector">write-subu8vector</a></b></code><i> <var>u8vector</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures support bulk byte I/O. The part of the u8vector
<var>u8vector</var> starting at index <var>start</var> and ending just before
index <var>end</var> is used as a byte buffer that will be the target of
<code>read-subu8vector</code> or the source of the <code>write-subu8vector</code>.
The <code>read-subu8vector</code> also accepts a <var>need</var> parameter which
must be a nonnegative fixnum. Up to <var>end</var>-<var>start</var> bytes will
be transferred. The number of bytes transferred, possibly zero, is
returned by these procedures. Fewer bytes will be read by
<code>read-subu8vector</code> if an end-of-file is read, or a timeout occurs
before all the requested bytes are transferred and the timeout thunk
returns <code>#f</code> (see the procedure <code>input-port-timeout-set!</code>),
or <var>need</var> is specified and at least that many bytes have been read
(in other words the procedure does not block for more bytes but may
transfer more bytes if they are immediately available). Fewer bytes
will be written by <code>write-subu8vector</code> if a timeout occurs before
all the requested bytes are transferred and the timeout thunk returns
<code>#f</code> (see the procedure <code>output-port-timeout-set!</code>). If it
is not specified, <var>port</var> defaults to the current input-port and
current output-port respectively.
</p>
<p>The procedure <code>read-subu8vector</code> must be called before any use of
the port in a character input operation (i.e. a call to the procedures
<code>read</code>, <code>read-char</code>, <code>peek-char</code>, etc) because
otherwise the character-stream and byte-stream may be out of sync due
to the port buffering.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v (make-u8vector 10))</b>
> <b>(read-subu8vector v 2 5)123456789</b>
3
> 456789
> <b>v</b>
#u8(0 0 49 50 51 0 0 0 0 0)
> <b>(read-subu8vector v 2 10 (current-input-port) 3)abcd</b>
5
> <b>v</b>
#u8(0 0 97 98 99 100 10 0 0 0)
</pre></td></tr></table>
<hr size="6">
<a name="Device_002dports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Byte_002dport-operations" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Filesystem-devices" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Device_002dports-1"></a>
<h2 class="section">17.7 Device-ports</h2>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Filesystem-devices"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Device_002dports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Process-devices" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Device_002dports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Filesystem-devices-1"></a>
<h3 class="subsection">17.7.1 Filesystem devices</h3>
<a name="Definition_of_open-file"></a><a name="Procedure_open-file"></a><a name="index-open_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-file">open-file</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-input-file"></a><a name="Procedure_open-input-file"></a><a name="index-open_002dinput_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-input-file">open-input-file</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-output-file"></a><a name="Procedure_open-output-file"></a><a name="index-open_002doutput_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-output-file">open-output-file</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-input-file"></a><a name="Procedure_call-with-input-file"></a><a name="index-call_002dwith_002dinput_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-input-file">call-with-input-file</a></b></code><i> <var>path-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-output-file"></a><a name="Procedure_call-with-output-file"></a><a name="index-call_002dwith_002doutput_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-output-file">call-with-output-file</a></b></code><i> <var>path-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-input-from-file"></a><a name="Procedure_with-input-from-file"></a><a name="index-with_002dinput_002dfrom_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-input-from-file">with-input-from-file</a></b></code><i> <var>path-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-output-to-file"></a><a name="Procedure_with-output-to-file"></a><a name="index-with_002doutput_002dto_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-output-to-file">with-output-to-file</a></b></code><i> <var>path-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>All of these procedures create a port to interface to a byte-stream
device (such as a file, console, serial port, named pipe, etc) whose
name is given by a path of the filesystem. The <code>direction:</code>
setting will default to the value <code>input</code> for the procedures
<code>open-input-file</code>, <code>call-with-input-file</code> and
<code>with-input-from-file</code>, to the value <code>output</code> for the
procedures <code>open-output-file</code>, <code>call-with-output-file</code> and
<code>with-output-to-file</code>, and to the value <code>input-output</code> for
the procedure <code>open-file</code>.
</p>
<p>The procedures <code>open-file</code>, <code>open-input-file</code> and
<code>open-output-file</code> return the port that is created. The
procedures <code>call-with-input-file</code> and
<code>call-with-output-file</code> call the procedure <var>proc</var> with the
port as single argument, and then return the value(s) of this call
after closing the port. The procedures <code>with-input-from-file</code>
and <code>with-output-to-file</code> dynamically bind the current input-port
and current output-port respectively to the port created for the
duration of a call to the procedure <var>thunk</var> with no argument. The
value(s) of the call to <var>thunk</var> are returned after closing the
port.
</p>
<p>The first argument of these procedures is either a string denoting a
filesystem path or a list of port settings which must contain a
<code>path:</code> setting. Here are the settings allowed in addition to
the generic settings of byte-ports:
</p>
<ul>
<li>
<code>path:</code> <var>string</var>
<p>This setting indicates the location of the file in the filesystem.
There is no default value for this setting.
</p>
</li><li>
<code>append:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting controls whether output will be added to the end of the
file. This is useful for writing to log files that might be open by
more than one process. The default value of this setting is
<code>#f</code>.
</p>
</li><li>
<code>create:</code> ( <code>#f</code> | <code>#t</code> | <code>maybe</code> )
<p>This setting controls whether the file will be created when it is
opened. A setting of <code>#f</code> requires that the file exist
(otherwise an exception is raised). A setting of <code>#t</code> requires
that the file does not exist (otherwise an exception is raised). A
setting of <code>maybe</code> will create the file if it does not exist.
The default value of this setting is <code>maybe</code> for output-ports and
<code>#f</code> for input-ports and bidirectional ports.
</p>
</li><li>
<code>permissions:</code> <var>12-bit-exact-integer</var>
<p>This setting controls the UNIX permissions that will be attached to
the file if it is created. The default value of this setting is
<code>#o666</code>.
</p>
</li><li>
<code>truncate:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting controls whether the file will be truncated when it is
opened. For input-ports, the default value of this setting is
<code>#f</code>. For output-ports, the default value of this setting is
<code>#t</code> when the <code>append:</code> setting is <code>#f</code>, and <code>#f</code>
otherwise.
</p>
</li></ul>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-output-to-file
(list path: "nofile"
create: #f)
(lambda ()
(display "hello world!\n")))</b>
*** ERROR IN (console)@1.1 -- No such file or directory
(with-output-to-file '(path: "nofile" create: #f) '#<procedure #2>)
</pre></td></tr></table>
<a name="Definition_of_input-port-byte-position"></a><a name="Procedure_input-port-byte-position"></a><a name="index-input_002dport_002dbyte_002dposition"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_input-port-byte-position">input-port-byte-position</a></b></code><i> <var>port</var> <span class="roman">[</span><var>position</var> <span class="roman">[</span><var>whence</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_output-port-byte-position"></a><a name="Procedure_output-port-byte-position"></a><a name="index-output_002dport_002dbyte_002dposition"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_output-port-byte-position">output-port-byte-position</a></b></code><i> <var>port</var> <span class="roman">[</span><var>position</var> <span class="roman">[</span><var>whence</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>When called with a single argument these procedures return the byte
position where the next I/O operation would take place in the file
attached to the given <var>port</var> (relative to the beginning of the
file). When called with two or three arguments, the byte position for
subsequent I/O operations on the given <var>port</var> is changed to
<var>position</var>, which must be an exact integer. When <var>whence</var> is
omitted or is 0, the <var>position</var> is relative to the beginning of
the file. When <var>whence</var> is 1, the <var>position</var> is relative to
the current byte position of the file. When <var>whence</var> is 2, the
<var>position</var> is relative to the end of the file. The return value
is the new byte position. On most operating systems the byte position
for reading and writing of a given bidirectional port are the same.
</p>
<p>When <code>input-port-byte-position</code> is called to change the byte
position of an input-port, all input buffers will be flushed so that
the next byte read will be the one at the given position.
</p>
<p>When <code>output-port-byte-position</code> is called to change the byte
position of an output-port, there is an implicit call to
<code>force-output</code> before the position is changed.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p <span class="roman"><i>; p is an input-output-port</i></span>
(open-file '(path: "test" char-encoding: ISO-8859-1 create: maybe)))</b>
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
(0 0)
> <b>(display "abcdefghij\n" p)</b>
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
(0 0)
> <b>(force-output p)</b>
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
(11 11)
> <b>(input-port-byte-position p 2)</b>
2
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
(2 2)
> <b>(peek-char p)</b>
#\c
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
(11 11)
> <b>(output-port-byte-position p -7 2)</b>
4
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
(4 4)
> <b>(write-char #\! p)</b>
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
(4 4)
> <b>(force-output p)</b>
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
(5 5)
> <b>(input-port-byte-position p 1)</b>
1
> <b>(read p)</b>
bcd!fghij
</pre></td></tr></table>
<hr size="6">
<a name="Process-devices"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Filesystem-devices" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Network-devices" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Device_002dports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Process-devices-1"></a>
<h3 class="subsection">17.7.2 Process devices</h3>
<a name="Definition_of_open-process"></a><a name="Procedure_open-process"></a><a name="index-open_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-process">open-process</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-input-process"></a><a name="Procedure_open-input-process"></a><a name="index-open_002dinput_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-input-process">open-input-process</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-output-process"></a><a name="Procedure_open-output-process"></a><a name="index-open_002doutput_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-output-process">open-output-process</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-input-process"></a><a name="Procedure_call-with-input-process"></a><a name="index-call_002dwith_002dinput_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-input-process">call-with-input-process</a></b></code><i> <var>path-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-output-process"></a><a name="Procedure_call-with-output-process"></a><a name="index-call_002dwith_002doutput_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-output-process">call-with-output-process</a></b></code><i> <var>path-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-input-from-process"></a><a name="Procedure_with-input-from-process"></a><a name="index-with_002dinput_002dfrom_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-input-from-process">with-input-from-process</a></b></code><i> <var>path-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-output-to-process"></a><a name="Procedure_with-output-to-process"></a><a name="index-with_002doutput_002dto_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-output-to-process">with-output-to-process</a></b></code><i> <var>path-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>All of these procedures start a new operating system process and
create a bidirectional port which allows communication with that
process on its standard input and standard output. The
<code>direction:</code> setting will default to the value <code>input</code> for
the procedures <code>open-input-process</code>,
<code>call-with-input-process</code> and <code>with-input-from-process</code>, to
the value <code>output</code> for the procedures <code>open-output-process</code>,
<code>call-with-output-process</code> and <code>with-output-to-process</code>, and
to the value <code>input-output</code> for the procedure
<code>open-process</code>. If the <code>direction:</code> setting is
<code>input</code>, the output-port side is closed. If the
<code>direction:</code> setting is <code>output</code>, the input-port side is
closed.
</p>
<p>The procedures <code>open-process</code>, <code>open-input-process</code> and
<code>open-output-process</code> return the port that is created. The
procedures <code>call-with-input-process</code> and
<code>call-with-output-process</code> call the procedure <var>proc</var> with the
port as single argument, and then return the value(s) of this call
after closing the port and waiting for the process to terminate. The
procedures <code>with-input-from-process</code> and
<code>with-output-to-process</code> dynamically bind the current input-port
and current output-port respectively to the port created for the
duration of a call to the procedure <var>thunk</var> with no argument. The
value(s) of the call to <var>thunk</var> are returned after closing the
port and waiting for the process to terminate.
</p>
<p>The first argument of this procedure is either a string denoting a
filesystem path of an executable program or a list of port settings
which must contain a <code>path:</code> setting. Here are the settings
allowed in addition to the generic settings of byte-ports:
</p>
<ul>
<li>
<code>path:</code> <var>string</var>
<p>This setting indicates the location of the executable program in the
filesystem. There is no default value for this setting.
</p>
</li><li>
<code>arguments:</code> <var>list-of-strings</var>
<p>This setting indicates the string arguments that are passed to the
program. The default value of this setting is the empty list (i.e. no
arguments).
</p>
</li><li>
<code>environment:</code> <var>list-of-strings</var>
<p>This setting indicates the set of environment variable bindings that
the process receives. Each element of the list is a string of the
form “<code><var>VAR</var>=<var>VALUE</var></code>”, where <code><var>VAR</var></code> is the
name of the variable and <code><var>VALUE</var></code> is its binding. When
<var>list-of-strings</var> is <code>#f</code>, the process inherits the
environment variable bindings of the Scheme program. The default
value of this setting is <code>#f</code>.
</p>
</li><li>
<code>directory:</code> <var>dir</var>
<p>This setting indicates the current working directory of the process.
When <var>dir</var> is <code>#f</code>, the process uses the value of
<code>(current-directory)</code>. The default value of this setting is
<code>#f</code>.
</p>
</li><li>
<code>stdin-redirection:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting indicates how the standard input of the process is
redirected. A setting of <code>#t</code> will redirect the standard input
from the process-port (i.e. what is written to the process-port will
be available on the standard input). A setting of <code>#f</code> will
leave the standard input as-is, which typically results in input
coming from the console. The default value of this setting is
<code>#t</code>.
</p>
</li><li>
<code>stdout-redirection:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting indicates how the standard output of the process is
redirected. A setting of <code>#t</code> will redirect the standard output
to the process-port (i.e. all output to standard output can be read
from the process-port). A setting of <code>#f</code> will leave the
standard output as-is, which typically results in the output going to
the console. The default value of this setting is <code>#t</code>.
</p>
</li><li>
<code>stderr-redirection:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting indicates how the standard error of the process is
redirected. A setting of <code>#t</code> will redirect the standard error
to the process-port (i.e. all output to standard error can be read
from the process-port). A setting of <code>#f</code> will leave the
standard error as-is, which typically results in error messages being
output to the console. The default value of this setting is
<code>#f</code>.
</p>
</li><li>
<code>pseudo-terminal:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting applies to UNIX. It indicates what type of device will
be bound to the process’ standard input and standard output. A
setting of <code>#t</code> will use a pseudo-terminal device (this is a
device that behaves like a tty device even though there is no real
terminal or user directly involved). A setting of <code>#f</code> will use
a pair of pipes. The difference is important for programs which
behave differently when they are used interactively, for example
shells. The default value of this setting is <code>#f</code>.
</p>
</li><li>
<code>show-console:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting applies to Microsoft Windows. It controls whether the
process’ console window will be hidden or visible. The default value
of this setting is <code>#t</code> (i.e. show the console window).
</p>
</li></ul>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-input-from-process "date" read-line)</b>
"Sun Jun 14 15:06:41 EDT 2009"
> <b>(define p (open-process (list path: "ls"
arguments: '("../examples"))))</b>
> <b>(read-line p)</b>
"README"
> <b>(read-line p)</b>
"Xlib-simple"
> <b>(close-port p)</b>
> <b>(define p (open-process "/usr/bin/dc"))</b>
> <b>(display "2 100 ^ p\n" p)</b>
> <b>(force-output p)</b>
> <b>(read-line p)</b>
"1267650600228229401496703205376"
</pre></td></tr></table>
<a name="Definition_of_process-pid"></a><a name="Procedure_process-pid"></a><a name="index-process_002dpid"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_process-pid">process-pid</a></b></code><i> <var>process-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns the PID (Process Identifier) of the process of
<var>process-port</var>. The PID is a small exact integer.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(let ((p (open-process "sort")))
(process-pid p))</b>
318
</pre></td></tr></table>
<a name="Definition_of_process-status"></a><a name="Procedure_process-status"></a><a name="index-process_002dstatus"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_process-status">process-status</a></b></code><i> <var>process-port</var> <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>timeout-val</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure causes the current thread to wait until the process of
<var>process-port</var> terminates (normally or not) or until the timeout
is reached if <var>timeout</var> is supplied. If the timeout is reached,
<var>process-status</var> returns <var>timeout-val</var> if it is supplied,
otherwise an unterminated-process-exception object is raised. The
procedure returns the process exit status as encoded by the operating
system. Typically, if the process exited normally the return value is
the process exit status multiplied by 256.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(let ((p (open-process "sort")))
(for-each (lambda (x) (pretty-print x p))
'(22 11 33))
(close-output-port p)
(let ((r (read-all p)))
(close-input-port p)
(list (process-status p) r)))</b>
(0 (11 22 33))
</pre></td></tr></table>
<a name="Definition_of_unterminated-process-exception?"></a><a name="Procedure_unterminated-process-exception?"></a><a name="index-unterminated_002dprocess_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unterminated-process-exception?">unterminated-process-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unterminated-process-exception-procedure"></a><a name="Procedure_unterminated-process-exception-procedure"></a><a name="index-unterminated_002dprocess_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unterminated-process-exception-procedure">unterminated-process-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_unterminated-process-exception-arguments"></a><a name="Procedure_unterminated-process-exception-arguments"></a><a name="index-unterminated_002dprocess_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unterminated-process-exception-arguments">unterminated-process-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Unterminated-process-exception objects are raised when a call to the
<code>process-status</code> procedure reaches its timeout before the target
process terminates and a timeout-value parameter is not specified.
The parameter <var>exc</var> must be an unterminated-process-exception
object.
</p>
<p>The procedure <code>unterminated-process-exception?</code> returns
<code>#t</code> when <var>obj</var> is an unterminated-process-exception
object and <code>#f</code> otherwise.
</p>
<p>The procedure <code>unterminated-process-exception-procedure</code>
returns the procedure that raised <var>exc</var>.
</p>
<p>The procedure <code>unterminated-process-exception-arguments</code>
returns the list of arguments of the procedure that raised <var>exc</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc)
(if (unterminated-process-exception? exc)
(list (unterminated-process-exception-procedure exc)
(unterminated-process-exception-arguments exc))
'not-unterminated-process-exception))</b>
> <b>(with-exception-catcher
handler
(lambda ()
(let ((p (open-process "sort")))
(process-status p 1))))</b>
(#<procedure #2 process-status> (#<input-output-port #3 (process "sort")>))
</pre></td></tr></table>
<hr size="6">
<a name="Network-devices"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Process-devices" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Directory_002dports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Device_002dports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Network-devices-1"></a>
<h3 class="subsection">17.7.3 Network devices</h3>
<a name="Definition_of_open-tcp-client"></a><a name="Procedure_open-tcp-client"></a><a name="index-open_002dtcp_002dclient"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-tcp-client">open-tcp-client</a></b></code><i> <var>port-number-or-address-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure opens a network connection to a socket server and
returns a tcp-client-port (a subtype of device-port) that represents
this connection and allows communication with that server. The
default value of the <code>direction:</code> setting is <code>input-output</code>,
i.e. the Scheme program can send information to the server and receive
information from the server. The sending direction can be
“shutdown” using the <code>close-output-port</code> procedure and the
receiving direction can be “shutdown” using the
<code>close-input-port</code> procedure. The <code>close-port</code> procedure
closes both directions of the connection.
</p>
<p>The parameter of this procedure is an IP port number (16-bit nonnegative
exact integer), a string of the form <code>"<var>HOST</var>:<var>PORT</var>"</code> or
a list of port settings. When the parameter is the number <var>PORT</var>
it is handled as if it was the setting <code>port-number:</code> <var>PORT</var>.
When the parameter is the string <code>"<var>HOST</var>:<var>PORT</var>"</code> it is
handled as if it was the setting <code>address:</code>
<code>"<var>HOST</var>:<var>PORT</var>"</code>.
</p>
<p>Here are the settings allowed in addition to the generic settings of
byte-ports:
</p>
<ul>
<li>
<code>address:</code> <var>string-or-ip-address</var>
<p>This setting indicates the internet address of the server, and
possibly the IP port number. When this parameter is not specified or
is <code>""</code>, the connection requests are sent to the loopback
interface (with IP address 127.0.0.1). The parameter can be a string
denoting a host name, which will be translated to an IP address by the
<code>host-info</code> procedure, or a 4 element u8vector which contains the
32-bit IPv4 address or an 8 element u16vector which contains the
128-bit IPv6 address. A string of the form
<code>"<var>HOST</var>:<var>PORT</var>"</code> is handled as if it was the combination
of settings <code>address:</code> <code>"<var>HOST</var>"</code>
<code>port-number:</code> <var>PORT</var>.
</p>
</li><li>
<code>port-number:</code> <var>16-bit-exact-integer</var>
<p>This setting indicates the IP port number of the server to connect
to (e.g. 80 for the standard HTTP server, 23 for the standard telnet
server). There is no default value for this setting.
</p>
</li><li>
<code>local-address:</code> <var>string-or-ip-address</var>
<p>This setting indicates the internet address of the local network interface
on which connections requests are initiated, and possibly the IP port
number. When this parameter is not specified or is <code>"*"</code>, the
connection requests are initiated on any network interface
(i.e. address INADDR_ANY). When this parameter is <code>""</code>, the
connection requests are initiated only on the loopback interface (with
IP address 127.0.0.1). The parameter can be a string denoting a
host name, which will be translated to an IP address by the
<code>host-info</code> procedure, or a 4 element u8vector which contains the
32-bit IPv4 address or an 8 element u16vector which contains the
128-bit IPv6 address. A string of the form
<code>"<var>INTF</var>:<var>PORT</var>"</code> is handled as if it was the combination
of settings <code>local-address:</code> <code>"<var>INTF</var>"</code>
<code>local-port-number:</code> <var>PORT</var>.
</p>
</li><li>
<code>local-port-number:</code> <var>16-bit-exact-integer</var>
<p>This setting indicates the IP port number assigned to the socket which
initiates connection requests. The special value 0 requests that a
currently unused port number be assigned to the socket.
This is the default value for this setting.
</p>
</li><li>
<code>keep-alive:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting controls the use of the “keep alive” option on the
connection. The “keep alive” option will periodically send control
packets on otherwise idle network connections to ensure that the
server host is active and reachable. The default value of this
setting is <code>#f</code>.
</p>
</li><li>
<code>coalesce:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting controls the use of TCP’s “Nagle algorithm” which
reduces the number of small packets by delaying their transmission and
coalescing them into larger packets. A setting of <code>#t</code> will
coalesce small packets into larger ones. A setting of <code>#f</code> will
transmit packets as soon as possible. The default value of this
setting is <code>#t</code>. Note that this setting does not affect the
buffering of the port.
</p>
</li><li>
<code>tls-context:</code> ( <code>#f</code> | <var>tls-context</var> )
<p>This setting controls the use of TLS encryption. If provided, the client
will use this configuration for setting up a TCP connection with TLS
encryption, otherwise it will use a plain TCP connection as usual. Please
note that Gambit must be compiled with TLS support for this option to be
implemented. See <code>make-tls-context</code> for futher information. The
default value of this setting is <code>#f</code>.
</p>
</li></ul>
<p>Below is an example of the client-side code that opens a connection to
an HTTP server on port 8080 of the loopback interface (with IP address
127.0.0.1). For the server-side code see the example for the
procedure <code>open-tcp-server</code>.
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-tcp-client (list port-number: 8080
eol-encoding: 'cr-lf)))</b>
> <b>p</b>
#<input-output-port #2 (tcp-client #u8(127 0 0 1) 8080)>
> <b>(display "GET /\n" p)</b>
> <b>(force-output p)</b>
> <b>(read-line p)</b>
"<HTML>"
</pre></td></tr></table>
<a name="Definition_of_open-tcp-server"></a><a name="Procedure_open-tcp-server"></a><a name="index-open_002dtcp_002dserver"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-tcp-server">open-tcp-server</a></b></code><i> <var>port-number-or-address-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure sets up a socket to accept network connection requests
from clients and returns a tcp-server-port from which network
connections to clients are obtained. Tcp-server-ports are a direct
subtype of object-ports (i.e. they are not character-ports) and are
input-ports. Reading from a tcp-server-port with the <code>read</code>
procedure will block until a network connection request is received
from a client. The <code>read</code> procedure will then return a
tcp-client-port (a subtype of device-port) that represents this
connection and allows communication with that client. Closing a
tcp-server-port with either the <code>close-input-port</code> or
<code>close-port</code> procedures will cause the network subsystem to stop
accepting connections on that socket.
</p>
<p>The parameter of this procedure is an IP port number (16-bit nonnegative
exact integer), a string of the form <code>"<var>INTF</var>:<var>PORT</var>"</code> or
a list of port settings which must contain a <code>local-port-number:</code>
setting. When the parameter is the number <var>PORT</var> it is handled as
if it was the setting <code>local-port-number:</code> <var>PORT</var>. When the
parameter is the string <code>"<var>INTF</var>:<var>PORT</var>"</code> it is handled
as if it was the setting <code>local-address:</code>
<code>"<var>INTF</var>:<var>PORT</var>"</code>.
</p>
<p>Below is a list of the settings allowed in addition to the settings
<code>keep-alive:</code> and <code>coalesce:</code> allowed by the
<code>open-tcp-client</code> procedure and the generic settings of
byte-ports. The settings which are not listed below apply to the
tcp-client-port that is returned by <code>read</code> when a connection is
accepted and have the same meaning as if they were used in a call to
the <code>open-tcp-client</code> procedure.
</p>
<ul>
<li>
<code>local-address:</code> <var>string-or-ip-address</var>
<p>This setting indicates the internet address of the local network interface
on which connections requests are accepted, and possibly the IP port
number. When this parameter is not specified or is <code>""</code>, the
connection requests are accepted only on the loopback interface (with
IP address 127.0.0.1). When this parameter is <code>"*"</code>, the
connection requests are accepted on all network interfaces
(i.e. address INADDR_ANY). The parameter can be a string denoting a
host name, which will be translated to an IP address by the
<code>host-info</code> procedure, or a 4 element u8vector which contains the
32-bit IPv4 address or an 8 element u16vector which contains the
128-bit IPv6 address. A string of the form
<code>"<var>INTF</var>:<var>PORT</var>"</code> is handled as if it was the combination
of settings <code>local-address:</code> <code>"<var>INTF</var>"</code>
<code>local-port-number:</code> <var>PORT</var>.
</p>
</li><li>
<code>local-port-number:</code> <var>16-bit-exact-integer</var>
<p>This setting indicates the IP port number assigned to the socket which
accepts connection requests from clients. So called “well-known
ports”, which are reserved for standard services, have a port number
below 1024 and can only be assigned to a socket by a process with
superuser priviledges (e.g. 80 for the HTTP service, 23 for the telnet
service). No special priviledges are needed to assign higher
port numbers to a socket. The special value 0 requests that a
currently unused port number be assigned to the socket (the port
number assigned can be retrieved using the procedure
<code>tcp-server-socket-info</code>). There is no default value for this
setting.
</p>
</li><li>
<code>backlog:</code> <var>positive-exact-integer</var>
<p>This setting indicates the maximum number of connection requests that
can be waiting to be accepted by a call to <code>read</code> (technically it
is the value passed as the second argument of the UNIX <code>listen()</code>
function). The default value of this setting is 128.
</p>
</li><li>
<code>reuse-address:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting controls whether it is possible to assign a port number
that is currently active. Note that when a server process terminates,
the socket it was using to accept connection requests does not become
inactive immediately. Instead it remains active for a few minutes to
ensure clean termination of the connections. A setting of <code>#f</code>
will cause an exception to be raised in that case. A setting of
<code>#t</code> will allow a port number to be used even if it is active.
The default value of this setting is <code>#t</code>.
</p>
</li><li>
<code>tls-context:</code> ( <code>#f</code> | <var>tls-context</var> )
<p>This setting controls the use of TLS encryption. If provided, the server
will use this configuration for accepting TCP connections with TLS
encryption, otherwise it will accept plain TCP connections as usual. Please
note that Gambit must be compiled with TLS support for this option to be
implemented. See <code>make-tls-context</code> for futher information. The
default value of this setting is <code>#f</code>.
</p>
</li></ul>
<p>Below is an example of the server-side code that accepts connections
on port 8080 of any network interface. For the client-side code see
the example for the procedure <code>open-tcp-client</code>.
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (open-tcp-server (list local-address: "*"
local-port-number: 8080
eol-encoding: 'cr-lf)))</b>
> <b>(define p (read s)) <span class="roman"><i>; blocks until client connects</i></span></b>
> <b>p</b>
#<input-output-port #2 (tcp-client 8080)>
> <b>(read-line p)</b>
"GET /"
> <b>(display "<HTML>\n" p)</b>
> <b>(force-output p)</b>
</pre></td></tr></table>
<a name="Definition_of_tcp-service-register!"></a><a name="Procedure_tcp-service-register!"></a><a name="index-tcp_002dservice_002dregister_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tcp-service-register!">tcp-service-register!</a></b></code><i> <var>port-number-or-address-or-settings</var> <var>thunk</var> <span class="roman">[</span><var>thread-group</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_tcp-service-unregister!"></a><a name="Procedure_tcp-service-unregister!"></a><a name="index-tcp_002dservice_002dunregister_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_tcp-service-unregister!">tcp-service-unregister!</a></b></code><i> <var>port-number-or-address-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>tcp-service-register!</code> sets up a socket to accept
network connection requests from clients and creates a “service”
thread which processes the incoming connections. The parameter
<var>port-number-or-address-or-settings</var> has the same meaning as for
the procedure <code>open-tcp-server</code>.
</p>
<p>For each connection established the service thread creates a
“handler” thread which executes a call to the procedure <var>thunk</var>
with no argument. The handler thread’s current input-port and current
output-port are both set to the tcp-client-port created for the
connection. There is no need for the <var>thunk</var> to close the
tcp-client-port, as this is done by the handler thread when the
<var>thunk</var> returns normally.
</p>
<p>The procedure <code>tcp-service-unregister!</code> terminates the service
thread which was registered by <code>tcp-service-register!</code> with the
same network interface and port number (if a service thread is still
registered). The procedure <code>tcp-service-register!</code> implicitly
calls <code>tcp-service-unregister!</code> before registering the new
service thread.
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(tcp-service-register!
8000
(lambda () (display "hello\n")))</b>
> <b>(define p (open-tcp-client 8000))</b>
> <b>(read-line p)</b>
"hello"
> <b>(tcp-service-unregister! 8000)</b>
</pre></td></tr></table>
<a name="Definition_of_make-tls-context"></a><a name="Procedure_make-tls-context"></a><a name="index-make_002dtls_002dcontext"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_make-tls-context">make-tls-context</a></b></code><i> <span class="roman">[</span><var>options</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure requires Gambit to be compiled with TLS support, which is
currently provided by OpenSSL. The <code>--enable-openssl</code> flag of the configure
script will activate it, provided that you have the OpenSSL library and headers
installed. It is strongly recommended that versions above 1.x are used.
On OSX, this means updating the OpenSSL bundled by default. This can be achieved
using Homebrew, but manual installation or any other package manager will do.
Some notes on Windows with MinGW are also relevant here. Once you have a sane
MinGW environment, remember to decompress the OpenSSL tarball with the tar
utility, otherwise links to files won’t work during the compilation process. The
recommended build procedure for MinGW is as follows.
</p>
<p>Configure OpenSSL on MinGW 32 bits:
</p>
<table><tr><td> </td><td><pre class="smallexample">perl Configure mingw no-asm --prefix=/usr/local --openssldir=/usr/local/openssl
</pre></td></tr></table>
<p>Configure OpenSSL on MinGW 64 bits:
</p>
<table><tr><td> </td><td><pre class="smallexample">perl Configure mingw64 no-asm --prefix=/usr/local --openssldir=/usr/local/openssl
</pre></td></tr></table>
<p>Build and install with the following commands:
</p>
<table><tr><td> </td><td><pre class="smallexample">make depend
make
make install
</pre></td></tr></table>
<p>A TLS context describes the options that will be used for setting up a TLS
connection. If no TLS context is provided to <code>open-tcp-client</code> or
<code>open-tcp-server</code>, regular TCP connections without encryption will be used
instead. The result of this procedure is a <code>SSL_CTX</code> pointer, which can be
further manipulated with custom OpenSSL bindings. The configuration options are:
</p>
<ul>
<li>
<code>min-version:</code> <var>symbol</var>
<p>Establish a minimum TLS version for the connection. If the other peer doesn’t
support or agree with it, the connection will fail. Possible options (support
depends on linked OpenSSL version): <code>ssl-v2</code>, <code>ssl-v3</code>, <code>tls-v1</code>,
<code>tls-v1.1</code>, <code>tls-v1.2</code>.
</p>
</li><li>
<code>options:</code> <var>list-of-symbols</var>
<p>A list of flags enabling/disabling TLS options. <code>server-mode</code> is required
for using the TLS context with <code>open-tcp-server</code>. <code>use-diffie-hellman</code>
enables the Diffie-Hellman key exchange. <code>use-elliptic-curves</code> enables
Elliptic Curves. If no curve name is provided (with <code>elliptic-curve:</code>),
<code>prime256v1</code> will be used. <code>request-client-authentication</code> is used by
a server to enable request of authentication to clients.
<code>insert-empty-fragments</code> enables a countermeasure against a SSL 3.0/TLS 1.0
protocol vulnerability affecting CBC ciphers. If used, the resulting connection
may not be handled by some broken SSL implementations. This option has no effect
for connections using other ciphers.
</p>
</li><li>
<code>certificate:</code> <var>path</var>
<p>Path to PEM Certificate file. This is a recommended option. If not provided
OpenSSL will try to use anonymous cipher suites.
</p>
</li><li>
<code>private-key:</code> <var>path</var>
<p>Path to PEM Private Key file. If not provided, the Certificate path will be used
instead.
</p>
</li><li>
<code>client-ca:</code> <var>path</var>
<p>Path to PEM file containing Certificate Authorities allowed for client
authentication. Used only if <code>request-client-authentication</code> option is
enabled.
</p>
</li><li>
<code>elliptic-curve:</code> <var>string</var>
<p>Name of the Elliptic Curve to use, according to RFC 4492. Used only if
<code>use-elliptic-curves</code> option is enabled.
</p>
</li></ul>
<p>TCP Client example with TLS encryption.
</p>
<table><tr><td> </td><td><pre class="smallexample">(define ctx (make-tls-context))
(define c (open-tcp-client (list address: "twitter.com"
port-number: 443
tls-context: ctx)))
(display "GET / HTTP/1.1\nHost: twitter.com\n\n" c)
(force-output c)
(read-line c)
</pre></td></tr></table>
<p>TCP Server example with several options. These are not mandatory, except
for <code>server-mode</code>.
</p>
<table><tr><td> </td><td><pre class="smallexample">(define ctx (make-tls-context options: '(server-mode
use-diffie-hellman
use-elliptic-curves)
certificate: "server.pem"
diffie-hellman-parameters: "dh_param_1024.pem"
elliptic-curve: "prime256v1"))
(define s (open-tcp-server (list local-address: "localhost"
local-port-number: 1443
tls-context: ctx)))
(define p (read s))
(display "<HTML></HTML>\n" p)
(force-output p)
</pre></td></tr></table>
<p>A practical way of testing TLS options are the <code>s_server</code> and
<code>s_client</code> commands of the <code>openssl</code> tool.
</p>
<a name="Definition_of_open-udp"></a><a name="Procedure_open-udp"></a><a name="index-open_002dudp"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-udp">open-udp</a></b></code><i> <var>port-number-or-address-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure opens a socket for doing network communication with the
UDP protocol. The default value of the <code>direction:</code> setting is
<code>input-output</code>, i.e. the Scheme program can send information and
receive information on the socket. The sending direction can be
closed using the <code>close-output-port</code> procedure and the receiving
direction can be closed using the <code>close-input-port</code> procedure.
The <code>close-port</code> procedure closes both directions.
</p>
<p>The resulting port designates a UDP socket. Each call to <code>read</code>
and <code>udp-read-subu8vector</code> causes the reception of a single
datagram on the designated UDP socket, and each call to <code>write</code>
and <code>udp-write-subu8vector</code> sends a single datagram. UDP ports
are a direct subtype of object-ports (i.e. they are not
character-ports) and <code>read</code> and <code>write</code> transfer u8vectors.
If <code>read</code> is called and a timeout occurs before a datagram is
transferred and the timeout thunk returns <code>#f</code> (see the procedure
<code>input-port-timeout-set!</code>) then the end-of-file object is
returned.
</p>
<p>The parameter of this procedure is an IP port number (16-bit nonnegative
exact integer), a string of the form <code>"<var>HOST</var>:<var>PORT</var>"</code> or
a list of port settings. When the parameter is the number <var>PORT</var>
it is handled as if it was the setting <code>local-port-number:</code> <var>PORT</var>.
When the parameter is the string <code>"<var>HOST</var>:<var>PORT</var>"</code> it is
handled as if it was the setting <code>local-address:</code>
<code>"<var>HOST</var>:<var>PORT</var>"</code>.
</p>
<p>Here are the settings allowed:
</p>
<ul>
<li>
<code>direction:</code> ( <code>input</code> | <code>output</code> | <code>input-output</code> )
<p>This setting controls the direction of the port. The symbol
<code>input</code> indicates a unidirectional input-port, the symbol
<code>output</code> indicates a unidirectional output-port, and the symbol
<code>input-output</code> indicates a bidirectional port. The default
value of this setting is <code>input-output</code>.
</p>
</li><li>
<code>local-address:</code> <var>string-or-ip-address</var>
<p>This setting indicates the internet address of the local network
interface on which the socket is open and possibly the IP port number.
When this parameter is not specified or is <code>""</code>, the socket is
open on the loopback interface (with IP address 127.0.0.1).
When this parameter is <code>"*"</code> the socket is open on all network
interfaces (i.e. address INADDR_ANY). The parameter can be a string
denoting a host name, which will be translated to an IP address by the
<code>host-info</code> procedure, or a 4 element u8vector which contains the
32-bit IPv4 address or an 8 element u16vector which contains the
128-bit IPv6 address. A string of the form
<code>"<var>INTF</var>:<var>PORT</var>"</code> is handled as if it was the combination
of settings <code>local-address:</code> <code>"<var>INTF</var>"</code>
<code>local-port-number:</code> <var>PORT</var>.
</p>
</li><li>
<code>local-port-number:</code> <var>16-bit-exact-integer</var>
<p>This setting indicates the IP port number assigned to the socket. The
special value 0 requests that a currently unused port number be
assigned to the socket. This is the default value for this setting.
</p>
</li><li>
<code>address:</code> <var>string-or-ip-address</var>
<p>This setting indicates the initial destination internet address of the
datagrams, and possibly the IP port number. When this parameter is not
specified the destination is set to the local address if it is not all
network interfaces (i.e. <code>"*"</code> = address INADDR_ANY). When this
parameter is <code>""</code> or this parameter is not specified and the
local address is all network interfaces, the destination is set to the
loopback interface (with IP address 127.0.0.1). The parameter can be
a string denoting a host name, which will be translated to an IP
address by the <code>host-info</code> procedure, or a 4 element u8vector
which contains the 32-bit IPv4 address or an 8 element u16vector which
contains the 128-bit IPv6 address. A string of the form
<code>"<var>HOST</var>:<var>PORT</var>"</code> is handled as if it was the combination
of settings <code>address:</code> <code>"<var>HOST</var>"</code> <code>port-number:</code>
<var>PORT</var>.
</p>
</li><li>
<code>port-number:</code> <var>16-bit-exact-integer</var>
<p>This setting indicates the initial destination IP port number of the
datagrams. It defaults to the local port number.
</p>
</li></ul>
<a name="Definition_of_udp-destination-set!"></a><a name="Procedure_udp-destination-set!"></a><a name="index-udp_002ddestination_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_udp-destination-set!">udp-destination-set!</a></b></code><i> <var>address</var> <var>port-number</var> <span class="roman">[</span><var>udp-port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure sets the destination address and port-number for the
next datagram sent on the UDP socket designated by <var>udp-port</var>,
obtained with a call to <code>open-udp</code>. If it is not specified,
<var>udp-port</var> defaults to the current output-port.
</p>
<a name="Definition_of_udp-read-u8vector"></a><a name="Procedure_udp-read-u8vector"></a><a name="index-udp_002dread_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_udp-read-u8vector">udp-read-u8vector</a></b></code><i> <span class="roman">[</span><var>udp-port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_udp-write-u8vector"></a><a name="Procedure_udp-write-u8vector"></a><a name="index-udp_002dwrite_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_udp-write-u8vector">udp-write-u8vector</a></b></code><i> <var>u8vector</var> <span class="roman">[</span><var>udp-port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_udp-read-subu8vector"></a><a name="Procedure_udp-read-subu8vector"></a><a name="index-udp_002dread_002dsubu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_udp-read-subu8vector">udp-read-subu8vector</a></b></code><i> <var>u8vector</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>udp-port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_udp-write-subu8vector"></a><a name="Procedure_udp-write-subu8vector"></a><a name="index-udp_002dwrite_002dsubu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_udp-write-subu8vector">udp-write-subu8vector</a></b></code><i> <var>u8vector</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>udp-port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures receive and send datagrams on the UDP socket
designated by <var>udp-port</var>, obtained with a call to <code>open-udp</code>.
If it is not specified, <var>udp-port</var> defaults to the current
input-port for <code>udp-read-u8vector</code> and
<code>udp-read-subu8vector</code> and to the current output-port for
<code>udp-write-u8vector</code> and <code>udp-write-subu8vector</code>.
</p>
<p>These procedures are similar in function to <code>read-subu8vector</code>
and <code>write-subu8vector</code>, but because they read or write a group
of bytes at a time rather than a stream of bytes, they are distinct
procedures with slightly different APIs.
</p>
<p>The procedure <code>udp-read-u8vector</code> receives the next datagram and
returns it in a fresh u8vector. If a timeout occurs before a datagram
is transferred and the timeout thunk returns <code>#f</code> (see the
procedure <code>input-port-timeout-set!</code>) then <code>#f</code> is returned.
</p>
<p>The procedure <code>udp-write-u8vector</code> sends as a datagram the
u8vector <var>u8vector</var>.
</p>
<p>For the procedures <code>udp-read-subu8vector</code> and
<code>udp-write-subu8vector</code>, the part of the u8vector <var>u8vector</var>
starting at index <var>start</var> and ending just before index <var>end</var>
is used as a byte buffer that will be the target of
<code>udp-read-subu8vector</code> or the source of the
<code>udp-write-subu8vector</code>. Up to <var>end</var>-<var>start</var> bytes will
be transferred. The number of bytes transferred, possibly zero, is
returned by these procedures, unless a timeout occurs (see below).
Fewer bytes will be read by <code>udp-read-subu8vector</code> if the
received datagram’s length is less than <var>end</var>-<var>start</var>.
<code>udp-write-subu8vector</code> always transfers <var>end</var>-<var>start</var>
bytes, but note that this must be less than 65536 bytes, and some
operating systems have a lower limit (for example MacOS limits the
number of bytes to 9216 by default). If a timeout occurs before a
datagram is transferred and the timeout thunk returns <code>#f</code> (see
the procedure <code>input-port-timeout-set!</code>) then <code>#f</code> is
returned by these procedures (this is different from the procedures
<code>read-subu8vector</code> and <code>write-subu8vector</code> which return 0).
</p>
<p>For <code>udp-write-u8vector</code> and <code>udp-write-subu8vector</code> the
datagram’s destination is the address initially supplied when
<code>open-udp</code> was called, or the latest address set when
<code>udp-destination-set!</code> was called.
</p>
<p>Here is an example of sending a 3 byte datagram to port 5678 of the
loopback interface (with IP address 127.0.0.1):
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-udp (list address: '#u8(127 0 0 1) port-number: 5678)))</b>
> <b>(write '#u8(11 22 33) p)</b>
</pre></td></tr></table>
<p>An alternative approach is to use <code>udp-destination-set!</code>:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-udp))</b>
> <b>(udp-destination-set! '#u8(127 0 0 1) 5678 p)</b>
> <b>(write '#u8(11 22 33) p)</b>
</pre></td></tr></table>
<p>Another approach is to use <code>udp-write-subu8vector</code>:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-udp))</b>
> <b>(udp-destination-set! '#u8(127 0 0 1) 5678 p)</b>
> <b>(define v '#u8(11 22 33))</b>
> <b>(udp-write-subu8vector v 0 3 p)</b>
3
</pre></td></tr></table>
<p>Note that by default the internet address of the local network
interface is the loopback interface, which is not connected to the
internet. To contact an external socket the address of the local
network interface must be specified, for example <code>"*"</code> will
select all interfaces. The following example shows how to connect to
a Time Protocol server to get the current time:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-udp (list local-address: "*" address: "time.nist.gov:37")))</b>
> <b>(write '#u8() p)</b>
> <b>(read p)</b>
#u8(222 27 158 226)
</pre></td></tr></table>
<p>Here is an example of receiving a 3 byte datagram on port 5678 of the
loopback interface:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-udp 5678))</b>
> <b>(read p)</b>
#u8(11 22 33)
</pre></td></tr></table>
<p>An alternative approach is to use <code>udp-read-subu8vector</code>:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-udp 5678))</b>
> <b>(define v (make-u8vector 10000))</b>
> <b>(udp-read-subu8vector v 0 10000 p)</b>
3
> <b>(subu8vector v 0 3)</b>
#u8(11 22 33)
</pre></td></tr></table>
<p>Note that using <code>udp-read-subu8vector</code> and
<code>udp-write-subu8vector</code> is typically more efficient than
<code>read</code> and <code>write</code> because it avoids having to construct a
new u8vector for each datagram transferred.
</p>
<a name="Definition_of_udp-local-socket-info"></a><a name="Procedure_udp-local-socket-info"></a><a name="index-udp_002dlocal_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_udp-local-socket-info">udp-local-socket-info</a></b></code><i> <var>udp-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_udp-source-socket-info"></a><a name="Procedure_udp-source-socket-info"></a><a name="index-udp_002dsource_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_udp-source-socket-info">udp-source-socket-info</a></b></code><i> <var>udp-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>udp-local-socket-info</code> returns the local
socket-info of the UDP socket designated by <var>udp-port</var>.
</p>
<p>The procedure <code>udp-source-socket-info</code> returns the socket-info of
the source of the latest datagram received on the UDP socket
designated by <var>udp-port</var>. When a datagram hasn’t been received
yet, <code>#f</code> is returned.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-udp (list local-address: "*" address: "time.nist.gov:37")))</b>
> <b>(udp-local-socket-info p)</b>
#<socket-info #2 family: INET port-number: 64716 address: #f>
> <b>(udp-source-socket-info p)</b>
#f
> <b>(write '#u8() p)</b>
> <b>(read p)</b>
#u8(222 27 162 109)
> <b>(udp-source-socket-info p)</b>
#<socket-info #3 family: INET port-number: 37 address: #u8(132 163 97 4)>
</pre></td></tr></table>
<hr size="6">
<a name="Directory_002dports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Network-devices" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Vector_002dports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Directory_002dports-1"></a>
<h2 class="section">17.8 Directory-ports</h2>
<a name="Definition_of_open-directory"></a><a name="Procedure_open-directory"></a><a name="index-open_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-directory">open-directory</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure opens a directory of the filesystem for reading its
entries and returns a directory-port from which the entries can be
enumerated. Directory-ports are a direct subtype of object-ports
(i.e. they are not character-ports) and are input-ports. Reading from
a directory-port with the <code>read</code> procedure returns the next file
name in the directory as a string. The end-of-file object is returned
when all the file names have been enumerated. Another way to get the
list of all files in a directory is the <code>directory-files</code>
procedure which returns a list of the files in the directory. The
advantage of using directory-ports is that it allows iterating over
the files in a directory in constant space, which is interesting when
the number of files in the directory is not known in advance and may
be large. Note that the order in which the names are returned is
operating-system dependent.
</p>
<p>The parameter of this procedure is either a string denoting a
filesystem path to a directory or a list of port settings which must
contain a <code>path:</code> setting. Here are the settings allowed in
addition to the generic settings of object-ports:
</p>
<ul>
<li>
<code>path:</code> <var>string</var>
<p>This setting indicates the location of the directory in the filesystem.
There is no default value for this setting.
</p>
</li><li>
<code>ignore-hidden:</code> ( <code>#f</code> | <code>#t</code> | <code>dot-and-dot-dot</code> )
<p>This setting controls whether hidden-files will be returned. Under
UNIX and Mac OS X hidden-files are those that start with a period
(such as ‘<samp>.</samp>’, ‘<samp>..</samp>’, and ‘<samp>.profile</samp>’). Under Microsoft
Windows hidden files are the ‘<samp>.</samp>’ and ‘<samp>..</samp>’ entries and the
files whose “hidden file” attribute is set. A setting of <code>#f</code>
will enumerate all the files. A setting of <code>#t</code> will only
enumerate the files that are not hidden. A setting of
<code>dot-and-dot-dot</code> will enumerate all the files except for the
‘<samp>.</samp>’ and ‘<samp>..</samp>’ hidden files. The default value of this
setting is <code>#t</code>.
</p>
</li></ul>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(let ((p (open-directory (list path: "../examples"
ignore-hidden: #f))))
(let loop ()
(let ((fn (read p)))
(if (string? fn)
(begin
(pp (path-expand fn))
(loop)))))
(close-input-port p))</b>
"/u/feeley/examples/."
"/u/feeley/examples/.."
"/u/feeley/examples/complex"
"/u/feeley/examples/README"
"/u/feeley/examples/simple"
> <b>(define x (open-directory "../examples"))</b>
> <b>(read-all x)</b>
("complex" "README" "simple")
</pre></td></tr></table>
<hr size="6">
<a name="Vector_002dports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Directory_002dports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#String_002dports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Vector_002dports-1"></a>
<h2 class="section">17.9 Vector-ports</h2>
<a name="Definition_of_open-vector"></a><a name="Procedure_open-vector"></a><a name="index-open_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-vector">open-vector</a></b></code><i> <span class="roman">[</span><var>vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-input-vector"></a><a name="Procedure_open-input-vector"></a><a name="index-open_002dinput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-input-vector">open-input-vector</a></b></code><i> <span class="roman">[</span><var>vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-output-vector"></a><a name="Procedure_open-output-vector"></a><a name="index-open_002doutput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-output-vector">open-output-vector</a></b></code><i> <span class="roman">[</span><var>vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-input-vector"></a><a name="Procedure_call-with-input-vector"></a><a name="index-call_002dwith_002dinput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-input-vector">call-with-input-vector</a></b></code><i> <var>vector-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-output-vector"></a><a name="Procedure_call-with-output-vector"></a><a name="index-call_002dwith_002doutput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-output-vector">call-with-output-vector</a></b></code><i> <span class="roman">[</span><var>vector-or-settings<span class="roman">]</span></var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-input-from-vector"></a><a name="Procedure_with-input-from-vector"></a><a name="index-with_002dinput_002dfrom_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-input-from-vector">with-input-from-vector</a></b></code><i> <var>vector-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-output-to-vector"></a><a name="Procedure_with-output-to-vector"></a><a name="index-with_002doutput_002dto_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-output-to-vector">with-output-to-vector</a></b></code><i> <span class="roman">[</span><var>vector-or-settings</var><span class="roman">]</span> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>Vector-ports represent streams of Scheme objects. They are a direct
subtype of object-ports (i.e. they are not character-ports). All of
these procedures create vector-ports that are either unidirectional or
bidirectional. The <code>direction:</code> setting will default to the
value <code>input</code> for the procedures <code>open-input-vector</code>,
<code>call-with-input-vector</code> and <code>with-input-from-vector</code>, to
the value <code>output</code> for the procedures <code>open-output-vector</code>,
<code>call-with-output-vector</code> and <code>with-output-to-vector</code>, and
to the value <code>input-output</code> for the procedure <code>open-vector</code>.
Bidirectional vector-ports behave like FIFOs: data written to the port
is added to the end of the stream that is read. It is only when a
bidirectional vector-port’s output-side is closed with a call to the
<code>close-output-port</code> procedure that the stream’s end is known
(when the stream’s end is reached, reading the port returns the
end-of-file object).
</p>
<p>The procedures <code>open-vector</code>, <code>open-input-vector</code> and
<code>open-output-vector</code> return the port that is created. The
procedures <code>call-with-input-vector</code> and
<code>call-with-output-vector</code> create a vector port, call the
procedure <var>proc</var> with the port as single argument and then close
the port. The procedures <code>with-input-from-vector</code> and
<code>with-output-to-vector</code> create a vector port, dynamically bind
the current input-port and current output-port respectively to the
port created for the duration of a call to the procedure <var>thunk</var>
with no argument, and then close the port. The procedures
<code>call-with-input-vector</code> and <code>with-input-from-vector</code> return
the value returned by the procedures <var>proc</var> and <var>thunk</var>
respectively. The procedures <code>call-with-output-vector</code> and
<code>with-output-to-vector</code> return the vector accumulated in the port
(see <code>get-output-vector</code>).
</p>
<p>The <var>vector-or-settings</var> parameter of these procedures is either a
vector of the elements used to initialize the stream or a list of port
settings. If it is not specified, the parameter of the
<code>open-vector</code>, <code>open-input-vector</code>,
<code>open-output-vector</code>, <code>with-output-to-vector</code>, and
<code>call-with-output-vector</code> procedures defaults to an empty list of
port settings. Here are the settings allowed in addition to the
generic settings of object-ports:
</p>
<ul>
<li>
<code>init:</code> <var>vector</var>
<p>This setting indicates the initial content of the stream. The default
value of this setting is an empty vector.
</p>
</li><li>
<code>permanent-close:</code> ( <code>#f</code> | <code>#t</code> )
<p>This setting controls whether a call to the procedures
<code>close-output-port</code> will close the output-side of a bidirectional
vector-port permanently or not. A permanently closed bidirectional
vector-port whose end-of-file has been reached on the input-side will
return the end-of-file object for all subsequent calls to the
<code>read</code> procedure. A non-permanently closed bidirectional
vector-port will return to its opened state when its end-of-file is
read. The default value of this setting is <code>#t</code>.
</p>
</li></ul>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-vector))</b>
> <b>(write 1 p)</b>
> <b>(write 2 p)</b>
> <b>(write 3 p)</b>
> <b>(force-output p)</b>
> <b>(read p)</b>
1
> <b>(read p)</b>
2
> <b>(close-output-port p)</b>
> <b>(read p)</b>
3
> <b>(read p)</b>
#!eof
> <b>(with-output-to-vector (lambda () (write 1) (write 2)))</b>
#(1 2)
</pre></td></tr></table>
<a name="Definition_of_open-vector-pipe"></a><a name="Procedure_open-vector-pipe"></a><a name="index-open_002dvector_002dpipe"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-vector-pipe">open-vector-pipe</a></b></code><i> <span class="roman">[</span><var>vector-or-settings1</var> <span class="roman">[</span><var>vector-or-settings2</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>open-vector-pipe</code> creates two vector-ports and
returns these two ports. The two ports are interrelated as follows:
the first port’s output-side is connected to the second port’s
input-side and the first port’s input-side is connected to the second
port’s output-side. The value <var>vector-or-settings1</var> is used to
setup the first vector-port and <var>vector-or-settings2</var> is used to
setup the second vector-port. The same settings as for
<code>open-vector</code> are allowed. The default <code>direction:</code> setting
is <code>input-output</code> (i.e. a bidirectional port is created). If it
is not specified <var>vector-or-settings1</var> defaults to the empty list.
If it is not specified <var>vector-or-settings2</var> defaults to
<var>vector-or-settings1</var> but with the <code>init:</code> setting set to the
empty vector and with the input and output settings exchanged (e.g. if
the first port is an input-port then the second port is an
output-port, if the first port’s input-side is non-buffered then the
second port’s output-side is non-buffered).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (server op)
(receive (c s) (open-vector-pipe) <span class="roman"><i>; client-side and server-side ports</i></span>
(thread-start!
(make-thread
(lambda ()
(let loop ()
(let ((request (read s)))
(if (not (eof-object? request))
(begin
(write (op request) s)
(newline s)
(force-output s)
(loop))))))))
c))</b>
> <b>(define a (server (lambda (x) (expt 2 x))))</b>
> <b>(define b (server (lambda (x) (expt 10 x))))</b>
> <b>(write 100 a)</b>
> <b>(write 30 b)</b>
> <b>(read a)</b>
1267650600228229401496703205376
> <b>(read b)</b>
1000000000000000000000000000000
</pre></td></tr></table>
<a name="Definition_of_get-output-vector"></a><a name="Procedure_get-output-vector"></a><a name="index-get_002doutput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_get-output-vector">get-output-vector</a></b></code><i> <var>vector-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>get-output-vector</code> takes an output vector-port or
a bidirectional vector-port as parameter and removes all the objects
currently on the output-side, returning them in a vector. The port
remains open and subsequent output to the port and calls to the
procedure <code>get-output-vector</code> are possible.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-vector '#(1 2 3)))</b>
> <b>(write 4 p)</b>
> <b>(get-output-vector p)</b>
#(1 2 3 4)
> <b>(write 5 p)</b>
> <b>(write 6 p)</b>
> <b>(get-output-vector p)</b>
#(5 6)
</pre></td></tr></table>
<hr size="6">
<a name="String_002dports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Vector_002dports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#U8vector_002dports" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="String_002dports-1"></a>
<h2 class="section">17.10 String-ports</h2>
<a name="Definition_of_open-string"></a><a name="Procedure_open-string"></a><a name="index-open_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-string">open-string</a></b></code><i> <span class="roman">[</span><var>string-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-input-string"></a><a name="Procedure_open-input-string"></a><a name="index-open_002dinput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-input-string">open-input-string</a></b></code><i> <span class="roman">[</span><var>string-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-output-string"></a><a name="Procedure_open-output-string"></a><a name="index-open_002doutput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-output-string">open-output-string</a></b></code><i> <span class="roman">[</span><var>string-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-input-string"></a><a name="Procedure_call-with-input-string"></a><a name="index-call_002dwith_002dinput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-input-string">call-with-input-string</a></b></code><i> <var>string-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-output-string"></a><a name="Procedure_call-with-output-string"></a><a name="index-call_002dwith_002doutput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-output-string">call-with-output-string</a></b></code><i> <span class="roman">[</span><var>string-or-settings</var><span class="roman">]</span> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-input-from-string"></a><a name="Procedure_with-input-from-string"></a><a name="index-with_002dinput_002dfrom_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-input-from-string">with-input-from-string</a></b></code><i> <var>string-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-output-to-string"></a><a name="Procedure_with-output-to-string"></a><a name="index-with_002doutput_002dto_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-output-to-string">with-output-to-string</a></b></code><i> <span class="roman">[</span><var>string-or-settings</var><span class="roman">]</span> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-string-pipe"></a><a name="Procedure_open-string-pipe"></a><a name="index-open_002dstring_002dpipe"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-string-pipe">open-string-pipe</a></b></code><i> <span class="roman">[</span><var>string-or-settings1</var> <span class="roman">[</span><var>string-or-settings2</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_get-output-string"></a><a name="Procedure_get-output-string"></a><a name="index-get_002doutput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_get-output-string">get-output-string</a></b></code><i> <var>string-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>String-ports represent streams of characters. They are a direct
subtype of character-ports. These procedures are the string-port
analog of the procedures specified in the vector-ports section. Note
that these procedures are a superset of the procedures specified in
the “Basic String Ports SRFI” (SRFI 6).
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-string))</b>
> <b>(write 1 p)</b>
> <b>(write 2 p)</b>
> <b>(write 3 p)</b>
> <b>(force-output p)</b>
> <b>(read-char p)</b>
#\1
> <b>(read-char p)</b>
#\2
> <b>(close-output-port p)</b>
> <b>(read-char p)</b>
#\3
> <b>(read-char p)</b>
#!eof
> <b>(with-output-to-string (lambda () (write 1) (write 2)))</b>
"12"
</pre></td></tr></table>
<a name="Definition_of_object-%3Estring"></a><a name="Procedure_object-%3Estring"></a><a name="index-object_002d_003estring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_object-%3Estring">object->string</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>n</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure converts the object <var>obj</var> to its external
representation and returns it in a string. The parameter <var>n</var>
specifies the maximal width of the resulting string. If the external
representation is wider than <var>n</var>, the resulting string will be
truncated to <var>n</var> characters and the last 3 characters will be set
to periods. Note that the current readtable is used.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(object->string (expt 2 100))</b>
"1267650600228229401496703205376"
> <b>(object->string (expt 2 100) 30)</b>
"126765060022822940149670320..."
> <b>(object->string (cons car cdr))</b>
"(#<procedure #2 car> . #<procedure #3 cdr>)"
</pre></td></tr></table>
<hr size="6">
<a name="U8vector_002dports"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#String_002dports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Other-procedures-related-to-I_002fO" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="U8vector_002dports-1"></a>
<h2 class="section">17.11 U8vector-ports</h2>
<a name="Definition_of_open-u8vector"></a><a name="Procedure_open-u8vector"></a><a name="index-open_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-u8vector">open-u8vector</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-input-u8vector"></a><a name="Procedure_open-input-u8vector"></a><a name="index-open_002dinput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-input-u8vector">open-input-u8vector</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-output-u8vector"></a><a name="Procedure_open-output-u8vector"></a><a name="index-open_002doutput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-output-u8vector">open-output-u8vector</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-input-u8vector"></a><a name="Procedure_call-with-input-u8vector"></a><a name="index-call_002dwith_002dinput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-input-u8vector">call-with-input-u8vector</a></b></code><i> <var>u8vector-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_call-with-output-u8vector"></a><a name="Procedure_call-with-output-u8vector"></a><a name="index-call_002dwith_002doutput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_call-with-output-u8vector">call-with-output-u8vector</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings</var><span class="roman">]</span> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-input-from-u8vector"></a><a name="Procedure_with-input-from-u8vector"></a><a name="index-with_002dinput_002dfrom_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-input-from-u8vector">with-input-from-u8vector</a></b></code><i> <var>u8vector-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_with-output-to-u8vector"></a><a name="Procedure_with-output-to-u8vector"></a><a name="index-with_002doutput_002dto_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_with-output-to-u8vector">with-output-to-u8vector</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings</var><span class="roman">]</span> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_open-u8vector-pipe"></a><a name="Procedure_open-u8vector-pipe"></a><a name="index-open_002du8vector_002dpipe"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-u8vector-pipe">open-u8vector-pipe</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings1</var> <span class="roman">[</span><var>u8vector-or-settings2</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_get-output-u8vector"></a><a name="Procedure_get-output-u8vector"></a><a name="index-get_002doutput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_get-output-u8vector">get-output-u8vector</a></b></code><i> <var>u8vector-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>U8vector-ports represent streams of bytes. They are a direct subtype
of byte-ports. These procedures are the u8vector-port analog of the
procedures specified in the vector-ports section.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-u8vector))</b>
> <b>(write 1 p)</b>
> <b>(write 2 p)</b>
> <b>(write 3 p)</b>
> <b>(force-output p)</b>
> <b>(read-u8 p)</b>
49
> <b>(read-u8 p)</b>
50
> <b>(close-output-port p)</b>
> <b>(read-u8 p)</b>
51
> <b>(read-u8 p)</b>
#!eof
> <b>(with-output-to-u8vector (lambda () (write 1) (write 2)))</b>
#u8(49 50)
</pre></td></tr></table>
<hr size="6">
<a name="Other-procedures-related-to-I_002fO"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#U8vector_002dports" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Other-procedures-related-to-I_002fO-1"></a>
<h2 class="section">17.12 Other procedures related to I/O</h2>
<a name="Definition_of_current-input-port"></a><a name="Procedure_current-input-port"></a><a name="index-current_002dinput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-input-port">current-input-port</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_current-output-port"></a><a name="Procedure_current-output-port"></a><a name="index-current_002doutput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-output-port">current-output-port</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_current-error-port"></a><a name="Procedure_current-error-port"></a><a name="index-current_002derror_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-error-port">current-error-port</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_current-readtable"></a><a name="Procedure_current-readtable"></a><a name="index-current_002dreadtable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-readtable">current-readtable</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>These procedures are parameter objects which represent respectively:
the current input-port, the current output-port, the current
error-port, and the current readtable.
</p>
<a name="Definition_of_print"></a><a name="Procedure_print"></a><a name="index-print"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_print">print</a></b></code><i> <span class="roman">[</span><code>port:</code> <var>port</var><span class="roman">]</span> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_println"></a><a name="Procedure_println"></a><a name="index-println"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_println">println</a></b></code><i> <span class="roman">[</span><code>port:</code> <var>port</var><span class="roman">]</span> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The <code>print</code> procedure writes a representation of each <var>obj</var>,
from left to right, to <var>port</var>. When a compound object is
encountered (pair, list, vector, box) the elements of that object are
recursively written without the surrounding tokens (parentheses,
spaces, dots, etc). Strings, symbols, keywords and characters are
written like the <code>display</code> procedure. If there are more than one
<var>obj</var>, the first <var>obj</var> must not be a keyword object. If it is
not specified, <var>port</var> defaults to the current output-port. The
procedure <code>print</code> returns an unspecified value.
</p>
<p>The <code>println</code> procedure does the same thing as the <code>print</code>
procedure and then writes an end of line to <var>port</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(println "2*2 is " (* 2 2) " and 2+2 is " (+ 2 2))</b>
2*2 is 4 and 2+2 is 4
> <b>(define x (list "<i>" (list "<tt>" 123 "</tt>") "</i>"))</b>
> <b>(println x)</b>
<i><tt>123</tt></i>
> <b>(define p (open-output-string))</b>
> <b>(print port: p 1 #\2 "345")</b>
> <b>(get-output-string p)</b>
"12345"
</pre></td></tr></table>
<hr size="6">
<a name="Lexical-syntax-and-readtables"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Other-procedures-related-to-I_002fO" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Readtables" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Lexical-syntax-and-readtables-1"></a>
<h1 class="chapter">18. Lexical syntax and readtables</h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Readtables">18.1 Readtables</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Boolean-syntax">18.2 Boolean syntax</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Character-syntax">18.3 Character syntax</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#String-syntax">18.4 String syntax</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Symbol-syntax">18.5 Symbol syntax</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Keyword-syntax">18.6 Keyword syntax</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Box-syntax">18.7 Box syntax</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Number-syntax">18.8 Number syntax</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Homogeneous-vector-syntax">18.9 Homogeneous vector syntax</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Special-_0023_0021-syntax">18.10 Special <code>#!</code> syntax</a></td><td> </td><td align="left" valign="top"> Special #! syntax
</td></tr>
<tr><td align="left" valign="top"><a href="#Multiline-comment-syntax">18.11 Multiline comment syntax</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Scheme-infix-syntax-extension">18.12 Scheme infix syntax extension</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="Readtables"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Boolean-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Readtables-1"></a>
<h2 class="section">18.1 Readtables</h2>
<p>Readtables control the external textual representation of Scheme
objects, that is the encoding of Scheme objects using characters.
Readtables affect the behavior of the reader (i.e. the <code>read</code>
procedure and the parser used by the <code>load</code> procedure and the
interpreter and compiler) and the printer (i.e. the procedures
<code>write</code>, <code>display</code>, <code>print</code>, <code>println</code>,
<code>pretty-print</code>, and <code>pp</code>, and the procedure used by the REPL
to print results). To preserve write/read invariance the printer and
reader must be using compatible readtables. For example a symbol
which contains upper case letters will be printed with special escapes
if the readtable indicates that the reader is case-insensitive.
</p>
<p>Readtables are immutable records whose fields specify various textual
representation aspects. There are accessor procedures to retrieve the
content of specific fields. There are also functional update
procedures that create a copy of a readtable, with a specific field
set to a new value.
</p>
<a name="Definition_of_readtable?"></a><a name="Procedure_readtable?"></a><a name="index-readtable_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable?">readtable?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>This procedure returns <code>#t</code> when <var>obj</var> is a readtable and
<code>#f</code> otherwise.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(readtable? (current-readtable))</b>
#t
> <b>(readtable? 123)</b>
#f
</pre></td></tr></table>
<a name="Definition_of_readtable-case-conversion?"></a><a name="Procedure_readtable-case-conversion?"></a><a name="index-readtable_002dcase_002dconversion_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-case-conversion?">readtable-case-conversion?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-case-conversion?-set"></a><a name="Procedure_readtable-case-conversion?-set"></a><a name="index-readtable_002dcase_002dconversion_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-case-conversion?-set">readtable-case-conversion?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>readtable-case-conversion?</code> returns the content of
the ‘<samp>case-conversion?</samp>’ field of <var>readtable</var>. When the
content of this field is <code>#f</code>, the reader preserves the case of
symbols and keyword objects that are read (i.e. <code>Ice</code> and
<code>ice</code> are distinct symbols). When the content of this field is
the symbol <code>upcase</code>, the reader converts lowercase letters to
uppercase when reading symbols and keywords (i.e. <code>Ice</code> is read
as the symbol <code>(string->symbol "ICE")</code>). Otherwise the reader
converts uppercase letters to lowercase when reading symbols and
keywords (i.e. <code>Ice</code> is read as the symbol <code>(string->symbol
"ice")</code>).
</p>
<p>The procedure <code>readtable-case-conversion?-set</code> returns a copy
of <var>readtable</var> where only the ‘<samp>case-conversion?</samp>’ field
has been changed to <var>new-value</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(output-port-readtable-set!
(repl-output-port)
(readtable-case-conversion?-set
(output-port-readtable (repl-output-port))
#f))</b>
> <b>(input-port-readtable-set!
(repl-input-port)
(readtable-case-conversion?-set
(input-port-readtable (repl-input-port))
#f))</b>
> <b>'Ice</b>
Ice
> <b>(input-port-readtable-set!
(repl-input-port)
(readtable-case-conversion?-set
(input-port-readtable (repl-input-port))
#t))</b>
> <b>'Ice</b>
ice
> <b>(input-port-readtable-set!
(repl-input-port)
(readtable-case-conversion?-set
(input-port-readtable (repl-input-port))
'upcase))</b>
> <b>'Ice</b>
ICE
</pre></td></tr></table>
<a name="Definition_of_readtable-keywords-allowed?"></a><a name="Procedure_readtable-keywords-allowed?"></a><a name="index-readtable_002dkeywords_002dallowed_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-keywords-allowed?">readtable-keywords-allowed?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-keywords-allowed?-set"></a><a name="Procedure_readtable-keywords-allowed?-set"></a><a name="index-readtable_002dkeywords_002dallowed_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-keywords-allowed?-set">readtable-keywords-allowed?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>readtable-keywords-allowed?</code> returns the content
of the ‘<samp>keywords-allowed?</samp>’ field of <var>readtable</var>. When the
content of this field is <code>#f</code>, the reader does not recognize
keyword objects (i.e. <code>:foo</code> and <code>foo:</code> are read as the
symbols <code>(string->symbol ":foo")</code> and <code>(string->symbol
"foo:")</code> respectively). When the content of this field is the symbol
<code>prefix</code>, the reader recognizes keyword objects that start with a
colon, as in Common Lisp (i.e. <code>:foo</code> is read as the keyword
<code>(string->keyword "foo")</code>). Otherwise the reader recognizes
keyword objects that end with a colon, as in DSSSL (i.e. <code>foo:</code>
is read as the symbol <code>(string->symbol "foo")</code>).
</p>
<p>The procedure <code>readtable-keywords-allowed?-set</code> returns a copy
of <var>readtable</var> where only the ‘<samp>keywords-allowed?</samp>’ field
has been changed to <var>new-value</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(input-port-readtable-set!
(repl-input-port)
(readtable-keywords-allowed?-set
(input-port-readtable (repl-input-port))
#f))</b>
> <b>(map keyword? '(foo :foo foo:))</b>
(#f #f #f)
> <b>(input-port-readtable-set!
(repl-input-port)
(readtable-keywords-allowed?-set
(input-port-readtable (repl-input-port))
#t))</b>
> <b>(map keyword? '(foo :foo foo:))</b>
(#f #f #t)
> <b>(input-port-readtable-set!
(repl-input-port)
(readtable-keywords-allowed?-set
(input-port-readtable (repl-input-port))
'prefix))</b>
> <b>(map keyword? '(foo :foo foo:))</b>
(#f #t #f)
</pre></td></tr></table>
<a name="Definition_of_readtable-sharing-allowed?"></a><a name="Procedure_readtable-sharing-allowed?"></a><a name="index-readtable_002dsharing_002dallowed_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-sharing-allowed?">readtable-sharing-allowed?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-sharing-allowed?-set"></a><a name="Procedure_readtable-sharing-allowed?-set"></a><a name="index-readtable_002dsharing_002dallowed_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-sharing-allowed?-set">readtable-sharing-allowed?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="index-serialization-1"></a>
<a name="index-deserialization-1"></a>
<p>The procedure <code>readtable-sharing-allowed?</code> returns the content of
the ‘<samp>sharing-allowed?</samp>’ field of <var>readtable</var>. The reader
recognizes the <code>#<var>n</var>#</code> and <code>#<var>n</var>=<var>datum</var></code>
notation for shared and circular structures and the printer uses this
notation depending on the content of the ‘<samp>sharing-allowed?</samp>’ field
and the printing primitive used. When the content of the
‘<samp>sharing-allowed?</samp>’ field is the symbol <code>default</code>, the
procedure <code>write-shared</code> will use this notation for shared and
circular structures, the procedures <code>write</code>, <code>display</code>,
<code>pp</code>, <code>pretty-print</code>, <code>print</code>, and <code>println</code> will
use this notation for circular structures, and the procedure
<code>write-simple</code> does not use this notation. When the content
of the ‘<samp>sharing-allowed?</samp>’ field is <code>#f</code>, the printing procedures
will not use this notation. When the content of the ‘<samp>sharing-allowed?</samp>’
field is <code>#t</code>, the printing procedures will use this notation
for shared and circular structures. Finally, when the content of the
‘<samp>sharing-allowed?</samp>’ field is the symbol <code>serialize</code>, the printer
uses a special external representation that the reader understands and
that extends write/read invariance to the following types: records,
procedures and continuations. Note that an object can be serialized and
deserialized if and only if all of its components are serializable.
</p>
<p>The procedure <code>readtable-sharing-allowed?-set</code> returns a copy
of <var>readtable</var> where only the ‘<samp>sharing-allowed?</samp>’ field
has been changed to <var>new-value</var>.
</p>
<p>Here is a simple example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (wr obj allow?)
(call-with-output-string
(lambda (p)
(output-port-readtable-set!
p
(readtable-sharing-allowed?-set
(output-port-readtable p)
allow?))
(write obj p))))</b>
> <b>(define (rd str allow?)
(call-with-input-string
str
(lambda (p)
(input-port-readtable-set!
p
(readtable-sharing-allowed?-set
(input-port-readtable p)
allow?))
(read p))))</b>
> <b>(define x (list 1 2 3))</b>
> <b>(set-car! (cdr x) (cddr x))</b>
> <b>(wr x #f)</b>
"(1 (3) 3)"
> <b>(wr x #t)</b>
"(1 #0=(3) . #0#)"
> <b>(define y (rd (wr x #t) #t))</b>
> <b>y</b>
(1 (3) 3)
> <b>(eq? (cadr y) (cddr y))</b>
#t
> <b>(define f #f)</b>
> <b>(let ((free (expt 2 10)))
(set! f (lambda (x) (+ x free))))</b>
> <b>(define s (wr f 'serialize))</b>
> <b>(string-length s)</b>
4196
> <b>(define g (rd s 'serialize))</b>
> <b>(eq? f g)</b>
#f
> <b>(g 4)</b>
1028
</pre></td></tr></table>
<p>Continuations are tricky to serialize because they contain a dynamic
environment and this dynamic environment may contain non-serializable
objects, in particular ports attached to operating-system streams such
as files, the console or standard input/output. Indeed, all dynamic
environments contain a binding for the <code>current-input-port</code> and
<code>current-output-port</code>. Moreover, any thread that has started a
REPL has a continuation which refers to the <em>repl-context</em> object
in its dynamic environment. A repl-context object contains the
interaction channel, which is typically connected to a
non-serializable port, such as the console. Another problem is that
the <code>parameterize</code> form saves the old binding of the parameter in
the continuation, so it is not possible to eliminate the references to
these ports in the continuation by using the <code>parameterize</code> form
alone.
</p>
<p>Serialization of continuations can be achieved dependably by taking
advantage of string-ports, which are serializable objects (unless
there is a blocked thread), and the following features of threads:
they inherit the dynamic environment of the parent thread and they
start with an initial continuation that contains only serializable
objects. So a thread created in a dynamic environment where
<code>current-input-port</code> and <code>current-output-port</code> are bound to
a dummy string-port has a serializable continuation.
</p>
<p>Here is an example where continuations are serialized:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (wr obj)
(call-with-output-string
(lambda (p)
(output-port-readtable-set!
p
(readtable-sharing-allowed?-set
(output-port-readtable p)
'serialize))
(write obj p))))</b>
> <b>(define (rd str)
(call-with-input-string
str
(lambda (p)
(input-port-readtable-set!
p
(readtable-sharing-allowed?-set
(input-port-readtable p)
'serialize))
(read p))))</b>
> <b>(define fifo (open-vector))</b>
> <b>(define (suspend-and-die!)
(call-with-current-continuation
(lambda (k)
(write (wr k) fifo)
(newline fifo)
(force-output fifo)
(thread-terminate! (current-thread)))))</b>
> <b>(let ((dummy-port (open-string)))
(parameterize ((current-input-port dummy-port)
(current-output-port dummy-port))
(thread-start!
(make-thread
(lambda ()
(* 100
(suspend-and-die!)))))))</b>
#<thread #2>
> <b>(define s (read fifo))</b>
> <b>(thread-join!
(thread-start!
(make-thread
(lambda ()
((rd s) 111)))))</b>
11100
> <b>(thread-join!
(thread-start!
(make-thread
(lambda ()
((rd s) 222)))))</b>
22200
> <b>(string-length s)</b>
13114
</pre></td></tr></table>
<a name="Definition_of_readtable-eval-allowed?"></a><a name="Procedure_readtable-eval-allowed?"></a><a name="index-readtable_002deval_002dallowed_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-eval-allowed?">readtable-eval-allowed?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-eval-allowed?-set"></a><a name="Procedure_readtable-eval-allowed?-set"></a><a name="index-readtable_002deval_002dallowed_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-eval-allowed?-set">readtable-eval-allowed?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>readtable-eval-allowed?</code> returns the content of
the ‘<samp>eval-allowed?</samp>’ field of <var>readtable</var>. The reader
recognizes the <code>#.<var>expression</var></code> notation for read-time
evaluation if and only if the content of the ‘<samp>eval-allowed?</samp>’
field is not <code>#f</code>.
</p>
<p>The procedure <code>readtable-eval-allowed?-set</code> returns a copy
of <var>readtable</var> where only the ‘<samp>eval-allowed?</samp>’ field
has been changed to <var>new-value</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(input-port-readtable-set!
(repl-input-port)
(readtable-eval-allowed?-set
(input-port-readtable (repl-input-port))
#t))</b>
> <b>'(5 plus 7 is #.(+ 5 7))</b>
(5 plus 7 is 12)
> <b>'(buf = #.(make-u8vector 25))</b>
(buf = #u8(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
</pre></td></tr></table>
<a name="Definition_of_readtable-write-cdr-read-macros?"></a><a name="Procedure_readtable-write-cdr-read-macros?"></a><a name="index-readtable_002dwrite_002dcdr_002dread_002dmacros_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-write-cdr-read-macros?">readtable-write-cdr-read-macros?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-write-cdr-read-macros?-set"></a><a name="Procedure_readtable-write-cdr-read-macros?-set"></a><a name="index-readtable_002dwrite_002dcdr_002dread_002dmacros_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-write-cdr-read-macros?-set">readtable-write-cdr-read-macros?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-write-extended-read-macros?"></a><a name="Procedure_readtable-write-extended-read-macros?"></a><a name="index-readtable_002dwrite_002dextended_002dread_002dmacros_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-write-extended-read-macros?">readtable-write-extended-read-macros?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-write-extended-read-macros?-set"></a><a name="Procedure_readtable-write-extended-read-macros?-set"></a><a name="index-readtable_002dwrite_002dextended_002dread_002dmacros_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-write-extended-read-macros?-set">readtable-write-extended-read-macros?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>readtable-write-cdr-read-macros?</code> returns the
content of the ‘<samp>write-cdr-read-macros?</samp>’ field of <var>readtable</var>.
The procedure <code>readtable-write-extended-read-macros?</code> returns the
content of the ‘<samp>write-extended-read-macros?</samp>’ field of
<var>readtable</var>.
</p>
<p>At all times the printer uses read-macros in its output for datums of
the form <code>(quote <var>datum</var>)</code>, <code>(quasiquote <var>datum</var>)</code>,
<code>(unquote <var>datum</var>)</code>, and <code>(unquote-splicing
<var>datum</var>)</code>. That is the following read-macro notations will be
used respectively: <code>'<var>datum</var></code>, <code>`<var>datum</var></code>,
<code>,<var>datum</var></code>, and <code>,@<var>datum</var></code>. Moreover, normally
the read-macros will not be used when the form appears in the cdr of a
list, for example <code>(foo quote bar)</code>, <code>(foo . (quote bar))</code>
and <code>(foo . 'bar)</code> will all be printed as <code>(foo quote bar)</code>.
</p>
<p>When the content of the ‘<samp>write-cdr-read-macros?</samp>’ field is not
<code>#f</code>, the printer will use read-macros when the forms appear in
the cdr of a list. For example <code>(foo quote bar)</code> will be printed
as <code>(foo . 'bar)</code>. When the content of the
‘<samp>write-extended-read-macros?</samp>’ field is not <code>#f</code>, the printer
will also use extended read-macros, for example <code>#'<var>datum</var></code>
in place of <code>(syntax <var>datum</var>)</code>.
</p>
<p>The procedure <code>readtable-write-cdr-read-macros?-set</code> returns a
copy of <var>readtable</var> where only the ‘<samp>write-cdr-read-macros?</samp>’
field has been changed to <var>new-value</var>. The procedure
<code>readtable-write-extended-read-macros?-set</code> returns a copy of
<var>readtable</var> where only the ‘<samp>write-extended-read-macros?</samp>’
field has been changed to <var>new-value</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(output-port-readtable-set!
(repl-output-port)
(readtable-write-extended-read-macros?-set
(output-port-readtable (repl-output-port))
#t))</b>
> <b>'(foo (syntax bar))</b>
(foo #'bar)
> <b>'(foo syntax bar)</b>
(foo syntax bar)
> <b>(output-port-readtable-set!
(repl-output-port)
(readtable-write-cdr-read-macros?-set
(output-port-readtable (repl-output-port))
#t))</b>
> <b>'(foo syntax bar)</b>
(foo . #'bar)
</pre></td></tr></table>
<a name="Definition_of_readtable-max-write-level"></a><a name="Procedure_readtable-max-write-level"></a><a name="index-readtable_002dmax_002dwrite_002dlevel"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-max-write-level">readtable-max-write-level</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-max-write-level-set"></a><a name="Procedure_readtable-max-write-level-set"></a><a name="index-readtable_002dmax_002dwrite_002dlevel_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-max-write-level-set">readtable-max-write-level-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>readtable-max-write-level</code> returns the content of
the ‘<samp>max-write-level</samp>’ field of <var>readtable</var>. The printer will
display an ellipsis for the elements of lists and vectors that are
nested deeper than this level.
</p>
<p>The procedure <code>readtable-max-write-level-set</code> returns a copy
of <var>readtable</var> where only the ‘<samp>max-write-level</samp>’ field
has been changed to <var>new-value</var>, which must be an nonnegative
fixnum.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (wr obj n)
(call-with-output-string
(lambda (p)
(output-port-readtable-set!
p
(readtable-max-write-level-set
(output-port-readtable p)
n))
(write obj p))))</b>
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 3)</b>
"(a #(b (c c) #u8(9 9 9) b) a)"
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 2)</b>
"(a #(b (...) #u8(...) b) a)"
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 1)</b>
"(a #(...) a)"
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 0)</b>
"(...)"
> <b>(wr 'hello 0)</b>
"hello"
</pre></td></tr></table>
<a name="Definition_of_readtable-max-write-length"></a><a name="Procedure_readtable-max-write-length"></a><a name="index-readtable_002dmax_002dwrite_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-max-write-length">readtable-max-write-length</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-max-write-length-set"></a><a name="Procedure_readtable-max-write-length-set"></a><a name="index-readtable_002dmax_002dwrite_002dlength_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-max-write-length-set">readtable-max-write-length-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>readtable-max-write-length</code> returns the content of
the ‘<samp>max-write-length</samp>’ field of <var>readtable</var>. The printer will
display an ellipsis for the elements of lists and vectors that are at
an index beyond that length.
</p>
<p>The procedure <code>readtable-max-write-length-set</code> returns a copy
of <var>readtable</var> where only the ‘<samp>max-write-length</samp>’ field
has been changed to <var>new-value</var>, which must be an nonnegative
fixnum.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (wr obj n)
(call-with-output-string
(lambda (p)
(output-port-readtable-set!
p
(readtable-max-write-length-set
(output-port-readtable p)
n))
(write obj p))))</b>
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 4)</b>
"(a #(b (c c) #u8(9 9 9) b) . a)"
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 3)</b>
"(a #(b (c c) #u8(9 9 9) ...) . a)"
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 2)</b>
"(a #(b (c c) ...) . a)"
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 1)</b>
"(a ...)"
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 0)</b>
"(...)"
</pre></td></tr></table>
<a name="Definition_of_readtable-max-unescaped-char"></a><a name="Procedure_readtable-max-unescaped-char"></a><a name="index-readtable_002dmax_002dunescaped_002dchar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-max-unescaped-char">readtable-max-unescaped-char</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-max-unescaped-char-set"></a><a name="Procedure_readtable-max-unescaped-char-set"></a><a name="index-readtable_002dmax_002dunescaped_002dchar_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-max-unescaped-char-set">readtable-max-unescaped-char-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>readtable-max-unescaped-char</code> returns the content
of the ‘<samp>max-unescaped-char</samp>’ field of <var>readtable</var>. The
printer will display using an escape sequence any character within
symbols, strings and character objects greater than
‘<samp>max-unescaped-char</samp>’. When ‘<samp>max-unescaped-char</samp>’ is
<code>#f</code>, the default value, the printer will take into account
the output port and use an escape sequence for any character that isn’t
supported by the port’s character encoding.
</p>
<p>The procedure <code>readtable-max-unescaped-char-set</code> returns a copy
of <var>readtable</var> where only the ‘<samp>max-unescaped-char</samp>’ field
has been changed to <var>new-value</var>, which must be a character or
<code>#f</code>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rt (output-port-readtable (repl-output-port)))</b>
> <b>(readtable-max-unescaped-char rt)</b>
#\delete
> <b>(string (integer->char 233))</b>
"\351"
> <b>(define (f c)
(with-output-to-string
(list readtable: (readtable-max-unescaped-char-set rt c))
(lambda () (write (string (integer->char 233))))))</b>
> <b>(f #\delete)</b>
"\"\\351\""
> <b>(string-length (f #\delete))</b>
6
> <b>(f #\U0010ffff)</b>
"\"\351\""
> <b>(string-length (f #\U0010ffff))</b>
3
> <b>(output-port-readtable-set!
(repl-output-port)
(readtable-max-unescaped-char-set rt #\U0010ffff))</b>
> <b>(string (integer->char 233))</b>
"é"
</pre></td></tr></table>
<a name="Definition_of_readtable-start-syntax"></a><a name="Procedure_readtable-start-syntax"></a><a name="index-readtable_002dstart_002dsyntax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-start-syntax">readtable-start-syntax</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<a name="Definition_of_readtable-start-syntax-set"></a><a name="Procedure_readtable-start-syntax-set"></a><a name="index-readtable_002dstart_002dsyntax_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-start-syntax-set">readtable-start-syntax-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
<p>The procedure <code>readtable-start-syntax</code> returns the content of the
‘<samp>start-syntax</samp>’ field of <var>readtable</var>. The reader uses this
field to determine in which syntax to start parsing the input. When
the content of this field is the symbol <code>six</code>, the reader starts
in the infix syntax. Otherwise the reader starts in the prefix
syntax.
</p>
<p>The procedure <code>readtable-start-syntax-set</code> returns a copy
of <var>readtable</var> where only the ‘<samp>start-syntax</samp>’ field
has been changed to <var>new-value</var>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(+ 2 3)</b>
5
> <b>(input-port-readtable-set!
(repl-input-port)
(readtable-start-syntax-set
(input-port-readtable (repl-input-port))
'six))</b>
> <b>2+3;</b>
5
> <b>exit();</b>
</pre></td></tr></table>
<hr size="6">
<a name="Boolean-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Readtables" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Character-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Boolean-syntax-1"></a>
<h2 class="section">18.2 Boolean syntax</h2>
<p>Booleans are required to be followed by a delimiter
(i.e. <code>#f64()</code> is not the boolean <code>#f</code> followed by the
number <code>64</code> and the empty list).
</p>
<hr size="6">
<a name="Character-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Boolean-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#String-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Character-syntax-1"></a>
<h2 class="section">18.3 Character syntax</h2>
<p>Characters are required to be followed by a delimiter
(i.e. <code>#\spaceballs</code> is not the character <code>#\space</code> followed
by the symbol <code>balls</code>). The lexical syntax of characters is
extended to allow the following:
</p>
<dl compact="compact">
<dt> <code>#\nul</code></dt>
<dd><p>Unicode character 0
</p></dd>
<dt> <code>#\alarm</code></dt>
<dd><p>Unicode character 7
</p></dd>
<dt> <code>#\backspace</code></dt>
<dd><p>Unicode character 8
</p></dd>
<dt> <code>#\tab</code></dt>
<dd><p>Unicode character 9
</p></dd>
<dt> <code>#\newline</code></dt>
<dd><p>Unicode character 10 (newline character)
</p></dd>
<dt> <code>#\linefeed</code></dt>
<dd><p>Unicode character 10
</p></dd>
<dt> <code>#\vtab</code></dt>
<dd><p>Unicode character 11
</p></dd>
<dt> <code>#\page</code></dt>
<dd><p>Unicode character 12
</p></dd>
<dt> <code>#\return</code></dt>
<dd><p>Unicode character 13
</p></dd>
<dt> <code>#\esc</code></dt>
<dd><p>Unicode character 27
</p></dd>
<dt> <code>#\space</code></dt>
<dd><p>Unicode character 32 (space character)
</p></dd>
<dt> <code>#\delete</code></dt>
<dd><p>Unicode character 127
</p></dd>
<dt> <code>#\x<var>hh</var></code></dt>
<dd><p>character encoded in hexadecimal (>= 1 hexadecimal digit)
</p></dd>
<dt> <code>#\u<var>hhhh</var></code></dt>
<dd><p>character encoded in hexadecimal (exactly 4 hexadecimal digits)
</p></dd>
<dt> <code>#\U<var>hhhhhhhh</var></code></dt>
<dd><p>character encoded in hexadecimal (exactly 8 hexadecimal digits)
</p></dd>
</dl>
<hr size="6">
<a name="String-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Character-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Symbol-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="String-syntax-1"></a>
<h2 class="section">18.4 String syntax</h2>
<p>The lexical syntax of quoted strings is extended to allow the following
escape codes:
</p>
<dl compact="compact">
<dt> <code>\a</code></dt>
<dd><p>Unicode character 7
</p></dd>
<dt> <code>\b</code></dt>
<dd><p>Unicode character 8
</p></dd>
<dt> <code>\t</code></dt>
<dd><p>Unicode character 9
</p></dd>
<dt> <code>\n</code></dt>
<dd><p>Unicode character 10 (newline character)
</p></dd>
<dt> <code>\v</code></dt>
<dd><p>Unicode character 11
</p></dd>
<dt> <code>\f</code></dt>
<dd><p>Unicode character 12
</p></dd>
<dt> <code>\r</code></dt>
<dd><p>Unicode character 13
</p></dd>
<dt> <code>\"</code></dt>
<dd><p><code>"</code>
</p></dd>
<dt> <code>\\</code></dt>
<dd><p><code>\</code>
</p></dd>
<dt> <code>\|</code></dt>
<dd><p><code>|</code>
</p></dd>
<dt> <code>\?</code></dt>
<dd><p><code>?</code>
</p></dd>
<dt> <code>\<var>ooo</var></code></dt>
<dd><p>character encoded in octal (1 to 3 octal digits, first digit must be less
than 4 when there are 3 octal digits)
</p></dd>
<dt> <code>\x<var>hh</var></code></dt>
<dd><p>character encoded in hexadecimal (>= 1 hexadecimal digit)
</p></dd>
<dt> <code>\u<var>hhhh</var></code></dt>
<dd><p>character encoded in hexadecimal (exactly 4 hexadecimal digits)
</p></dd>
<dt> <code>\U<var>hhhhhhhh</var></code></dt>
<dd><p>character encoded in hexadecimal (exactly 8 hexadecimal digits)
</p></dd>
<dt> <code>\<space></code></dt>
<dd><p>Unicode character 32 (space character)
</p></dd>
<dt> <code>\<newline><whitespace-except-newline>*</code></dt>
<dd><p>This sequence expands to nothing (it is useful for splitting a long
string literal on multiple lines while respecting proper indentation
of the source code)
</p></dd>
</dl>
<p>Gambit also supports a “here string” syntax that is similar
to shell “here documents”. For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(pretty-print #<<THE-END
hello
world
THE-END
)</b>
"hello\nworld"
</pre></td></tr></table>
<p>The here string starts with the sequence ‘<samp>#<<</samp>’. The part of the
line after the ‘<samp>#<<</samp>’ up to and including the newline character is
the key. The first line afterward that matches the key marks the end
of the here string. The string contains all the characters between
the start key and the end key, with the exception of the newline
character before the end key.
</p>
<hr size="6">
<a name="Symbol-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#String-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Keyword-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Symbol-syntax-1"></a>
<h2 class="section">18.5 Symbol syntax</h2>
<p>The lexical syntax of symbols is extended to allow a leading and
trailing vertical bar (e.g. <code>|a\|b"c:|</code>). The symbol’s name
corresponds verbatim to the characters between the vertical bars
except for escaped characters. The same escape sequences as for
strings are permitted except that ‘<samp>"</samp>’ does not need to be escaped
and ‘<samp>|</samp>’ needs to be escaped.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(symbol->string '|a\|b"c:|)</b>
"a|b\"c:"
</pre></td></tr></table>
<hr size="6">
<a name="Keyword-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Symbol-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Box-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Keyword-syntax-1"></a>
<h2 class="section">18.6 Keyword syntax</h2>
<p>The lexical syntax of keywords is like symbols, but with a colon at
the end (note that this can be changed to a leading colon by setting
the ‘<samp>keywords-allowed?</samp>’ field of the readtable to the symbol
<code>prefix</code>). A colon by itself is not a keyword, it is a symbol.
Vertical bars can be used like symbols but the colon must be outside
the vertical bars. Note that the string returned by the
<code>keyword->string</code> procedure does not include the colon.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(keyword->string 'foo:)</b>
"foo"
> <b>(map keyword? '(|ab()cd:| |ab()cd|: : ||:))</b>
(#f #t #f #t)
</pre></td></tr></table>
<hr size="6">
<a name="Box-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Keyword-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Number-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Box-syntax-1"></a>
<h2 class="section">18.7 Box syntax</h2>
<p>The lexical syntax of boxes is <code>#&<var>obj</var></code> where <var>obj</var> is the
content of the box.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(list '#&"hello" '#&123)</b>
(#&"hello" #&123)
> <b>(box (box (+ 10 20)))</b>
#&#&30
</pre></td></tr></table>
<hr size="6">
<a name="Number-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Box-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Homogeneous-vector-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Number-syntax-1"></a>
<h2 class="section">18.8 Number syntax</h2>
<p>The lexical syntax of the special inexact real numbers is as follows:
</p>
<dl compact="compact">
<dt> <code>+inf.0</code></dt>
<dd><p>positive infinity
</p></dd>
<dt> <code>-inf.0</code></dt>
<dd><p>negative infinity
</p></dd>
<dt> <code>+nan.0</code></dt>
<dd><p>“not a number”
</p></dd>
<dt> <code>-0.</code></dt>
<dd><p>negative zero (‘<samp>0.</samp>’ is the positive zero)
</p></dd>
</dl>
<hr size="6">
<a name="Homogeneous-vector-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Number-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Special-_0023_0021-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Homogeneous-vector-syntax-1"></a>
<h2 class="section">18.9 Homogeneous vector syntax</h2>
<a name="index-homogeneous-vectors-1"></a>
<p>Homogeneous vectors are vectors containing raw numbers of the same
type (signed or unsigned exact integers or inexact reals). There are
10 types of homogeneous vectors:
‘<samp>s8vector</samp>’ (vector of 8 bit signed integers),
‘<samp>u8vector</samp>’ (vector of 8 bit unsigned integers),
‘<samp>s16vector</samp>’ (vector of 16 bit signed integers),
‘<samp>u16vector</samp>’ (vector of 16 bit unsigned integers),
‘<samp>s32vector</samp>’ (vector of 32 bit signed integers),
‘<samp>u32vector</samp>’ (vector of 32 bit unsigned integers),
‘<samp>s64vector</samp>’ (vector of 64 bit signed integers),
‘<samp>u64vector</samp>’ (vector of 64 bit unsigned integers),
‘<samp>f32vector</samp>’ (vector of 32 bit floating point numbers),
and ‘<samp>f64vector</samp>’ (vector of 64 bit floating point numbers).
</p>
<p>The external representation of homogeneous vectors is similar to
normal vectors but with the ‘<samp>#(</samp>’ prefix replaced respectively
with
‘<samp>#s8(</samp>’, ‘<samp>#u8(</samp>’,
‘<samp>#s16(</samp>’, ‘<samp>#u16(</samp>’,
‘<samp>#s32(</samp>’, ‘<samp>#u32(</samp>’,
‘<samp>#s64(</samp>’, ‘<samp>#u64(</samp>’,
‘<samp>#f32(</samp>’, and ‘<samp>#f64(</samp>’.
</p>
<p>The elements of the integer homogeneous vectors must be exact integers
fitting in the given precision. The elements of the floating point
homogeneous vectors must be inexact reals.
</p>
<hr size="6">
<a name="Special-_0023_0021-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Homogeneous-vector-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Multiline-comment-syntax" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Special-_0023_0021-syntax-1"></a>
<h2 class="section">18.10 Special <code>#!</code> syntax</h2>
<p>The lexical syntax of the special <code>#!</code> objects is as follows:
</p>
<dl compact="compact">
<dt> <code>#!eof</code></dt>
<dd><p>end-of-file object
</p></dd>
<dt> <code>#!void</code></dt>
<dd><p>void object
</p></dd>
<dt> <code>#!optional</code></dt>
<dd><p>optional object
</p></dd>
<dt> <code>#!rest</code></dt>
<dd><p>rest object
</p></dd>
<dt> <code>#!key</code></dt>
<dd><p>key object
</p></dd>
</dl>
<hr size="6">
<a name="Multiline-comment-syntax"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Special-_0023_0021-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-infix-syntax-extension" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Multiline-comment-syntax-1"></a>
<h2 class="section">18.11 Multiline comment syntax</h2>
<p>Multiline comments are delimited by the tokens ‘<samp>#|</samp>’ and ‘<samp>|#</samp>’.
These comments can be nested.
</p>
<hr size="6">
<a name="Scheme-infix-syntax-extension"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Multiline-comment-syntax" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SIX-grammar" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Scheme-infix-syntax-extension-1"></a>
<h2 class="section">18.12 Scheme infix syntax extension</h2>
<p>The reader supports an infix syntax extension which is called SIX
(Scheme Infix eXtension). This extension is both supported by the
‘<samp>read</samp>’ procedure and in program source code.
</p>
<p>The backslash character is a delimiter that marks the beginning of a
single datum expressed in the infix syntax (the details are given
below). One way to think about it is that the backslash character
escapes the prefix syntax temporarily to use the infix syntax. For
example a three element list could be written as ‘<samp>(<var>X</var>
\<var>Y</var> <var>Z</var>)</samp>’, the elements <var>X</var> and <var>Z</var> are expressed
using the normal prefix syntax and <var>Y</var> is expressed using the
infix syntax.
</p>
<p>When the reader encounters an infix datum, it constructs a syntax tree
for that particular datum. Each node of this tree is represented with
a list whose first element is a symbol indicating the type of node.
For example, ‘<samp>(six.identifier abc)</samp>’ is the representation of the
infix identifier ‘<samp>abc</samp>’ and ‘<samp>(six.index (six.identifier abc)
(six.identifier i))</samp>’ is the representation of the infix datum
‘<samp>abc[i];</samp>’.
</p>
<hr size="6">
<a name="SIX-grammar"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Scheme-infix-syntax-extension" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SIX-semantics" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-infix-syntax-extension" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">18.12.1 SIX grammar</h3>
<p>The SIX grammar is given below. On the left hand side are the
production rules. On the right hand side is the datum that is
constructed by the reader. The notation <var>$i</var> denotes the datum
that is constructed by the reader for the <var>i</var>th part of the
production rule.
</p>
<table>
<tr><td width="60%"><em><</em>infix datum<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>if stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>for stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>while stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>do stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>switch stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>case stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>break stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>continue stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>label stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>goto stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>return stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>expression stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>procedure definition<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>variable definition<em>></em> <code>;</code></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>clause stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>compound stat<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <code>;</code></td><td width="40%"><code>(six.compound)</code></td></tr>
<tr><td width="60%"><em><</em>if stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>if</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.if <var>$3</var> <var>$5</var>)</code></td></tr>
<tr><td width="60%"> | <code>if</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <em><</em>stat<em>></em> <code>else</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.if <var>$3</var> <var>$5</var> <var>$7</var>)</code></td></tr>
<tr><td width="60%"><em><</em>for stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>for</code> <code>(</code> <em><</em>stat<em>></em> <code>;</code> <em><</em>oexpr<em>></em> <code>;</code> <em><</em>oexpr<em>></em> <code>)</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.for <var>$3</var> <var>$5</var> <var>$7</var> <var>$9</var>)</code></td></tr>
<tr><td width="60%"><em><</em>while stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>while</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.while <var>$3</var> <var>$5</var>)</code></td></tr>
<tr><td width="60%"><em><</em>do stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>do</code> <em><</em>stat<em>></em> <code>while</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <code>;</code></td><td width="40%"><code>(six.do-while <var>$2</var> <var>$5</var>)</code></td></tr>
<tr><td width="60%"><em><</em>switch stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>switch</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.switch <var>$3</var> <var>$5</var>)</code></td></tr>
<tr><td width="60%"><em><</em>case stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>case</code> <em><</em>expr<em>></em> <code>:</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.case <var>$2</var> <var>$4</var>)</code></td></tr>
<tr><td width="60%"><em><</em>break stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>break</code> <code>;</code></td><td width="40%"><code>(six.break)</code></td></tr>
<tr><td width="60%"><em><</em>continue stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>continue</code> <code>;</code></td><td width="40%"><code>(six.continue)</code></td></tr>
<tr><td width="60%"><em><</em>label stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>identifier<em>></em> <code>:</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.label <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"><em><</em>goto stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>goto</code> <em><</em>expr<em>></em> <code>;</code></td><td width="40%"><code>(six.goto <var>$2</var>)</code></td></tr>
<tr><td width="60%"><em><</em>return stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>return</code> <code>;</code></td><td width="40%"><code>(six.return)</code></td></tr>
<tr><td width="60%"> | <code>return</code> <em><</em>expr<em>></em> <code>;</code></td><td width="40%"><code>(six.return <var>$2</var>)</code></td></tr>
<tr><td width="60%"><em><</em>expression stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr<em>></em> <code>;</code></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>clause stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr<em>></em> <code>.</code></td><td width="40%"><code>(six.clause <var>$1</var>)</code></td></tr>
<tr><td width="60%"><em><</em>pexpr<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>procedure definition<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>variable definition<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>expr<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>procedure definition<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>type<em>></em> <em><</em>id-or-prefix<em>></em> <code>(</code> <em><</em>parameters<em>></em> <code>)</code> <em><</em>body<em>></em></td><td width="40%"><code>(six.define-procedure <var>$2</var> (six.procedure <var>$1</var> <var>$4</var> <var>$6</var>))</code></td></tr>
<tr><td width="60%"><em><</em>variable definition<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>type<em>></em> <em><</em>id-or-prefix<em>></em> <em><</em>dimensions<em>></em> <em><</em>iexpr<em>></em></td><td width="40%"><code>(six.define-variable <var>$2</var> <var>$1</var> <var>$3</var> <var>$4</var>)</code></td></tr>
<tr><td width="60%"><em><</em>iexpr<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>=</code> <em><</em>expr<em>></em></td><td width="40%"><var>$2</var></td></tr>
<tr><td width="60%"> | </td><td width="40%"><code>#f</code></td></tr>
<tr><td width="60%"><em><</em>dimensions<em>></em> ::=</td></tr>
<tr><td width="60%"> | <code>[</code> <em><</em>expr<em>></em> <code>]</code> <em><</em>dimensions<em>></em></td><td width="40%"><code>(<var>$2</var> . <var>$4</var>)</code></td></tr>
<tr><td width="60%"> | </td><td width="40%"><code>()</code></td></tr>
<tr><td width="60%"><em><</em>oexpr<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | </td><td width="40%"><code>#f</code></td></tr>
<tr><td width="60%"><em><</em>expr<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr18<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr18<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr17<em>></em> <code>:-</code> <em><</em>expr18<em>></em></td><td width="40%"><code>(six.x:-y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr17<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr17<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr17<em>></em> <code>,</code> <em><</em>expr16<em>></em></td><td width="40%"><code>(|six.x,y| <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr16<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr16<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr15<em>></em> <code>:=</code> <em><</em>expr16<em>></em></td><td width="40%"><code>(six.x:=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr15<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr15<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr14<em>></em> <code>%=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x%=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>&=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x&=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>*=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x*=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>+=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x+=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>-=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x-=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>/=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x/=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code><<=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x<<=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>>>=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x>>=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>^=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x^=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>|=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(|six.x\|=y| <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr14<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr14<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr13<em>></em> <code>:</code> <em><</em>expr14<em>></em></td><td width="40%"><code>(six.x:y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr13<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr13<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr12<em>></em> <code>?</code> <em><</em>expr<em>></em> <code>:</code> <em><</em>expr13<em>></em></td><td width="40%"><code>(six.x?y:z <var>$1</var> <var>$3</var> <var>$5</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr12<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr12<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr12<em>></em> <code>||</code> <em><</em>expr11<em>></em></td><td width="40%"><code>(|six.x\|\|y| <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr11<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr11<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr11<em>></em> <code>&&</code> <em><</em>expr10<em>></em></td><td width="40%"><code>(six.x&&y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr10<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr10<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr10<em>></em> <code>|</code> <em><</em>expr9<em>></em></td><td width="40%"><code>(|six.x\|y| <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr9<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr9<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr9<em>></em> <code>^</code> <em><</em>expr8<em>></em></td><td width="40%"><code>(six.x^y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr8<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr8<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr8<em>></em> <code>&</code> <em><</em>expr7<em>></em></td><td width="40%"><code>(six.x&y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr7<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr7<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr7<em>></em> <code>!=</code> <em><</em>expr6<em>></em></td><td width="40%"><code>(six.x!=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr7<em>></em> <code>==</code> <em><</em>expr6<em>></em></td><td width="40%"><code>(six.x==y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr6<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr6<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr6<em>></em> <code><</code> <em><</em>expr5<em>></em></td><td width="40%"><code>(six.x<y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr6<em>></em> <code><=</code> <em><</em>expr5<em>></em></td><td width="40%"><code>(six.x<=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr6<em>></em> <code>></code> <em><</em>expr5<em>></em></td><td width="40%"><code>(six.x>y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr6<em>></em> <code>>=</code> <em><</em>expr5<em>></em></td><td width="40%"><code>(six.x>=y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr5<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr5<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr5<em>></em> <code><<</code> <em><</em>expr4<em>></em></td><td width="40%"><code>(six.x<<y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr5<em>></em> <code>>></code> <em><</em>expr4<em>></em></td><td width="40%"><code>(six.x>>y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr4<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr4<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr4<em>></em> <code>+</code> <em><</em>expr3<em>></em></td><td width="40%"><code>(six.x+y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr4<em>></em> <code>-</code> <em><</em>expr3<em>></em></td><td width="40%"><code>(six.x-y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr3<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr3<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr3<em>></em> <code>%</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.x%y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr3<em>></em> <code>*</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.x*y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr3<em>></em> <code>/</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.x/y <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr2<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr2<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>&</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.&x <var>$2</var>)</code></td></tr>
<tr><td width="60%"> | <code>+</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.+x <var>$2</var>)</code></td></tr>
<tr><td width="60%"> | <code>-</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.-x <var>$2</var>)</code></td></tr>
<tr><td width="60%"> | <code>*</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.*x <var>$2</var>)</code></td></tr>
<tr><td width="60%"> | <code>!</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.!x <var>$2</var>)</code></td></tr>
<tr><td width="60%"> | <code>!</code></td><td width="40%"><code>(six.!)</code></td></tr>
<tr><td width="60%"> | <code>++</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.++x <var>$2</var>)</code></td></tr>
<tr><td width="60%"> | <code>--</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.--x <var>$2</var>)</code></td></tr>
<tr><td width="60%"> | <code>~</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.~x <var>$2</var>)</code></td></tr>
<tr><td width="60%"> | <code>new</code> <em><</em>id-or-prefix<em>></em> <code>(</code> <em><</em>arguments<em>></em> <code>)</code></td><td width="40%"><code>(six.new <var>$2</var> . <var>$4</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr1<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr1<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr1<em>></em> <code>++</code></td><td width="40%"><code>(six.x++ <var>$1</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>--</code></td><td width="40%"><code>(six.x-- <var>$1</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>(</code> <em><</em>arguments<em>></em> <code>)</code></td><td width="40%"><code>(six.call <var>$1</var> . <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>[</code> <em><</em>expr<em>></em> <code>]</code></td><td width="40%"><code>(six.index <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>-></code> <em><</em>id-or-prefix<em>></em></td><td width="40%"><code>(six.arrow <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>.</code> <em><</em>id-or-prefix<em>></em></td><td width="40%"><code>(six.dot <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr0<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"><em><</em>expr0<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>id-or-prefix<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | <em><</em>string<em>></em></td><td width="40%"><code>(six.literal <var>$1</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>char<em>></em></td><td width="40%"><code>(six.literal <var>$1</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>number<em>></em></td><td width="40%"><code>(six.literal <var>$1</var>)</code></td></tr>
<tr><td width="60%"> | <code>(</code> <em><</em>expr<em>></em> <code>)</code></td><td width="40%"><var>$2</var></td></tr>
<tr><td width="60%"> | <code>(</code> <em><</em>block stat<em>></em> <code>)</code></td><td width="40%"><var>$2</var></td></tr>
<tr><td width="60%"> | <em><</em>datum-starting-with-#-or-backquote<em>></em></td><td width="40%"><code>(six.prefix <var>$1</var>)</code></td></tr>
<tr><td width="60%"> | <code>[</code> <em><</em>elements<em>></em> <code>]</code></td><td width="40%"><var>$2</var></td></tr>
<tr><td width="60%"> | <em><</em>type<em>></em> <code>(</code> <em><</em>parameters<em>></em> <code>)</code> <em><</em>body<em>></em></td><td width="40%"><code>(six.procedure <var>$1</var> <var>$3</var> <var>$5</var>)</code></td></tr>
<tr><td width="60%"><em><</em>block stat<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>{</code> <em><</em>stat list<em>></em> <code>}</code></td><td width="40%"><code>(six.compound . <var>$2</var>)</code></td></tr>
<tr><td width="60%"><em><</em>body<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>{</code> <em><</em>stat list<em>></em> <code>}</code></td><td width="40%"><code>(six.procedure-body . <var>$2</var>)</code></td></tr>
<tr><td width="60%"><em><</em>stat list<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>stat<em>></em> <em><</em>stat list<em>></em></td><td width="40%"><code>(<var>$1</var> . <var>$2</var>)</code></td></tr>
<tr><td width="60%"> | </td><td width="40%"><code>()</code></td></tr>
<tr><td width="60%"><em><</em>parameters<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>nonempty parameters<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | </td><td width="40%"><code>()</code></td></tr>
<tr><td width="60%"><em><</em>nonempty parameters<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>parameter<em>></em> <code>,</code> <em><</em>nonempty parameters<em>></em></td><td width="40%"><code>(<var>$1</var> . <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>parameter<em>></em></td><td width="40%"><code>(<var>$1</var>)</code></td></tr>
<tr><td width="60%"><em><</em>parameter<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>type<em>></em> <em><</em>id-or-prefix<em>></em></td><td width="40%"><code>(<var>$2</var> <var>$1</var>)</code></td></tr>
<tr><td width="60%"><em><</em>arguments<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>nonempty arguments<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | </td><td width="40%"><code>()</code></td></tr>
<tr><td width="60%"><em><</em>nonempty arguments<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr<em>></em> <code>,</code> <em><</em>nonempty arguments<em>></em></td><td width="40%"><code>(<var>$1</var> . <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr<em>></em></td><td width="40%"><code>(<var>$1</var>)</code></td></tr>
<tr><td width="60%"><em><</em>elements<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>nonempty elements<em>></em></td><td width="40%"><var>$1</var></td></tr>
<tr><td width="60%"> | </td><td width="40%"><code>(six.null)</code></td></tr>
<tr><td width="60%"><em><</em>nonempty elements<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>expr<em>></em></td><td width="40%"><code>(six.list <var>$1</var> (six.null))</code></td></tr>
<tr><td width="60%"> | <em><</em>expr<em>></em> <code>,</code> <em><</em>nonempty elements<em>></em></td><td width="40%"><code>(six.list <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"> | <em><</em>expr<em>></em> <code>|</code> <em><</em>expr<em>></em></td><td width="40%"><code>(six.cons <var>$1</var> <var>$3</var>)</code></td></tr>
<tr><td width="60%"><em><</em>id-or-prefix<em>></em> ::=</td></tr>
<tr><td width="60%"> <em><</em>identifier<em>></em></td><td width="40%"><code>(six.identifier <var>$1</var>)</code></td></tr>
<tr><td width="60%"> | <code>\</code> <em><</em>datum<em>></em></td><td width="40%"><code>(six.prefix <var>$2</var>)</code></td></tr>
<tr><td width="60%"><em><</em>type<em>></em> ::=</td></tr>
<tr><td width="60%"> <code>int</code></td><td width="40%"><code>int</code></td></tr>
<tr><td width="60%"> | <code>char</code></td><td width="40%"><code>char</code></td></tr>
<tr><td width="60%"> | <code>bool</code></td><td width="40%"><code>bool</code></td></tr>
<tr><td width="60%"> | <code>void</code></td><td width="40%"><code>void</code></td></tr>
<tr><td width="60%"> | <code>float</code></td><td width="40%"><code>float</code></td></tr>
<tr><td width="60%"> | <code>double</code></td><td width="40%"><code>double</code></td></tr>
<tr><td width="60%"> | <code>obj</code></td><td width="40%"><code>obj</code></td></tr>
</table>
<hr size="6">
<a name="SIX-semantics"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SIX-grammar" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Scheme-infix-syntax-extension" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">18.12.2 SIX semantics</h3>
<p>The semantics of SIX depends on the definition of the
<code>six.<var>XXX</var></code> identifiers (as functions and macros). Many of
these identifiers are predefined macros which give SIX a semantics
that is close to C’s. The user may override these definitions to
change the semantics either globally or locally. For example,
<code>six.x^y</code> is a predefined macro that expands <code>(six.x^y x y)</code>
into <code>(bitwise-xor x y)</code>. If the user prefers the ‘<samp>^</samp>’
operator to express exponentiation in a specific function, then in
that function <code>six.x^y</code> can be redefined as a macro that expands
<code>(six.x^y x y)</code> into <code>(expt x y)</code>. Note that the
associativity and precedence of operators cannot be changed as that is
a syntactic issue.
</p>
<p>Note that the following identifiers are not predefined, and
consequently they do not have a predefined semantics:
<code>six.label</code>, <code>six.goto</code>, <code>six.switch</code>, <code>six.case</code>,
<code>six.break</code>, <code>six.continue</code>, <code>six.return</code>,
<code>six.clause</code>, <code>six.x:-y</code>, and <code>six.!</code>.
</p>
<p>The following is an example showing some of the predefined semantics
of SIX:
</p>
<table><tr><td> </td><td><pre class="smallexample">> <b>(list (+ 1 2) \3+4; (+ 5 6))</b>
(3 7 11)
> <b>\[ 1+2, \(+ 3 4), 5+6 ];</b>
(3 7 11)
> <b>(map (lambda (x) \(x*x-1)/log(x+1);) '(1 2 3 4))</b>
(0 2.730717679880512 5.7707801635558535 9.320024018394177)
> <b>\obj n = expt(10,5);</b>
> <b>n</b>
100000
> <b>\obj t[3][10] = 88;</b>
> <b>\t[0][9] = t[2][1] = 11;</b>
11
> <b>t</b>
#(#(88 88 88 88 88 88 88 88 88 11)
#(88 88 88 88 88 88 88 88 88 88)
#(88 11 88 88 88 88 88 88 88 88))
> <b>\obj radix = new parameter (10);</b>
> <b>\radix(2);</b>
> <b>\radix();</b>
2
> <b>\for (int i=0; i<5; i++) pp(1<<i*8);</b>
1
256
65536
16777216
4294967296
> <b>\obj \make-adder (obj x) { obj (obj y) { x+y; }; }</b>
> <b>\map (new adder (100), [1,2,3,4]);</b>
(101 102 103 104)
> <b>(map (make-adder 100) (list 1 2 3 4))</b>
(101 102 103 104)
</pre></td></tr></table>
<hr size="6">
<a name="C_002dinterface"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SIX-semantics" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#mapping-of-types" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="C_002dinterface-1"></a>
<h1 class="chapter">19. C-interface</h1>
<a name="index-FFI"></a>
<a name="index-foreign-function-interface"></a>
<p>The Gambit Scheme system offers a mechanism for interfacing Scheme code
and C code called the “C-interface”. A Scheme program indicates which
C functions it needs to have access to and which Scheme procedures can
be called from C, and the C interface automatically constructs the
corresponding Scheme procedures and C functions. The conversions needed
to transform data from the Scheme representation to the C representation
(and back), are generated automatically in accordance with the argument
and result types of the C function or Scheme procedure.
</p>
<p>The C-interface places some restrictions on the types of data that can
be exchanged between C and Scheme. The mapping of data types between C
and Scheme is discussed in the next section. The remaining sections of
this chapter describe each special form of the C-interface.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#mapping-of-types">19.1 The mapping of types between C and Scheme</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#c_002ddefine_002dtype">19.6 The <code>c-define-type</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#continuations">19.7 Continuations and the C-interface</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="mapping-of-types"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#C_002dinterface" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#c_002ddeclare" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-mapping-of-types-between-C-and-Scheme"></a>
<h2 class="section">19.1 The mapping of types between C and Scheme</h2>
<p>Scheme and C do not provide the same set of built-in data types so it is
important to understand which Scheme type is compatible with which C
type and how values get mapped from one environment to the other. To
improve compatibility a new type is added to Scheme, the ‘<samp>foreign</samp>’
object type, and the following data types are added to C:
</p>
<dl compact="compact">
<dt> <code>scheme-object</code></dt>
<dd><p>denotes the universal type of Scheme objects
(type <code>___SCMOBJ</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>bool</code></dt>
<dd><p>denotes the C++ ‘<samp>bool</samp>’ type or the C ‘<samp>int</samp>’ type
(type <code>___BOOL</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>int8</code></dt>
<dd><p>8 bit signed integer (type <code>___S8</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>unsigned-int8</code></dt>
<dd><p>8 bit unsigned integer (type <code>___U8</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>int16</code></dt>
<dd><p>16 bit signed integer (type <code>___S16</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>unsigned-int16</code></dt>
<dd><p>16 bit unsigned integer (type <code>___U16</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>int32</code></dt>
<dd><p>32 bit signed integer (type <code>___S32</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>unsigned-int32</code></dt>
<dd><p>32 bit unsigned integer (type <code>___U32</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>int64</code></dt>
<dd><p>64 bit signed integer (type <code>___S64</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>unsigned-int64</code></dt>
<dd><p>64 bit unsigned integer (type <code>___U64</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>float32</code></dt>
<dd><p>32 bit floating point number (type <code>___F32</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>float64</code></dt>
<dd><p>64 bit floating point number (type <code>___F64</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>ISO-8859-1</code></dt>
<dd><p>denotes ISO-8859-1 encoded characters
(8 bit unsigned integer, type <code>___ISO_8859_1</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>UCS-2</code></dt>
<dd><p>denotes UCS-2 encoded characters
(16 bit unsigned integer, type <code>___UCS_2</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>UCS-4</code></dt>
<dd><p>denotes UCS-4 encoded characters
(32 bit unsigned integer, type <code>___UCS_4</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>char-string</code></dt>
<dd><p>denotes the C ‘<samp>char*</samp>’ type when used as a null terminated string
</p></dd>
<dt> <code>nonnull-char-string</code></dt>
<dd><p>denotes the nonnull C ‘<samp>char*</samp>’ type when used as a null terminated string
</p></dd>
<dt> <code>nonnull-char-string-list</code></dt>
<dd><p>denotes an array of nonnull C ‘<samp>char*</samp>’ terminated with a null pointer
</p></dd>
<dt> <code>ISO-8859-1-string</code></dt>
<dd><p>denotes ISO-8859-1 encoded strings
(null terminated string of 8 bit unsigned integers, i.e. <code>___ISO_8859_1*</code>)
</p></dd>
<dt> <code>nonnull-ISO-8859-1-string</code></dt>
<dd><p>denotes nonnull ISO-8859-1 encoded strings
(null terminated string of 8 bit unsigned integers, i.e. <code>___ISO_8859_1*</code>)
</p></dd>
<dt> <code>nonnull-ISO-8859-1-stringlist</code></dt>
<dd><p>denotes an array of nonnull ISO-8859-1 encoded strings terminated with a null pointer
</p></dd>
<dt> <code>UTF-8-string</code></dt>
<dd><p>denotes UTF-8 encoded strings
(null terminated string of <code>char</code>, i.e. <code>char*</code>)
</p></dd>
<dt> <code>nonnull-UTF-8-string</code></dt>
<dd><p>denotes nonnull UTF-8 encoded strings
(null terminated string of <code>char</code>, i.e. <code>char*</code>)
</p></dd>
<dt> <code>nonnull-UTF-8-string-list</code></dt>
<dd><p>denotes an array of nonnull UTF-8 encoded strings terminated with a null pointer
</p></dd>
<dt> <code>UTF-16-string</code></dt>
<dd><p>denotes UTF-16 encoded strings
(null terminated string of <code>char</code>, i.e. <code>char*</code>)
</p></dd>
<dt> <code>nonnull-UTF-16-string</code></dt>
<dd><p>denotes nonnull UTF-16 encoded strings
(null terminated string of <code>char</code>, i.e. <code>char*</code>)
</p></dd>
<dt> <code>nonnull-UTF-16-string-list</code></dt>
<dd><p>denotes an array of nonnull UTF-16 encoded strings terminated with a null pointer
</p></dd>
<dt> <code>UCS-2-string</code></dt>
<dd><p>denotes UCS-2 encoded strings
(null terminated string of 16 bit unsigned integers, i.e. <code>___UCS_2*</code>)
</p></dd>
<dt> <code>nonnull-UCS-2-string</code></dt>
<dd><p>denotes nonnull UCS-2 encoded strings
(null terminated string of 16 bit unsigned integers, i.e. <code>___UCS_2*</code>)
</p></dd>
<dt> <code>nonnull-UCS-2-string-list</code></dt>
<dd><p>denotes an array of nonnull UCS-2 encoded strings terminated with a null pointer
</p></dd>
<dt> <code>UCS-4-string</code></dt>
<dd><p>denotes UCS-4 encoded strings
(null terminated string of 32 bit unsigned integers, i.e. <code>___UCS_4*</code>)
</p></dd>
<dt> <code>nonnull-UCS-4-string</code></dt>
<dd><p>denotes nonnull UCS-4 encoded strings
(null terminated string of 32 bit unsigned integers, i.e. <code>___UCS_4*</code>)
</p></dd>
<dt> <code>nonnull-UCS-4-string-list</code></dt>
<dd><p>denotes an array of nonnull UCS-4 encoded strings terminated with a null pointer
</p></dd>
<dt> <code>wchar_t-string</code></dt>
<dd><p>denotes <code>wchar_t</code> encoded strings
(null terminated string of <code>wchar_t</code>, i.e. <code>wchar_t*</code>)
</p></dd>
<dt> <code>nonnull-wchar_t-string</code></dt>
<dd><p>denotes nonnull <code>wchar_t</code> encoded strings
(null terminated string of <code>wchar_t</code>, i.e. <code>wchar_t*</code>)
</p></dd>
<dt> <code>nonnull-wchar_t-string-list</code></dt>
<dd><p>denotes an array of nonnull <code>wchar_t</code> encoded strings terminated with a null pointer
</p></dd>
</dl>
<p>To specify a particular C type inside the <code>c-lambda</code>,
<code>c-define</code> and <code>c-define-type</code> forms, the following “Scheme
notation” is used:
</p>
<dl compact="compact">
<dt> <code><span class="roman">Scheme notation</span></code></dt>
<dd><p>C type
</p></dd>
<dt> <code>void</code></dt>
<dd><p><code>void</code>
</p></dd>
<dt> <code>bool</code></dt>
<dd><p><code>bool</code>
</p></dd>
<dt> <code>char</code></dt>
<dd><p><code>char</code> (may be signed or unsigned depending on the C compiler)
</p></dd>
<dt> <code>signed-char</code></dt>
<dd><p><code>signed char</code>
</p></dd>
<dt> <code>unsigned-char</code></dt>
<dd><p><code>unsigned char</code>
</p></dd>
<dt> <code>ISO-8859-1</code></dt>
<dd><p><code>ISO-8859-1</code>
</p></dd>
<dt> <code>UCS-2</code></dt>
<dd><p><code>UCS-2</code>
</p></dd>
<dt> <code>UCS-4</code></dt>
<dd><p><code>UCS-4</code>
</p></dd>
<dt> <code>wchar_t</code></dt>
<dd><p><code>wchar_t</code>
</p></dd>
<dt> <code>size_t</code></dt>
<dd><p><code>size_t</code> (type <code>___SIZE_T</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>ssize_t</code></dt>
<dd><p><code>ssize_t</code> (type <code>___SSIZE_T</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>ptrdiff_t</code></dt>
<dd><p><code>ptrdiff_t</code> (type <code>___PTRDIFF_T</code> defined in ‘<samp>gambit.h</samp>’)
</p></dd>
<dt> <code>short</code></dt>
<dd><p><code>short</code>
</p></dd>
<dt> <code>unsigned-short</code></dt>
<dd><p><code>unsigned short</code>
</p></dd>
<dt> <code>int</code></dt>
<dd><p><code>int</code>
</p></dd>
<dt> <code>unsigned-int</code></dt>
<dd><p><code>unsigned int</code>
</p></dd>
<dt> <code>long</code></dt>
<dd><p><code>long</code>
</p></dd>
<dt> <code>unsigned-long</code></dt>
<dd><p><code>unsigned long</code>
</p></dd>
<dt> <code>long-long</code></dt>
<dd><p><code>long long</code>
</p></dd>
<dt> <code>unsigned-long-long</code></dt>
<dd><p><code>unsigned long long</code>
</p></dd>
<dt> <code>float</code></dt>
<dd><p><code>float</code>
</p></dd>
<dt> <code>double</code></dt>
<dd><p><code>double</code>
</p></dd>
<dt> <code>int8</code></dt>
<dd><p><code>int8</code>
</p></dd>
<dt> <code>unsigned-int8</code></dt>
<dd><p><code>unsigned-int8</code>
</p></dd>
<dt> <code>int16</code></dt>
<dd><p><code>int16</code>
</p></dd>
<dt> <code>unsigned-int16</code></dt>
<dd><p><code>unsigned-int16</code>
</p></dd>
<dt> <code>int32</code></dt>
<dd><p><code>int32</code>
</p></dd>
<dt> <code>unsigned-int32</code></dt>
<dd><p><code>unsigned-int32</code>
</p></dd>
<dt> <code>int64</code></dt>
<dd><p><code>int64</code>
</p></dd>
<dt> <code>unsigned-int64</code></dt>
<dd><p><code>unsigned-int64</code>
</p></dd>
<dt> <code>float32</code></dt>
<dd><p><code>float32</code>
</p></dd>
<dt> <code>float64</code></dt>
<dd><p><code>float64</code>
</p></dd>
<dt> <code>(struct "<var>c-struct-id</var>" <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt>
<dd><p><code>struct <var>c-struct-id</var></code> (where <var>c-struct-id</var> is the name of a
C structure; see below for the meaning of <var>tags</var> and <var>release-function</var>)
</p></dd>
<dt> <code>(union "<var>c-union-id</var>" <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt>
<dd><p><code>union <var>c-union-id</var></code> (where <var>c-union-id</var> is the name of a
C union; see below for the meaning of <var>tags</var> and <var>release-function</var>)
</p></dd>
<dt> <code>(type "<var>c-type-id</var>" <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt>
<dd><p><code><var>c-type-id</var></code> (where <var>c-type-id</var> is an identifier naming a
C type; see below for the meaning of <var>tags</var> and <var>release-function</var>)
</p></dd>
<dt> <code>(pointer <var>type</var> <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt>
<dd><p><code><var>T</var>*</code> (where <var>T</var> is the C equivalent of <var>type</var>
which must be the Scheme notation of a C type; see below for the meaning
of <var>tags</var> and <var>release-function</var>)
</p></dd>
<dt> <code>(nonnull-pointer <var>type</var> <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt>
<dd><p>same as <code>(pointer <var>type</var> <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code>
except the <code>NULL</code> pointer is not allowed
</p></dd>
<dt> <code>(function (<var>type1</var>…) <var>result-type</var>)</code></dt>
<dd><p>function with the given argument types and result type
</p></dd>
<dt> <code>(nonnull-function (<var>type1</var>…) <var>result-type</var>)</code></dt>
<dd><p>same as <code>(function (<var>type1</var>…) <var>result-type</var>)</code>
except the <code>NULL</code> pointer is not allowed
</p></dd>
<dt> <code>char-string</code></dt>
<dd><p><code>char-string</code>
</p></dd>
<dt> <code>nonnull-char-string</code></dt>
<dd><p><code>nonnull-char-string</code>
</p></dd>
<dt> <code>nonnull-char-string-list</code></dt>
<dd><p><code>nonnull-char-string-list</code>
</p></dd>
<dt> <code>ISO-8859-1-string</code></dt>
<dd><p><code>ISO-8859-1-string</code>
</p></dd>
<dt> <code>nonnull-ISO-8859-1-string</code></dt>
<dd><p><code>nonnull-ISO-8859-1-string</code>
</p></dd>
<dt> <code>nonnull-ISO-8859-1-string-list</code></dt>
<dd><p><code>nonnull-ISO-8859-1-string-list</code>
</p></dd>
<dt> <code>UTF-8-string</code></dt>
<dd><p><code>UTF-8-string</code>
</p></dd>
<dt> <code>nonnull-UTF-8-string</code></dt>
<dd><p><code>nonnull-UTF-8-string</code>
</p></dd>
<dt> <code>nonnull-UTF-8-string-list</code></dt>
<dd><p><code>nonnull-UTF-8-string-list</code>
</p></dd>
<dt> <code>UTF-16-string</code></dt>
<dd><p><code>UTF-16-string</code>
</p></dd>
<dt> <code>nonnull-UTF-16-string</code></dt>
<dd><p><code>nonnull-UTF-16-string</code>
</p></dd>
<dt> <code>nonnull-UTF-16-string-list</code></dt>
<dd><p><code>nonnull-UTF-16-string-list</code>
</p></dd>
<dt> <code>UCS-2-string</code></dt>
<dd><p><code>UCS-2-string</code>
</p></dd>
<dt> <code>nonnull-UCS-2-string</code></dt>
<dd><p><code>nonnull-UCS-2-string</code>
</p></dd>
<dt> <code>nonnull-UCS-2-string-list</code></dt>
<dd><p><code>nonnull-UCS-2-string-list</code>
</p></dd>
<dt> <code>UCS-4-string</code></dt>
<dd><p><code>UCS-4-string</code>
</p></dd>
<dt> <code>nonnull-UCS-4-string</code></dt>
<dd><p><code>nonnull-UCS-4-string</code>
</p></dd>
<dt> <code>nonnull-UCS-4-string-list</code></dt>
<dd><p><code>nonnull-UCS-4-string-list</code>
</p></dd>
<dt> <code>wchar_t-string</code></dt>
<dd><p><code>wchar_t-string</code>
</p></dd>
<dt> <code>nonnull-wchar_t-string</code></dt>
<dd><p><code>nonnull-wchar_t-string</code>
</p></dd>
<dt> <code>nonnull-wchar_t-string-list</code></dt>
<dd><p><code>nonnull-wchar_t-string-list</code>
</p></dd>
<dt> <code>scheme-object</code></dt>
<dd><p><code>scheme-object</code>
</p></dd>
<dt> <code><var>name</var></code></dt>
<dd><p>appropriate translation of <var>name</var> (where <var>name</var>
is a C type defined with <code>c-define-type</code>)
</p></dd>
<dt> <code>"<var>c-type-id</var>"</code></dt>
<dd><p><var>c-type-id</var> (this form is equivalent to <code>(type "<var>c-type-id</var>")</code>)
</p></dd>
</dl>
<p>The <code>struct</code>, <code>union</code>, <code>type</code>, <code>pointer</code> and
<code>nonnull-pointer</code> types are “foreign types” and they are
represented on the Scheme side as “foreign objects”. A foreign object
is internally represented as a pointer. This internal pointer is
identical to the C pointer being represented in the case of the
<code>pointer</code> and <code>nonnull-pointer</code> types.
</p>
<p>In the case of the <code>struct</code>, <code>union</code> and <code>type</code> types,
the internal pointer points to a copy of the C data type being
represented. When an instance of one of these types is converted from C
to Scheme, a block of memory is allocated from the C heap and
initialized with the instance and then a foreign object is allocated
from the Scheme heap and initialized with the pointer to this copy.
This approach may appear overly complex, but it allows the conversion of
C++ classes that do not have a zero parameter constructor or an
assignment method (i.e. when compiling with a C++ compiler an instance
is copied using ‘<samp>new <var>type</var> (<var>instance</var>)</samp>’, which calls the
copy-constructor of <var>type</var> if it is a class; <var>type</var>’s assignment
operator is never used). Conversion from Scheme to C simply
dereferences the internal pointer (no allocation from the C heap is
performed). Deallocation of the copy on the C heap is under the control
of the release function attached to the foreign object (see below).
</p>
<p>The optional <var>tags</var> field of foreign type specifications is used
for type checking on the Scheme side. The <var>tags</var> field must be
<code>#f</code>, a symbol or a non-empty list of symbols. When it is not
specified the <var>tags</var> field defaults to a symbol whose name, as
returned by <code>symbol->string</code>, is the C type declaration for that
type. For example the symbol ‘<samp>char**</samp>’ is the default for the
type ‘<samp>(pointer (pointer char))</samp>’. A <var>tags</var> field that is a
single symbol is equivalent to a list containing only that symbol.
The first symbol in the list of tags is the primary tag. For example
the primary tag of the type ‘<samp>(pointer char)</samp>’ is ‘<samp>char*</samp>’ and
the primary tag of the type ‘<samp>(pointer char (foo bar))</samp>’ is
‘<samp>foo</samp>’.
</p>
<p>Type compatibility between two foreign types depends on their tags.
An instance of a foreign type <var>T</var> can be used where a foreign type
<var>E</var> is expected if and only if
</p>
<ul>
<li>
<var>T</var>’s <var>tags</var> field is <code>#f</code>, or
</li><li>
<var>E</var>’s <var>tags</var> field is <code>#f</code>, or
</li><li>
<var>T</var>’s primary tag is a member of <var>E</var>’s tags.
</li></ul>
<p>For the safest code a <var>tags</var> field of <code>#f</code> should be used
sparingly, as it completely bypasses type checking. The external
representation of Scheme foreign objects (used by the <code>write</code>
procedure) contains the primary tag (if the <var>tags</var> field is not
<code>#f</code>), and the hexadecimal address denoted by the internal
pointer, for example ‘<samp>#<char** #2 0x2AAC535C></samp>’. Note that the
hexadecimal address is in C notation, which can be easily transferred
to a C debugger with a “cut-and-paste”.
</p>
<p>A <var>release-function</var> can also be specified within a foreign type
specification. The <var>release-function</var> must be <code>#f</code> or a string
naming a C function with a single parameter of type ‘<samp>void*</samp>’ (in
which the internal pointer is passed) and with a result of type
‘<samp>___SCMOBJ</samp>’ (for returning an error code). When the
<var>release-function</var> is not specified or is <code>#f</code> a default
function is constructed by the C-interface. This default function does
nothing in the case of the <code>pointer</code> and <code>nonnull-pointer</code>
types (deallocation is not the responsibility of the C-interface) and
returns the fixnum ‘<samp>___FIX(___NO_ERR)</samp>’ to indicate no error. In
the case of the <code>struct</code>, <code>union</code> and <code>type</code> types, the
default function reclaims the copy on the C heap referenced by the
internal pointer (when using a C++ compiler this is done using
‘<samp>delete (<var>type</var>*)<var>internal-pointer</var></samp>’, which calls the
destructor of <var>type</var> if it is a class) and returns
‘<samp>___FIX(___NO_ERR)</samp>’. In many situations the default
<var>release-function</var> will perform the appropriate cleanup for the
foreign type. However, in certain cases special operations (such as
decrementing a reference count, removing the object from a table, etc)
must be performed. For such cases a user supplied
<var>release-function</var> is needed.
</p>
<p>The <var>release-function</var> is invoked at most once for any foreign
object. After the <var>release-function</var> is invoked, the foreign
object is considered “released” and can no longer be used in a
foreign type conversion. When the garbage collector detects that a
foreign object is no longer reachable by the program, it will invoke
the <var>release-function</var> if the foreign object is not yet released.
When there is a need to release the foreign object promptly, the
program can explicitly call <code>(foreign-release! <var>obj</var>)</code> which
invokes the <var>release-function</var> if the foreign object is not yet
released, and does nothing otherwise. The call
<code>(foreign-released? <var>obj</var>)</code> returns a boolean indicating
whether the foreign object <var>obj</var> has been released yet or not.
The call <code>(foreign-address <var>obj</var>)</code> returns the address
denoted by the internal pointer of foreign object <var>obj</var> or 0 if it
has been released. The call <code>(foreign? <var>obj</var>)</code> tests that
<var>obj</var> is a foreign object. Finally the call <code>(foreign-tags
<var>obj</var>)</code> returns the list of tags of foreign object <var>obj</var>, or
<code>#f</code>.
</p>
<p>The following table gives the C types to which each Scheme type
can be converted:
</p>
<dl compact="compact">
<dt> Scheme type</dt>
<dd><p>Allowed target C types
</p></dd>
<dt> boolean <code>#f</code></dt>
<dd><p><code>scheme-object</code>; <code>bool</code>;
<code>pointer</code>;
<code>function</code>;
<code>char-string</code>;
<code>ISO-8859-1-string</code>;
<code>UTF-8-string</code>;
<code>UTF-16-string</code>;
<code>UCS-2-string</code>;
<code>UCS-4-string</code>;
<code>wchar_t-string</code>
</p></dd>
<dt> boolean <code>#t</code></dt>
<dd><p><code>scheme-object</code>; <code>bool</code>
</p></dd>
<dt> character</dt>
<dd><p><code>scheme-object</code>; <code>bool</code>;
<span class="roman">[</span><code><span class="roman">[</span>un<span class="roman">]</span>signed</code><span class="roman">]</span> <code>char</code>; <code>ISO-8859-1</code>; <code>UCS-2</code>;
<code>UCS-4</code>; <code>wchar_t</code>
</p></dd>
<dt> exact integer</dt>
<dd><p><code>scheme-object</code>; <code>bool</code>; <span class="roman">[</span><code>unsigned-</code><span class="roman">]</span>
<code>int8</code>/<code>int16</code>/<code>int32</code>/<code>int64</code>; <span class="roman">[</span><code>unsigned</code><span class="roman">]</span>
<code>short</code>/<code>int</code>/<code>long</code>; <code>size_t</code>/<code>ssize_t</code>/<code>ptrdiff_t</code>
</p></dd>
<dt> inexact real</dt>
<dd><p><code>scheme-object</code>; <code>bool</code>; <code>float</code>; <code>double</code>; <code>float32</code>; <code>float64</code>
</p></dd>
<dt> string</dt>
<dd><p><code>scheme-object</code>; <code>bool</code>;
<code>char-string</code>;
<code>nonnull-char-string</code>;
<code>ISO-8859-1-string</code>;
<code>nonnull-ISO-8859-1-string</code>;
<code>UTF-8-string</code>;
<code>nonnull-UTF-8-string</code>;
<code>UTF-16-string</code>;
<code>nonnull-UTF-16-string</code>;
<code>UCS-2-string</code>;
<code>nonnull-UCS-2-string</code>;
<code>UCS-4-string</code>;
<code>nonnull-UCS-4-string</code>;
<code>wchar_t-string</code>;
<code>nonnull-wchar_t-string</code>
</p></dd>
<dt> foreign object</dt>
<dd><p><code>scheme-object</code>; <code>bool</code>; <code>struct</code>/<code>union</code>/<code>type</code>/<code>pointer</code>/<code>nonnull-pointer</code> with the appropriate tags
</p></dd>
<dt> vector</dt>
<dd><p><code>scheme-object</code>; <code>bool</code>
</p></dd>
<dt> symbol</dt>
<dd><p><code>scheme-object</code>; <code>bool</code>
</p></dd>
<dt> procedure</dt>
<dd><p><code>scheme-object</code>; <code>bool</code>;
<code>function</code>;
<code>nonnull-function</code>
</p></dd>
<dt> other objects</dt>
<dd><p><code>scheme-object</code>; <code>bool</code>
</p></dd>
</dl>
<p>The following table gives the Scheme types to which each C type
will be converted:
</p>
<dl compact="compact">
<dt> C type</dt>
<dd><p>Resulting Scheme type
</p></dd>
<dt> scheme-object</dt>
<dd><p>the Scheme object encoded
</p></dd>
<dt> bool</dt>
<dd><p>boolean
</p></dd>
<dt> <span class="roman">[</span><code><span class="roman">[</span>un<span class="roman">]</span>signed</code><span class="roman">]</span> <code>char</code>; <code>ISO-8859-1</code>; <code>UCS-2</code>; <code>UCS-4</code>; <code>wchar_t</code></dt>
<dd><p>character
</p></dd>
<dt> <span class="roman">[</span><code>unsigned-</code><span class="roman">]</span> <code>int8</code>/<code>int16</code>/<code>int32</code>/<code>int64</code>; <span class="roman">[</span><code>unsigned</code><span class="roman">]</span> <code>short</code>/<code>int</code>/<code>long</code>; <code>size_t</code>/<code>ssize_t</code>/<code>ptrdiff_t</code></dt>
<dd><p>exact integer
</p></dd>
<dt> <code>float</code>; <code>double</code>; <code>float32</code>; <code>float64</code></dt>
<dd><p>inexact real
</p></dd>
<dt> <code>char-string</code>; <code>ISO-8859-1-string</code>; <code>UTF-8-string</code>; <code>UTF-16-string</code>; <code>UCS-2-string</code>; <code>UCS-4-string</code>; <code>wchar_t-string</code></dt>
<dd><p>string or <code>#f</code> if it is equal to ‘<samp>NULL</samp>’
</p></dd>
<dt> <code>nonnull-char-string</code>; <code>nonnull-ISO-8859-1-string</code>; <code>nonnull-UTF-8-string</code>; <code>nonnull-UTF-16-string</code>; <code>nonnull-UCS-2-string</code>; <code>nonnull-UCS-4-string</code>; <code>nonnull-wchar_t-string</code></dt>
<dd><p>string
</p></dd>
<dt> <code>struct</code>/<code>union</code>/<code>type</code>/<code>pointer</code>/<code>nonnull-pointer</code></dt>
<dd><p>foreign object with the appropriate tags
or <code>#f</code> in the case of a <code>pointer</code> equal to ‘<samp>NULL</samp>’
</p></dd>
<dt> <code>function</code></dt>
<dd><p>procedure or <code>#f</code> if it is equal to ‘<samp>NULL</samp>’
</p></dd>
<dt> <code>nonnull-function</code></dt>
<dd><p>procedure
</p></dd>
<dt> <code>void</code></dt>
<dd><p>void object
</p></dd>
</dl>
<p>All Scheme types are compatible with the C types <code>scheme-object</code>
and <code>bool</code>. Conversion to and from the C type
<code>scheme-object</code> is the identity function on the object encoding.
This provides a low-level mechanism for accessing Scheme’s object
representation from C (with the help of the macros in the
‘<samp>gambit.h</samp>’ header file). When a C <code>bool</code> type is expected,
an extended Scheme boolean can be passed (<code>#f</code> is converted to 0
and all other values are converted to 1).
</p>
<p>The Scheme boolean <code>#f</code> can be passed to the C environment where
a <code>char-string</code>, <code>ISO-8859-1-string</code>, <code>UTF-8-string</code>,
<code>UTF-16-string</code>, <code>UCS-2-string</code>, <code>UCS-4-string</code>,
<code>wchar_t-string</code>, <code>pointer</code> or <code>function</code> type is
expected. In this case, <code>#f</code> is converted to the ‘<samp>NULL</samp>’
pointer. C <code>bool</code>s are extended booleans so any value different
from 0 represents true. Thus, a C <code>bool</code> passed to the Scheme
environment is mapped as follows: 0 to <code>#f</code> and all other values
to <code>#t</code>.
</p>
<p>A Scheme character passed to the C environment where any C character
type is expected is converted to the corresponding character in the C
environment. An error is signaled if the Scheme character does not fit
in the C character. Any C character type passed to Scheme is converted
to the corresponding Scheme character. An error is signaled if the C
character does not fit in the Scheme character.
</p>
<p>A Scheme exact integer passed to the C environment where a C integer
type (other than <code>char</code>) is expected is converted to the
corresponding integral value. An error is signaled if the value falls
outside of the range representable by that integral type. C integer
values passed to the Scheme environment are mapped to the same Scheme
exact integer. If the value is outside the fixnum range, a bignum is
created.
</p>
<p>A Scheme inexact real passed to the C environment is converted to the
corresponding <code>float</code>, <code>double</code>, <code>float32</code> or
<code>float64</code> value. C <code>float</code>, <code>double</code>, <code>float32</code> and
<code>float64</code> values passed to the Scheme environment are mapped to the
closest Scheme inexact real.
</p>
<p>Scheme’s rational numbers and complex numbers are not compatible with
any C numeric type.
</p>
<p>A Scheme string passed to the C environment where any C string type is
expected is converted to a null terminated string using the appropriate
encoding. The C string is a fresh copy of the Scheme string. If the C
string was created for an argument of a <code>c-lambda</code>, the C string
will be reclaimed when the <code>c-lambda</code> returns. If the C string was
created for returning the result of a <code>c-define</code> to C, the caller
is responsible for reclaiming the C string with a call to the
<code>___release_string</code> function (see below for an example). Any C
string type passed to the Scheme environment causes the creation of a
fresh Scheme string containing a copy of the C string (unless the C
string is equal to <code>NULL</code>, in which case it is converted to
<code>#f</code>).
</p>
<p>A foreign type passed to the Scheme environment causes the creation
and initialization of a Scheme foreign object with the appropriate
tags (except for the case of a <code>pointer</code> equal to <code>NULL</code>
which is converted to <code>#f</code>). A Scheme foreign object can be
passed where a foreign type is expected, on the condition that the
tags are compatible and the Scheme foreign object is not yet released.
The value <code>#f</code> is also acceptable for a <code>pointer</code> type, and
is converted to <code>NULL</code>.
</p>
<p>Scheme procedures defined with the <code>c-define</code> special form can be
passed where the <code>function</code> and <code>nonnull-function</code> types are
expected. The value <code>#f</code> is also acceptable for a <code>function</code>
type, and is converted to <code>NULL</code>. No other Scheme procedures are
acceptable. Conversion from the <code>function</code> and
<code>nonnull-function</code> types to Scheme procedures is not currently
implemented.
</p>
<hr size="6">
<a name="c_002ddeclare"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#mapping-of-types" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#c_002dinitialize" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-c_002ddeclare-special-form"></a>
<h2 class="section">19.2 The <code>c-declare</code> special form</h2>
<a name="index-c_002ddeclare"></a>
<a name="Definition_of_c-declare"></a><a name="Special_form_c-declare"></a><a name="index-c_002ddeclare-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_c-declare">c-declare</a></b></code><i> <span class="roman"><i>c-declaration</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<p>Initially, the C file produced by <code>gsc</code> contains only an
‘<samp>#include</samp>’ of ‘<samp>gambit.h</samp>’. This header file provides a
number of macro and procedure declarations to access the Scheme object
representation. The special form <code>c-declare</code> adds
<i>c-declaration</i> (which must be a string containing the C
declarations) to the C file. This string is copied to the C file on a
new line so it can start with preprocessor directives. All types of C
declarations are allowed (including type declarations, variable
declarations, function declarations, ‘<samp>#include</samp>’ directives,
‘<samp>#define</samp>’s, and so on). These declarations are visible to
subsequent <code>c-declare</code>s, <code>c-initialize</code>s, and
<code>c-lambda</code>s, and <code>c-define</code>s in the same module. The most
common use of this special form is to declare the external functions
that are referenced in <code>c-lambda</code> special forms. Such functions
must either be declared explicitly or by including a header file which
contains the appropriate C declarations.
</p>
<p>The <code>c-declare</code> special form does not return a value.
It can only appear at top level.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end
#include <stdio.h>
extern char *getlogin ();
#ifdef sparc
char *host = "sparc";
#else
char *host = "unknown";
#endif
FILE *tfile;
c-declare-end
)
</pre></td></tr></table>
<hr size="6">
<a name="c_002dinitialize"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#c_002ddeclare" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#c_002dlambda" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-c_002dinitialize-special-form"></a>
<h2 class="section">19.3 The <code>c-initialize</code> special form</h2>
<a name="index-c_002dinitialize"></a>
<a name="Definition_of_c-initialize"></a><a name="Special_form_c-initialize"></a><a name="index-c_002dinitialize-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_c-initialize">c-initialize</a></b></code><i> <span class="roman"><i>c-code</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<p>Just after the program is loaded and before control is passed to the
Scheme code, each C file is initialized by calling its associated
initialization function. The body of this function is normally empty
but it can be extended by using the <code>c-initialize</code> form. Each
occurence of the <code>c-initialize</code> form adds code to the body of the
initialization function in the order of appearance in the source file.
<i>c-code</i> must be a string containing the C code to execute. This
string is copied to the C file on a new line so it can start with
preprocessor directives.
</p>
<p>The <code>c-initialize</code> special form does not return a value.
It can only appear at top level.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-initialize "tfile = tmpfile ();")
</pre></td></tr></table>
<hr size="6">
<a name="c_002dlambda"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#c_002dinitialize" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#c_002ddefine" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-c_002dlambda-special-form"></a>
<h2 class="section">19.4 The <code>c-lambda</code> special form</h2>
<a name="index-c_002dlambda"></a>
<a name="Definition_of_c-lambda"></a><a name="Special_form_c-lambda"></a><a name="index-c_002dlambda-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_c-lambda">c-lambda</a></b></code><i> (<span class="roman"><i>type1</i></span>…) <span class="roman"><i>result-type</i></span> <span class="roman"><i>c-name-or-code</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<p>The <code>c-lambda</code> special form makes it possible to create a Scheme
procedure that will act as a representative of some C function or C code
sequence. The first subform is a list containing the type of each
argument. The type of the function’s result is given next. Finally,
the last subform is a string that either contains the name of the C
function to call or some sequence of C code to execute. Variadic C
functions are not supported. The resulting Scheme procedure takes
exactly the number of arguments specified and delivers them in the same
order to the C function. When the Scheme procedure is called, the
arguments will be converted to their C representation and then the C
function will be called. The result returned by the C function will be
converted to its Scheme representation and this value will be returned
from the Scheme procedure call. An error will be signaled if some
conversion is not possible. The temporary memory allocated from the C
heap for the conversion of the arguments and result will be reclaimed
whether there is an error or not.
</p>
<p>When <i>c-name-or-code</i> is not a valid C identifier, it is treated as
an arbitrary piece of C code. Within the C code the variables
‘<samp>___arg1</samp>’, ‘<samp>___arg2</samp>’, etc. can be referenced to access the
converted arguments. Note that the C <code>return</code> statement can’t be
used to return from the procedure. Instead, the <code>___return</code>
macro must be used. A procedure whose <i>result-type</i> is not
<code>void</code> must pass the procedure’s result as the single argument to
the <code>___return</code> macro, for example ‘<samp>___return(123);</samp>’ to
return the value 123. When <i>result-type</i> is <code>void</code>, the
<code>___return</code> macro must be called without a parameter list, for
example ‘<samp>___return;</samp>’.
</p>
<p>The C code is copied to the C file on a new line so it can start with
preprocessor directives. Moreover the C code is always placed at the
head of a compound statement whose lifetime encloses the C to Scheme
conversion of the procedure’s result. Consequently, temporary storage
(strings in particular) declared at the head of the C code can be
returned with the <code>___return</code> macro.
</p>
<p>In the <i>c-name-or-code</i>, the macro ‘<samp>___AT_END</samp>’ may be defined
as the piece of C code to execute before control is returned to Scheme
but after the procedure’s result is converted to its Scheme
representation. This is mainly useful to deallocate temporary storage
contained in the result.
</p>
<p>When passed to the Scheme environment, the C <code>void</code> type is
converted to the void object.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define fopen
(c-lambda (nonnull-char-string nonnull-char-string)
(pointer "FILE")
"fopen"))
(define fgetc
(c-lambda ((pointer "FILE"))
int
"fgetc"))
(let ((f (fopen "datafile" "r")))
(if f (write (fgetc f))))
(define char-code
(c-lambda (char) int "___return(___arg1);"))
(define host
((c-lambda () nonnull-char-string "___return(host);")))
(define stdin
((c-lambda () (pointer "FILE") "___return(stdin);")))
((c-lambda () void
#<<c-lambda-end
printf( "hello\n" );
printf( "world\n" );
c-lambda-end
))
(define pack-1-char
(c-lambda (char)
nonnull-char-string
#<<c-lambda-end
char *s = (char *)malloc (2);
if (s != NULL) { s[0] = ___arg1; s[1] = 0; }
#define ___AT_END if (s != NULL) free (s);
c-lambda-end
))
(define pack-2-chars
(c-lambda (char char)
nonnull-char-string
#<<c-lambda-end
char s[3];
s[0] = ___arg1;
s[1] = ___arg2;
s[2] = 0;
___return(s);
c-lambda-end
))
</pre></td></tr></table>
<hr size="6">
<a name="c_002ddefine"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#c_002dlambda" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#c_002ddefine_002dtype" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-c_002ddefine-special-form"></a>
<h2 class="section">19.5 The <code>c-define</code> special form</h2>
<a name="index-c_002ddefine"></a>
<a name="Definition_of_c-define"></a><a name="Special_form_c-define"></a><a name="index-c_002ddefine-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_c-define">c-define</a></b></code><i> (<span class="roman"><i>variable</i></span> <span class="roman"><i>define-formals</i></span>) (<span class="roman"><i>type1</i></span>…) <span class="roman"><i>result-type</i></span> <span class="roman"><i>c-name</i></span> <span class="roman"><i>scope</i></span> <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
<p>The <code>c-define</code> special form makes it possible to create a C
function that will act as a representative of some Scheme procedure. A
C function named <i>c-name</i> as well as a Scheme procedure bound to the
variable <i>variable</i> are defined. The parameters of the Scheme
procedure are <i>define-formals</i> and its body is at the end of the
form. The type of each argument of the C function, its result type and
<i>c-name</i> (which must be a string) are specified after the parameter
specification of the Scheme procedure. When the C function <i>c-name</i>
is called from C, its arguments are converted to their Scheme
representation and passed to the Scheme procedure. The result of the
Scheme procedure is then converted to its C representation and the C
function <i>c-name</i> returns it to its caller.
</p>
<p>The scope of the C function can be changed with the <i>scope</i>
parameter, which must be a string. This string is placed immediately
before the declaration of the C function. So if <i>scope</i> is the
string <code>"static"</code>, the scope of <i>c-name</i> is local to the module
it is in, whereas if <i>scope</i> is the empty string, <i>c-name</i> is
visible from other modules.
</p>
<p>The <code>c-define</code> special form does not return a value.
It can only appear at top level.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-define (proc x #!optional (y x) #!rest z) (int int char float) int "f" ""
(write (cons x (cons y z)))
(newline)
(+ x y))
(proc 1 2 #\x 1.5) => 3 and prints (1 2 #\x 1.5)
(proc 1) => 2 and prints (1 1)
; if f is called from C with the call f (1, 2, 'x', 1.5)
; the value 3 is returned and (1 2 #\x 1.5) is printed.
; f has to be called with 4 arguments.
</pre></td></tr></table>
<a name="index-_005f_005f_005fsetup"></a>
<a name="index-_005f_005f_005fcleanup"></a>
<p>The <code>c-define</code> special form is particularly useful when the
driving part of an application is written in C and Scheme procedures
are called directly from C. The Scheme part of the application is in
a sense a “server” that is providing services to the C part. The
Scheme procedures that are to be called from C need to be defined
using the <code>c-define</code> special form. Before it can be used, the
Scheme part must be initialized with a call to the function
‘<samp>___setup</samp>’. Before the program terminates, it must call the
function ‘<samp>___cleanup</samp>’ so that the Scheme part may do final
cleanup. A sample application is given in the file
‘<samp>tests/server.scm</samp>’.
</p>
<hr size="6">
<a name="c_002ddefine_002dtype"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#c_002ddefine" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#continuations" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-c_002ddefine_002dtype-special-form"></a>
<h2 class="section">19.6 The <code>c-define-type</code> special form</h2>
<a name="index-c_002ddefine_002dtype"></a>
<a name="Definition_of_c-define-type"></a><a name="Special_form_c-define-type"></a><a name="index-c_002ddefine_002dtype-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_c-define-type">c-define-type</a></b></code><i> <span class="roman"><i>name</i></span> <span class="roman"><i>type</i></span> <span class="roman">[</span><span class="roman"><i>c-to-scheme</i></span> <span class="roman"><i>scheme-to-c</i></span> <span class="roman">[</span><span class="roman"><i>cleanup</i></span><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">special form</td></tr></table>
<p>This form associates the type identifier <i>name</i> to the C type
<i>type</i>. The <i>name</i> must not clash with predefined types
(e.g. <code>char-string</code>, <code>ISO-8859-1</code>, etc.) or with types previously
defined with <code>c-define-type</code> in the same file. The
<code>c-define-type</code> special form does not return a value. It can only
appear at top level.
</p>
<p>If only the two parameters <i>name</i> and <i>type</i> are supplied then
after this definition, the use of <i>name</i> in a type specification is
synonymous to <i>type</i>.
</p>
<p>For example:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-define-type FILE "FILE")
(c-define-type FILE* (pointer FILE))
(c-define-type time-struct-ptr (pointer (struct "tms")))
(define fopen (c-lambda (char-string char-string) FILE* "fopen"))
(define fgetc (c-lambda (FILE*) int "fgetc"))
</pre></td></tr></table>
<p>Note that identifiers are not case-sensitive in standard Scheme but it
is good programming practice to use a <i>name</i> with the same case as
in C.
</p>
<p>If four or more parameters are supplied, then <i>type</i> must be a
string naming the C type, <i>c-to-scheme</i> and <i>scheme-to-c</i> must
be strings suffixing the C macros that convert data of that type between
C and Scheme. If <i>cleanup</i> is supplied it must be a boolean
indicating whether it is necessary to perform a cleanup operation (such
as freeing memory) when data of that type is converted from Scheme to C
(it defaults to <code>#t</code>). The cleanup information is used when the C
stack is unwound due to a continuation invocation (see
<a href="#continuations">Continuations and the C-interface</a>). Although it is safe to always specify <code>#t</code>,
it is more efficient in time and space to specify <code>#f</code> because the
unwinding mechanism can skip C-interface frames which only contain
conversions of data types requiring no cleanup. Two pairs of C macros
need to be defined for conversions performed by <code>c-lambda</code> forms
and two pairs for conversions performed by <code>c-define</code> forms:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>___BEGIN_CFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>, int)
___END_CFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>, int)
___BEGIN_CFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ)
___END_CFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ)
___BEGIN_SFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ, int)
___END_SFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ, int)
___BEGIN_SFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>)
___END_SFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>)
</pre></td></tr></table>
<p>The macros prefixed with <code>___BEGIN</code> perform the conversion and
those prefixed with <code>___END</code> perform any cleanup necessary (such as
freeing memory temporarily allocated for the conversion). The macro
<code>___END_CFUN_<span class="roman"><i>scheme-to-c</i></span></code> must free the result of the
conversion if it is memory allocated, and
<code>___END_SFUN_<span class="roman"><i>scheme-to-c</i></span></code> must not (i.e. it is the
responsibility of the caller to free the result).
</p>
<p>The first parameter of these macros is the C variable that contains the
value to be converted, and the second parameter is the C variable in
which to store the converted value. The third parameter, when present,
is the index (starting at 1) of the parameter of the <code>c-lambda</code> or
<code>c-define</code> form that is being converted (this is useful for
reporting precise error information when a conversion is impossible).
</p>
<p>To allow for type checking, the first three <code>___BEGIN</code> macros must
expand to an unterminated compound statement prefixed by an <code>if</code>,
conditional on the absence of type check error:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>if ((___err = <var>conversion_operation</var>) == ___FIX(___NO_ERR)) {
</pre></td></tr></table>
<p>The last <code>___BEGIN</code> macro must expand to an unterminated compound
statement:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>{ ___err = <var>conversion_operation</var>;
</pre></td></tr></table>
<p>If type check errors are impossible then a <code>___BEGIN</code> macro can
simply expand to an unterminated compound statement performing the
conversion:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>{ <var>conversion_operation</var>;
</pre></td></tr></table>
<p>The <code>___END</code> macros must expand to a statement, or to nothing if no
cleanup is required, followed by a closing brace (to terminate the
compound statement started at the corresponding <code>___BEGIN</code> macro).
</p>
<p>The <var>conversion_operation</var> is typically a function call that returns
an error code value of type <code>___SCMOBJ</code> (the error codes are defined in
‘<samp>gambit.h</samp>’, and the error code <code>___FIX(___UNKNOWN_ERR)</code> is available
for generic errors). <var>conversion_operation</var> can also set the
variable <code>___errmsg</code> of type <code>___SCMOBJ</code> to a specific Scheme
string error message.
</p>
<p>Below is a simple example showing how to interface to an ‘<samp>EBCDIC</samp>’
character type. Memory allocation is not needed for conversion and type
check errors are impossible when converting EBCDIC to Scheme characters,
but they are possible when converting from Scheme characters to EBCDIC
since Gambit supports Unicode characters.
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end
typedef char EBCDIC; /* EBCDIC encoded characters */
void put_char (EBCDIC c) { ... } /* EBCDIC I/O functions */
EBCDIC get_char (void) { ... }
char EBCDIC_to_ISO_8859_1[256] = { ... }; /* conversion tables */
char ISO_8859_1_to_EBCDIC[256] = { ... };
___SCMOBJ SCMOBJ_to_EBCDIC (___SCMOBJ src, EBCDIC *dst)
{
int x = ___INT(src); /* convert from Scheme character to int */
if (x > 255) return ___FIX(___UNKNOWN_ERR);
*dst = ISO_8859_1_to_EBCDIC[x];
return ___FIX(___NO_ERR);
}
#define ___BEGIN_CFUN_SCMOBJ_to_EBCDIC(src,dst,i) \
if ((___err = SCMOBJ_to_EBCDIC (src, &dst)) == ___FIX(___NO_ERR)) {
#define ___END_CFUN_SCMOBJ_to_EBCDIC(src,dst,i) }
#define ___BEGIN_CFUN_EBCDIC_to_SCMOBJ(src,dst) \
{ dst = ___CHR(EBCDIC_to_ISO_8859_1[src]);
#define ___END_CFUN_EBCDIC_to_SCMOBJ(src,dst) }
#define ___BEGIN_SFUN_EBCDIC_to_SCMOBJ(src,dst,i) \
{ dst = ___CHR(EBCDIC_to_ISO_8859_1[src]);
#define ___END_SFUN_EBCDIC_to_SCMOBJ(src,dst,i) }
#define ___BEGIN_SFUN_SCMOBJ_to_EBCDIC(src,dst) \
{ ___err = SCMOBJ_to_EBCDIC (src, &dst);
#define ___END_SFUN_SCMOBJ_to_EBCDIC(src,dst) }
c-declare-end
)
(c-define-type EBCDIC "EBCDIC" "EBCDIC_to_SCMOBJ" "SCMOBJ_to_EBCDIC" #f)
(define put-char (c-lambda (EBCDIC) void "put_char"))
(define get-char (c-lambda () EBCDIC "get_char"))
(c-define (write-EBCDIC c) (EBCDIC) void "write_EBCDIC" ""
(write-char c))
(c-define (read-EBCDIC) () EBCDIC "read_EBCDIC" ""
(read-char))
</pre></td></tr></table>
<p>Below is a more complex example that requires memory allocation when
converting from C to Scheme. It is an interface to a 2D ‘<samp>point</samp>’
type which is represented in Scheme by a pair of integers. The
conversion of the <code>x</code> and <code>y</code> components is done by calls to
the conversion macros for the <code>int</code> type (defined in
‘<samp>gambit.h</samp>’). Note that no cleanup is necessary when converting
from Scheme to C (i.e. the last parameter of the <code>c-define-type</code> is
<code>#f</code>).
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end
typedef struct { int x, y; } point;
void line_to (point p) { ... }
point get_mouse (void) { ... }
point add_points (point p1, point p2) { ... }
___SCMOBJ SCMOBJ_to_POINT (___PSD ___SCMOBJ src, point *dst, int arg_num)
{
___SCMOBJ ___err = ___FIX(___NO_ERR);
if (!___PAIRP(src))
___err = ___FIX(___UNKNOWN_ERR);
else
{
___SCMOBJ car = ___CAR(src);
___SCMOBJ cdr = ___CDR(src);
___BEGIN_CFUN_SCMOBJ_TO_INT(car,dst->x,arg_num)
___BEGIN_CFUN_SCMOBJ_TO_INT(cdr,dst->y,arg_num)
___END_CFUN_SCMOBJ_TO_INT(cdr,dst->y,arg_num)
___END_CFUN_SCMOBJ_TO_INT(car,dst->x,arg_num)
}
return ___err;
}
___SCMOBJ POINT_to_SCMOBJ (___processor_state ___ps, point src, ___SCMOBJ *dst, int arg_num)
{
___SCMOBJ ___err = ___FIX(___NO_ERR);
___SCMOBJ x_scmobj;
___SCMOBJ y_scmobj;
___BEGIN_SFUN_INT_TO_SCMOBJ(src.x,x_scmobj,arg_num)
___BEGIN_SFUN_INT_TO_SCMOBJ(src.y,y_scmobj,arg_num)
*dst = ___EXT(___make_pair) (___ps, x_scmobj, y_scmobj);
if (___FIXNUMP(*dst))
___err = *dst; /* return allocation error */
___END_SFUN_INT_TO_SCMOBJ(src.y,y_scmobj,arg_num)
___END_SFUN_INT_TO_SCMOBJ(src.x,x_scmobj,arg_num)
return ___err;
}
#define ___BEGIN_CFUN_SCMOBJ_to_POINT(src,dst,i) \
if ((___err = SCMOBJ_to_POINT (___PSP src, &dst, i)) == ___FIX(___NO_ERR)) {
#define ___END_CFUN_SCMOBJ_to_POINT(src,dst,i) }
#define ___BEGIN_CFUN_POINT_to_SCMOBJ(src,dst) \
if ((___err = POINT_to_SCMOBJ (___ps, src, &dst, ___RETURN_POS)) == ___FIX(___NO_ERR)) {
#define ___END_CFUN_POINT_to_SCMOBJ(src,dst) \
___EXT(___release_scmobj) (dst); }
#define ___BEGIN_SFUN_POINT_to_SCMOBJ(src,dst,i) \
if ((___err = POINT_to_SCMOBJ (___ps, src, &dst, i)) == ___FIX(___NO_ERR)) {
#define ___END_SFUN_POINT_to_SCMOBJ(src,dst,i) \
___EXT(___release_scmobj) (dst); }
#define ___BEGIN_SFUN_SCMOBJ_to_POINT(src,dst) \
{ ___err = SCMOBJ_to_POINT (___PSP src, &dst, ___RETURN_POS);
#define ___END_SFUN_SCMOBJ_to_POINT(src,dst) }
c-declare-end
)
(c-define-type point "point" "POINT_to_SCMOBJ" "SCMOBJ_to_POINT" #f)
(define line-to (c-lambda (point) void "line_to"))
(define get-mouse (c-lambda () point "get_mouse"))
(define add-points (c-lambda (point point) point "add_points"))
(c-define (write-point p) (point) void "write_point" ""
(write p))
(c-define (read-point) () point "read_point" ""
(read))
</pre></td></tr></table>
<p>Note that the pair is allocated using the <code>___make_pair</code> runtime
library function. The prototype of this function is
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>___SCMOBJ ___make_pair(___processor_state ___ps, ___SCMOBJ car, ___SCMOBJ cdr);
</pre></td></tr></table>
<p>The fields of the pair are initialized to the <code>car</code> and
<code>cdr</code> parameters. The <code>___ps</code> parameter indicates how the
pair is allocated. A <code>NULL</code> <code>___ps</code> parameter will allocate
the pair permanently (i.e. the pair will only be deallocated when
<code>___cleanup</code> is called). Otherwise a “still” object is
allocated and the <code>___ps</code> parameter indicates the processor in
whose heap the object is allocated (this is to support multithreaded
execution). Still objects are reference counted and initially have a
reference count equal to 1. The call to <code>___release_scmobj</code> in
the macros <code>___END_CFUN_POINT_to_SCMOBJ</code> and
<code>___END_SFUN_POINT_to_SCMOBJ</code> decrement this reference count. A
still object whose reference count is zero will be deallocated when a
garbage collection is performed and there are no references to it from
the Scheme world. Note that the use of the <code>___PSD</code> macro
in the parameter list of <code>SCMOBJ_to_POINT</code> and the <code>___PSP</code> macro
in the calls of <code>SCMOBJ_to_POINT</code>, are necessary to propagate the
current processor state to that function.
</p>
<p>An example that requires memory allocation when converting from C to
Scheme and Scheme to C is shown below. It is an interface to a
“null-terminated array of strings” type which is represented in Scheme
by a list of strings. Note that some cleanup is necessary when
converting from Scheme to C.
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end
#include <stdlib.h>
#include <unistd.h>
extern char **environ;
char **get_environ (void) { return environ; }
void free_strings (char **strings)
{
char **ptr = strings;
while (*ptr != NULL)
{
___EXT(___release_string) (*ptr);
ptr++;
}
free (strings);
}
___SCMOBJ SCMOBJ_to_STRINGS (___PSD ___SCMOBJ src, char ***dst, int arg_num)
{
/*
* Src is a list of Scheme strings. Dst will be a null terminated
* array of C strings.
*/
int i;
___SCMOBJ lst = src;
int len = 4; /* start with a small result array */
char **result = (char**) malloc (len * sizeof (char*));
if (result == NULL)
return ___FIX(___HEAP_OVERFLOW_ERR);
i = 0;
result[i] = NULL; /* always keep array null terminated */
while (___PAIRP(lst))
{
___SCMOBJ scm_str = ___CAR(lst);
char *c_str;
___SCMOBJ ___err;
if (i >= len-1) /* need to grow the result array? */
{
char **new_result;
int j;
len = len * 3 / 2;
new_result = (char**) malloc (len * sizeof (char*));
if (new_result == NULL)
{
free_strings (result);
return ___FIX(___HEAP_OVERFLOW_ERR);
}
for (j=i; j>=0; j--)
new_result[j] = result[j];
free (result);
result = new_result;
}
___err = ___EXT(___SCMOBJ_to_CHARSTRING) (___PSP scm_str, &c_str, arg_num);
if (___err != ___FIX(___NO_ERR))
{
free_strings (result);
return ___err;
}
result[i++] = c_str;
result[i] = NULL;
lst = ___CDR(lst);
}
if (!___NULLP(lst))
{
free_strings (result);
return ___FIX(___UNKNOWN_ERR);
}
/*
* Note that the caller is responsible for calling free_strings
* when it is done with the result.
*/
*dst = result;
return ___FIX(___NO_ERR);
}
___SCMOBJ STRINGS_to_SCMOBJ (___processor_state ___ps, char **src, ___SCMOBJ *dst, int arg_num)
{
___SCMOBJ ___err = ___FIX(___NO_ERR);
___SCMOBJ result = ___NUL; /* start with the empty list */
int i = 0;
while (src[i] != NULL)
i++;
/* build the list of strings starting at the tail */
while (--i >= 0)
{
___SCMOBJ scm_str;
___SCMOBJ new_result;
/*
* Invariant: result is either the empty list or a ___STILL pair
* with reference count equal to 1. This is important because
* it is possible that ___CHARSTRING_to_SCMOBJ and ___make_pair
* will invoke the garbage collector and we don't want the
* reference in result to become invalid (which would be the
* case if result was a ___MOVABLE pair or if it had a zero
* reference count).
*/
___err = ___EXT(___CHARSTRING_to_SCMOBJ) (___ps, src[i], &scm_str, arg_num);
if (___err != ___FIX(___NO_ERR))
{
___EXT(___release_scmobj) (result); /* allow GC to reclaim result */
return ___FIX(___UNKNOWN_ERR);
}
/*
* Note that scm_str will be a ___STILL object with reference
* count equal to 1, so there is no risk that it will be
* reclaimed or moved if ___make_pair invokes the garbage
* collector.
*/
new_result = ___EXT(___make_pair) (___ps, scm_str, result);
/*
* We can zero the reference count of scm_str and result (if
* not the empty list) because the pair now references these
* objects and the pair is reachable (it can't be reclaimed
* or moved by the garbage collector).
*/
___EXT(___release_scmobj) (scm_str);
___EXT(___release_scmobj) (result);
result = new_result;
if (___FIXNUMP(result))
return result; /* allocation failed */
}
/*
* Note that result is either the empty list or a ___STILL pair
* with a reference count equal to 1. There will be a call to
* ___release_scmobj later on (in ___END_CFUN_STRINGS_to_SCMOBJ
* or ___END_SFUN_STRINGS_to_SCMOBJ) that will allow the garbage
* collector to reclaim the whole list of strings when the Scheme
* world no longer references it.
*/
*dst = result;
return ___FIX(___NO_ERR);
}
#define ___BEGIN_CFUN_SCMOBJ_to_STRINGS(src,dst,i) \
if ((___err = SCMOBJ_to_STRINGS (___PSP src, &dst, i)) == ___FIX(___NO_ERR)) {
#define ___END_CFUN_SCMOBJ_to_STRINGS(src,dst,i) \
free_strings (dst); }
#define ___BEGIN_CFUN_STRINGS_to_SCMOBJ(src,dst) \
if ((___err = STRINGS_to_SCMOBJ (___ps, src, &dst, ___RETURN_POS)) == ___FIX(___NO_ERR)) {
#define ___END_CFUN_STRINGS_to_SCMOBJ(src,dst) \
___EXT(___release_scmobj) (dst); }
#define ___BEGIN_SFUN_STRINGS_to_SCMOBJ(src,dst,i) \
if ((___err = STRINGS_to_SCMOBJ (___ps, src, &dst, i)) == ___FIX(___NO_ERR)) {
#define ___END_SFUN_STRINGS_to_SCMOBJ(src,dst,i) \
___EXT(___release_scmobj) (dst); }
#define ___BEGIN_SFUN_SCMOBJ_to_STRINGS(src,dst) \
{ ___err = SCMOBJ_to_STRINGS (___PSP src, &dst, ___RETURN_POS);
#define ___END_SFUN_SCMOBJ_to_STRINGS(src,dst) }
c-declare-end
)
(c-define-type char** "char**" "STRINGS_to_SCMOBJ" "SCMOBJ_to_STRINGS" #t)
(define execv (c-lambda (char-string char**) int "execv"))
(define get-environ (c-lambda () char** "get_environ"))
(c-define (write-strings x) (char**) void "write_strings" ""
(write x))
(c-define (read-strings) () char** "read_strings" ""
(read))
</pre></td></tr></table>
<hr size="6">
<a name="continuations"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#c_002ddefine_002dtype" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Continuations-and-the-C_002dinterface"></a>
<h2 class="section">19.7 Continuations and the C-interface</h2>
<a name="index-continuations"></a>
<p>The C-interface allows C to Scheme calls to be nested. This means
that during a call from C to Scheme another call from C to Scheme
can be performed. This case occurs in the following program:
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end
int p (char *); /* forward declarations */
int q (void);
int a (char *x) { return 2 * p (x+1); }
int b (short y) { return y + q (); }
c-declare-end
)
(define a (c-lambda (char-string) int "a"))
(define b (c-lambda (short) int "b"))
(c-define (p z) (char-string) int "p" ""
(+ (b 10) (string-length z)))
(c-define (q) () int "q" ""
123)
(write (a "hello"))
</pre></td></tr></table>
<p>In this example, the main Scheme program calls the C function ‘<samp>a</samp>’
which calls the Scheme procedure ‘<samp>p</samp>’ which in turn calls the C
function ‘<samp>b</samp>’ which finally calls the Scheme procedure ‘<samp>q</samp>’.
</p>
<p>Gambit maintains the Scheme continuation separately from the C stack,
thus allowing the Scheme continuation to be unwound independently from
the C stack. The C stack frame created for the C function ‘<samp>f</samp>’ is
only removed from the C stack when control returns from ‘<samp>f</samp>’ or when
control returns to a C function “above” ‘<samp>f</samp>’. Special care is
required for programs which escape to Scheme (using first-class
continuations) from a Scheme to C (to Scheme) call because the C stack
frame will remain on the stack. The C stack may overflow if this
happens in a loop with no intervening return to a C function. To avoid
this problem make sure the C stack gets cleaned up by executing a normal
return from a Scheme to C call.
</p>
<hr size="6">
<a name="System-limitations"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#continuations" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Copyright-and-license" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Copyright-and-license" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="System-limitations-1"></a>
<h1 class="chapter">20. System limitations</h1>
<a name="index-limitations"></a>
<ul>
<li>
<a name="index-floating-point-overflow"></a>
<a name="index-overflow_002c-floating-point"></a>
On some systems floating point overflows will cause the program to
terminate with a floating point exception.
</li><li>
On some systems floating point operations involving ‘<samp>+nan.0</samp>’
‘<samp>+inf.0</samp>’, ‘<samp>-inf.0</samp>’, or ‘<samp>-0.</samp>’ do not return the
value required by the IEEE 754 floating point standard.
</li><li>
<a name="index-define-1"></a>
<a name="index-set_0021"></a>
The compiler will not properly compile files with more than one
definition (with <code>define</code>) of the same procedure. Replace all
but the first <code>define</code> with assignments (<code>set!</code>).
</li><li>
The maximum number of arguments that can be passed to a procedure by
the <code>apply</code> procedure is 8192.
</li></ul>
<hr size="6">
<a name="Copyright-and-license"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#System-limitations" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#System-limitations" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Copyright-and-license-1"></a>
<h1 class="chapter">21. Copyright and license</h1>
<p>The Gambit system release v4.9.3 is Copyright ©
1994-2016 by Marc Feeley, all rights reserved. The Gambit system
release v4.9.3 is licensed under two licenses: the Apache
License, Version 2.0, and the GNU LESSER GENERAL PUBLIC LICENSE,
Version 2.1. You have the option to choose which of these two
licenses to abide by. The licenses are copied below.
</p>
<table><tr><td> </td><td><pre class="smallexample"><b></b>
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b> GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b> Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b> GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b> 2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b> Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b> 6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b> 11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b> 14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
</pre></td></tr></table>
<table><tr><td> </td><td><pre class="smallexample"><b></b> How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
</pre></td></tr></table>
<hr size="6">
<a name="General-index"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Copyright-and-license" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[ > ]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Copyright-and-license" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[ >> ]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="General-index-1"></a>
<h1 class="unnumbered">General index</h1>
<table><tr><th valign="top">Jump to: </th><td><a href="#General-index-1_cp_symbol-1" class="summary-letter"><b>#</b></a>
<a href="#General-index-1_cp_symbol-2" class="summary-letter"><b>+</b></a>
<a href="#General-index-1_cp_symbol-3" class="summary-letter"><b>,</b></a>
<a href="#General-index-1_cp_symbol-4" class="summary-letter"><b>-</b></a>
<a href="#General-index-1_cp_symbol-5" class="summary-letter"><b>.</b></a>
<a href="#General-index-1_cp_symbol-6" class="summary-letter"><b><</b></a>
<a href="#General-index-1_cp_symbol-7" class="summary-letter"><b>=</b></a>
<a href="#General-index-1_cp_symbol-8" class="summary-letter"><b>></b></a>
<a href="#General-index-1_cp_symbol-9" class="summary-letter"><b>^</b></a>
<a href="#General-index-1_cp_symbol-10" class="summary-letter"><b>_</b></a>
<a href="#General-index-1_cp_symbol-11" class="summary-letter"><b>|</b></a>
<a href="#General-index-1_cp_symbol-12" class="summary-letter"><b>~</b></a>
<br>
<a href="#General-index-1_cp_letter-A" class="summary-letter"><b>A</b></a>
<a href="#General-index-1_cp_letter-B" class="summary-letter"><b>B</b></a>
<a href="#General-index-1_cp_letter-C" class="summary-letter"><b>C</b></a>
<a href="#General-index-1_cp_letter-D" class="summary-letter"><b>D</b></a>
<a href="#General-index-1_cp_letter-E" class="summary-letter"><b>E</b></a>
<a href="#General-index-1_cp_letter-F" class="summary-letter"><b>F</b></a>
<a href="#General-index-1_cp_letter-G" class="summary-letter"><b>G</b></a>
<a href="#General-index-1_cp_letter-H" class="summary-letter"><b>H</b></a>
<a href="#General-index-1_cp_letter-I" class="summary-letter"><b>I</b></a>
<a href="#General-index-1_cp_letter-J" class="summary-letter"><b>J</b></a>
<a href="#General-index-1_cp_letter-K" class="summary-letter"><b>K</b></a>
<a href="#General-index-1_cp_letter-L" class="summary-letter"><b>L</b></a>
<a href="#General-index-1_cp_letter-M" class="summary-letter"><b>M</b></a>
<a href="#General-index-1_cp_letter-N" class="summary-letter"><b>N</b></a>
<a href="#General-index-1_cp_letter-O" class="summary-letter"><b>O</b></a>
<a href="#General-index-1_cp_letter-P" class="summary-letter"><b>P</b></a>
<a href="#General-index-1_cp_letter-R" class="summary-letter"><b>R</b></a>
<a href="#General-index-1_cp_letter-S" class="summary-letter"><b>S</b></a>
<a href="#General-index-1_cp_letter-T" class="summary-letter"><b>T</b></a>
<a href="#General-index-1_cp_letter-U" class="summary-letter"><b>U</b></a>
<a href="#General-index-1_cp_letter-V" class="summary-letter"><b>V</b></a>
<a href="#General-index-1_cp_letter-W" class="summary-letter"><b>W</b></a>
<a href="#General-index-1_cp_letter-X" class="summary-letter"><b>X</b></a>
</td></tr></table>
<table border="0" class="index-cp">
<tr><td></td><th align="left">Index Entry</th><th align="left"> Section</th></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-1">#</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0023">#</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0023_0023">##</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-2">+</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002bz"><code>+z</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-3">,</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_0028b-expr_0029"><code>,(b <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_0028be-expr_0029"><code>,(be <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_0028bed-expr_0029"><code>,(bed <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_0028c-expr_0029"><code>,(c <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_0028e-expr_0029"><code>,(e <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_0028ed-expr_0029"><code>,(ed <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_0028h-subject_0029"><code>,(h <var>subject</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_0028st-expr_0029"><code>,(st <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_0028v-expr_0029"><code>,(v <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_002b"><code>,+</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_002b_002b"><code>,++</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_002d"><code>,-</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_002d_002d"><code>,--</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002c_003f"><code>,?</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cb"><code>,b</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cbe"><code>,be</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cbed"><code>,bed</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cc"><code>,c</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cd"><code>,d</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ce"><code>,e</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ced"><code>,ed</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ch"><code>,h</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ci"><code>,i</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cl"><code>,l</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cN"><code>,<var>N</var></code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cN_002b"><code>,<var>N</var>+</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cN_002d"><code>,<var>N</var>-</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cq"><code>,q</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cqt"><code>,qt</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cs"><code>,s</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cst"><code>,st</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ct"><code>,t</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002cy"><code>,y</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-4">-</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d"><code>-</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003a_002b"><code>-:+</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003a_002d"><code>-:-</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003a_003a"><code>-::</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003a_003d"><code>-:=</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003a_0040"><code>-:}</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003ad"><code>-:d</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003ad_002d"><code>-:d-</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003ad_0040_005bHOST_005d_005b_003aPORT_005d"><code>-:d@<span class="roman">[</span><var>HOST</var><span class="roman">]</span><span class="roman">[</span>:<var>PORT</var><span class="roman">]</span></code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003ada"><code>-:da</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003adc"><code>-:dc</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003adD"><code>-:dD</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003adi"><code>-:di</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003adLEVEL"><code>-:d<var>LEVEL</var></code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003adp"><code>-:dp</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003adq"><code>-:dq</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003adQ"><code>-:dQ</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003adr"><code>-:dr</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003adR"><code>-:dR</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003ads"><code>-:ds</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003af"><code>-:f</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003ah"><code>-:h</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003al"><code>-:l</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003am"><code>-:m</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003as"><code>-:s</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003aS"><code>-:S</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003as-1"><code>-:s</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003at"><code>-:t</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_003a_007e_007e"><code>-:~~</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dc"><code>-c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dcall_005fshared"><code>-call_shared</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dcc_002doptions"><code>-cc-options</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dcfg"><code>-cfg</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddebug"><code>-debug</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddebug-1"><code>-debug</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002denvironments"><code>-debug-environments</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002denvironments-1"><code>-debug-environments</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002dlocation"><code>-debug-location</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002dlocation-1"><code>-debug-location</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002dsource"><code>-debug-source</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002dsource-1"><code>-debug-source</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddg"><code>-dg</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ddynamic"><code>-dynamic</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fDYNAMIC"><code>-D___DYNAMIC</code></a></td><td valign="top"><a href="#Building-a-loadable-library">3.4.2 Building a loadable library</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fLIBRARY"><code>-D___LIBRARY</code></a></td><td valign="top"><a href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fPRIMAL"><code>-D___PRIMAL</code></a></td><td valign="top"><a href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fSHARED"><code>-D___SHARED</code></a></td><td valign="top"><a href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fSINGLE_005fHOST"><code>-D___SINGLE_HOST</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002de"><code>-e</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dexe"><code>-exe</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dexe-1"><code>-exe</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dexpansion"><code>-expansion</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dflat"><code>-flat</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dfPIC"><code>-fPIC</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dfpic"><code>-fpic</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dG"><code>-G</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dgvm"><code>-gvm</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002di"><code>-i</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dI_002fusr_002flocal_002fGambit_002finclude"><code>-I/usr/local/Gambit/include</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dkeep_002dc"><code>-keep-c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dKPIC"><code>-KPIC</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dKpic"><code>-Kpic</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dl-base"><code>-l <var>base</var></code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dL_002fusr_002flocal_002fGambit_002flib"><code>-L/usr/local/Gambit/lib</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dld_002doptions"><code>-ld-options</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dld_002doptions_002dprelude"><code>-ld-options-prelude</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dlink"><code>-link</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dlink-1"><code>-link</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dO"><code>-O</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002do-output"><code>-o <var>output</var></code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dobj"><code>-obj</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dpic"><code>-pic</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dpostlude"><code>-postlude</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dprelude"><code>-prelude</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002drdynamic"><code>-rdynamic</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dreport"><code>-report</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dshared"><code>-shared</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dtrack_002dscheme"><code>-track-scheme</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dverbose"><code>-verbose</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dwarnings"><code>-warnings</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-5">.</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ec"><code>.c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002escm"><code>.scm</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002esix"><code>.six</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-6"><</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_003c"><code><</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_003c_003d"><code><=</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-7">=</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_003d"><code>=</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-8">></a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_003e"><code>></code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_003e_003d"><code>>=</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-9">^</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_005eC"><code>^C</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_005eC-1"><code>^C</code></a></td><td valign="top"><a href="#Debugging-model">5.1 Debugging model</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_005eD"><code>^D</code></a></td><td valign="top"><a href="#Debugging-model">5.1 Debugging model</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-10">_</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_005f_005f_005fcleanup"><code>___cleanup</code></a></td><td valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_005f_005f_005fsetup"><code>___setup</code></a></td><td valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-11">|</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_007csix_002ex"><code>|six.x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_007csix_002ex_005c_007c_003dy_007c"><code>|six.x\|=y|</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_007csix_002ex_005c_007cy_007c"><code>|six.x\|y|</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_007csix_002ex_005c_007c_005c_007cy_007c"><code>|six.x\|\|y|</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_symbol-12">~</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_007e">~</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_007eusername">~username</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_007e_007e">~~</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-abandoned_002dmutex_002dexception_003f"><code>abandoned-mutex-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-abort"><code>abort</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-absolute-path">absolute path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-absolute-path-1">absolute path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_002dfamily"><code>address-info-family</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_002dprotocol"><code>address-info-protocol</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_002dsocket_002dinfo"><code>address-info-socket-info</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_002dsocket_002dtype"><code>address-info-socket-type</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_003f"><code>address-info?</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-address_002dinfos"><code>address-infos</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-all_002dbits_002dset_003f"><code>all-bits-set?</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-any_002dbits_002dset_003f"><code>any-bits-set?</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002df32vectors"><code>append-f32vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002df64vectors"><code>append-f64vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002ds16vectors"><code>append-s16vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002ds32vectors"><code>append-s32vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002ds64vectors"><code>append-s64vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002ds8vectors"><code>append-s8vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002dstrings"><code>append-strings</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002du16vectors"><code>append-u16vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002du32vectors"><code>append-u32vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002du64vectors"><code>append-u64vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002du8vectors"><code>append-u8vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-append_002dvectors"><code>append-vectors</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-arithmetic_002dshift"><code>arithmetic-shift</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-bit_002dcount"><code>bit-count</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bit_002dset_003f"><code>bit-set?</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bitwise_002dand"><code>bitwise-and</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bitwise_002dior"><code>bitwise-ior</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bitwise_002dmerge"><code>bitwise-merge</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bitwise_002dnot"><code>bitwise-not</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bitwise_002dxor"><code>bitwise-xor</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-block"><code>block</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-box"><code>box</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-box_003f"><code>box?</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boxes">boxes</a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-break"><code>break</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002ddeclare"><code>c-declare</code></a></td><td valign="top"><a href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002ddeclare-1"><code>c-declare</code></a></td><td valign="top"><a href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002ddefine"><code>c-define</code></a></td><td valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002ddefine-1"><code>c-define</code></a></td><td valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002ddefine_002dtype"><code>c-define-type</code></a></td><td valign="top"><a href="#c_002ddefine_002dtype">19.6 The <code>c-define-type</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002ddefine_002dtype-1"><code>c-define-type</code></a></td><td valign="top"><a href="#c_002ddefine_002dtype">19.6 The <code>c-define-type</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002dinitialize"><code>c-initialize</code></a></td><td valign="top"><a href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002dinitialize-1"><code>c-initialize</code></a></td><td valign="top"><a href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002dlambda"><code>c-lambda</code></a></td><td valign="top"><a href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-c_002dlambda-1"><code>c-lambda</code></a></td><td valign="top"><a href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dcurrent_002dcontinuation"><code>call-with-current-continuation</code></a></td><td valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002dfile"><code>call-with-input-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002dprocess"><code>call-with-input-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002dstring"><code>call-with-input-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002du8vector"><code>call-with-input-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002dvector"><code>call-with-input-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002dfile"><code>call-with-output-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002dprocess"><code>call-with-output-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002dstring"><code>call-with-output-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002du8vector"><code>call-with-output-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002dvector"><code>call-with-output-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-call_002fcc"><code>call/cc</code></a></td><td valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-case_002dlambda"><code>case-lambda</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-central-installation-directory">central installation directory</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_002darguments"><code>cfun-conversion-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_002dcode"><code>cfun-conversion-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_002dmessage"><code>cfun-conversion-exception-message</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_002dprocedure"><code>cfun-conversion-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_003f"><code>cfun-conversion-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_002d_003einteger"><code>char->integer</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_002dci_003c_003d_003f"><code>char-ci<=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_002dci_003c_003f"><code>char-ci<?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_002dci_003d_003f"><code>char-ci=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_002dci_003e_003d_003f"><code>char-ci>=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_002dci_003e_003f"><code>char-ci>?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_003c_003d_003f"><code>char<=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_003c_003f"><code>char<?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_003d_003f"><code>char=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_003e_003d_003f"><code>char>=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_003e_003f"><code>char>?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-circular_002dlist"><code>circular-list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-clear_002dbit_002dfield"><code>clear-bit-field</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-close_002dinput_002dport"><code>close-input-port</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-close_002doutput_002dport"><code>close-output-port</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-close_002dport"><code>close-port</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-command_002dline"><code>command-line</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-command_002dline-1"><code>command-line</code></a></td><td valign="top"><a href="#Command-line-arguments">16.5 Command line arguments</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compile_002dfile"><code>compile-file</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compile_002dfile_002dto_002dtarget"><code>compile-file-to-target</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compiler">compiler</a></td><td valign="top"><a href="#GSC">3. The Gambit Scheme compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compiler-options">compiler options</a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cond_002dexpand"><code>cond-expand</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dbroadcast_0021"><code>condition-variable-broadcast!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dname"><code>condition-variable-name</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dsignal_0021"><code>condition-variable-signal!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dspecific"><code>condition-variable-specific</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dspecific_002dset_0021"><code>condition-variable-specific-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_003f"><code>condition-variable?</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-configure_002dcommand_002dstring"><code>configure-command-string</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cons_002a"><code>cons*</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-console_002dport"><code>console-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-constant_002dfold"><code>constant-fold</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-continuation_002dcapture"><code>continuation-capture</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-continuation_002dgraft"><code>continuation-graft</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-continuation_002dreturn"><code>continuation-return</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-continuation_003f"><code>continuation?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-continuations">continuations</a></td><td valign="top"><a href="#continuations">19.7 Continuations and the C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-copy_002dbit_002dfield"><code>copy-bit-field</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-copy_002dfile"><code>copy-file</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cpu_002dtime"><code>cpu-time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-create_002ddirectory"><code>create-directory</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-create_002dfifo"><code>create-fifo</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-create_002dlink"><code>create-link</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-create_002dsymbolic_002dlink"><code>create-symbolic-link</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current-exception_002dhandler">current exception-handler</a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current-working-directory">current working directory</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current-working-directory-1">current working directory</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002ddirectory"><code>current-directory</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002derror_002dport"><code>current-error-port</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002dexception_002dhandler"><code>current-exception-handler</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002dinput_002dport"><code>current-input-port</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002djiffy"><code>current-jiffy</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002doutput_002dport"><code>current-output-port</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002dprocessor"><code>current-processor</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002dreadtable"><code>current-readtable</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002dsecond"><code>current-second</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002dthread"><code>current-thread</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002dtime"><code>current-time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-current_002duser_002dinterrupt_002dhandler"><code>current-user-interrupt-handler</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-datum_002dparsing_002dexception_002dkind"><code>datum-parsing-exception-kind</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-datum_002dparsing_002dexception_002dparameters"><code>datum-parsing-exception-parameters</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-datum_002dparsing_002dexception_002dreadenv"><code>datum-parsing-exception-readenv</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-datum_002dparsing_002dexception_003f"><code>datum-parsing-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deadlock_002dexception_003f"><code>deadlock-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug"><code>debug</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug-1"><code>debug</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug_002denvironments"><code>debug-environments</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug_002denvironments-1"><code>debug-environments</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug_002dlocation"><code>debug-location</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug_002dlocation-1"><code>debug-location</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug_002dsource"><code>debug-source</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug_002dsource-1"><code>debug-source</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-declare"><code>declare</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-default_002drandom_002dsource"><code>default-random-source</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defer_002duser_002dinterrupts"><code>defer-user-interrupts</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define"><code>define</code></a></td><td valign="top"><a href="#Extensions-to-standard-special-forms">6.2 Extensions to standard special forms</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define-1"><code>define</code></a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dcond_002dexpand_002dfeature"><code>define-cond-expand-feature</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dmacro"><code>define-macro</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002drecord_002dtype"><code>define-record-type</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dstructure"><code>define-structure</code></a></td><td valign="top"><a href="#Records">12. Records</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dsyntax"><code>define-syntax</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dsyntax-1"><code>define-syntax</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dtype"><code>define-type</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dtype_002dof_002dthread"><code>define-type-of-thread</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-delete_002ddirectory"><code>delete-directory</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-delete_002dfile"><code>delete-file</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deserialization">deserialization</a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deserialization-1">deserialization</a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-directory_002dfiles"><code>directory-files</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display_002dcontinuation_002dbacktrace"><code>display-continuation-backtrace</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display_002dcontinuation_002ddynamic_002denvironment"><code>display-continuation-dynamic-environment</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display_002dcontinuation_002denvironment"><code>display-continuation-environment</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display_002ddynamic_002denvironment_003f"><code>display-dynamic-environment?</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display_002denvironment_002dset_0021"><code>display-environment-set!</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display_002dexception"><code>display-exception</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display_002dexception_002din_002dcontext"><code>display-exception-in-context</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-display_002dprocedure_002denvironment"><code>display-procedure-environment</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-divide_002dby_002dzero_002dexception_002darguments"><code>divide-by-zero-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-divide_002dby_002dzero_002dexception_002dprocedure"><code>divide-by-zero-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-divide_002dby_002dzero_002dexception_003f"><code>divide-by-zero-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-drop"><code>drop</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Emacs">Emacs</a></td><td valign="top"><a href="#Emacs-interface">5.6 Emacs interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-eq_003f_002dhash"><code>eq?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-equal_003f_002dhash"><code>equal?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-eqv_003f_002dhash"><code>eqv?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-err_002dcode_002d_003estring"><code>err-code->string</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error"><code>error</code></a></td><td valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error_002dexception_002dmessage"><code>error-exception-message</code></a></td><td valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error_002dexception_002dparameters"><code>error-exception-parameters</code></a></td><td valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error_002dexception_003f"><code>error-exception?</code></a></td><td valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-eval"><code>eval</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exit"><code>exit</code></a></td><td valign="top"><a href="#Process-termination">16.4 Process termination</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expression_002dparsing_002dexception_002dkind"><code>expression-parsing-exception-kind</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expression_002dparsing_002dexception_002dparameters"><code>expression-parsing-exception-parameters</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expression_002dparsing_002dexception_002dsource"><code>expression-parsing-exception-source</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expression_002dparsing_002dexception_003f"><code>expression-parsing-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-extended_002dbindings"><code>extended-bindings</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-extract_002dbit_002dfield"><code>extract-bit-field</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector"><code>f32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_002d_003elist"><code>f32vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_002dappend"><code>f32vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_002dcopy"><code>f32vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_002dfill_0021"><code>f32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_002dlength"><code>f32vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_002dref"><code>f32vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_002dset"><code>f32vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_002dset_0021"><code>f32vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_002dshrink_0021"><code>f32vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f32vector_003f"><code>f32vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector"><code>f64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_002d_003elist"><code>f64vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_002dappend"><code>f64vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_002dcopy"><code>f64vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_002dfill_0021"><code>f64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_002dlength"><code>f64vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_002dref"><code>f64vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_002dset"><code>f64vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_002dset_0021"><code>f64vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_002dshrink_0021"><code>f64vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-f64vector_003f"><code>f64vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-FFI">FFI</a></td><td valign="top"><a href="#C_002dinterface">19. C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file-names">file names</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dattributes"><code>file-attributes</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dcreation_002dtime"><code>file-creation-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002ddevice"><code>file-device</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dexists_003f"><code>file-exists?</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dgroup"><code>file-group</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo"><code>file-info</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dattributes"><code>file-info-attributes</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dcreation_002dtime"><code>file-info-creation-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002ddevice"><code>file-info-device</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dgroup"><code>file-info-group</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dinode"><code>file-info-inode</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dlast_002daccess_002dtime"><code>file-info-last-access-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dlast_002dchange_002dtime"><code>file-info-last-change-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dlast_002dmodification_002dtime"><code>file-info-last-modification-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dmode"><code>file-info-mode</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dnumber_002dof_002dlinks"><code>file-info-number-of-links</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002downer"><code>file-info-owner</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dsize"><code>file-info-size</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dtype"><code>file-info-type</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_003f"><code>file-info?</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dinode"><code>file-inode</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dlast_002daccess_002dand_002dmodification_002dtimes_002dset_0021"><code>file-last-access-and-modification-times-set!</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dlast_002daccess_002dtime"><code>file-last-access-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dlast_002dchange_002dtime"><code>file-last-change-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dlast_002dmodification_002dtime"><code>file-last-modification-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dmode"><code>file-mode</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dnumber_002dof_002dlinks"><code>file-number-of-links</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002downer"><code>file-owner</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dsize"><code>file-size</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dtype"><code>file-type</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002ec"><code><var>file</var>.c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002escm"><code><var>file</var>.scm</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002esix"><code><var>file</var>.six</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-finite_003f"><code>finite?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-first_002dbit_002dset"><code>first-bit-set</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fixnum"><code>fixnum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fixnum_002d_003eflonum"><code>fixnum->flonum</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fixnum_002doverflow_002dexception_002darguments"><code>fixnum-overflow-exception-arguments</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fixnum_002doverflow_002dexception_002dprocedure"><code>fixnum-overflow-exception-procedure</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fixnum_002doverflow_002dexception_003f"><code>fixnum-overflow-exception?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fixnum_003f"><code>fixnum?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fl_002a"><code>fl*</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fl_002b"><code>fl+</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fl_002d"><code>fl-</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fl_002f"><code>fl/</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fl_003c"><code>fl<</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fl_003c_003d"><code>fl<=</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fl_003d"><code>fl=</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fl_003e"><code>fl></code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fl_003e_003d"><code>fl>=</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flabs"><code>flabs</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flacos"><code>flacos</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flasin"><code>flasin</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flatan"><code>flatan</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flatan-1"><code>flatan</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flceiling"><code>flceiling</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flcos"><code>flcos</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fldenominator"><code>fldenominator</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fleven_003f"><code>fleven?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flexp"><code>flexp</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flexpt"><code>flexpt</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flfinite_003f"><code>flfinite?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flfloor"><code>flfloor</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flinfinite_003f"><code>flinfinite?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flinteger_003f"><code>flinteger?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fllog"><code>fllog</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flmax"><code>flmax</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flmin"><code>flmin</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flnan_003f"><code>flnan?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flnegative_003f"><code>flnegative?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flnumerator"><code>flnumerator</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-floating-point-overflow">floating point overflow</a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flodd_003f"><code>flodd?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flonum"><code>flonum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flonum_003f"><code>flonum?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flpositive_003f"><code>flpositive?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flround"><code>flround</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flsin"><code>flsin</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flsqrt"><code>flsqrt</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fltan"><code>fltan</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fltruncate"><code>fltruncate</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flzero_003f"><code>flzero?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fold"><code>fold</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fold_002dright"><code>fold-right</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-force_002doutput"><code>force-output</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-foreign-function-interface">foreign function interface</a></td><td valign="top"><a href="#C_002dinterface">19. C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-foreign_002daddress"><code>foreign-address</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-foreign_002drelease_0021"><code>foreign-release!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-foreign_002dreleased_003f"><code>foreign-released?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-foreign_002dtags"><code>foreign-tags</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-foreign_003f"><code>foreign?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-future"><code>future</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fx_002a"><code>fx*</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fx_002b"><code>fx+</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fx_002d"><code>fx-</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fx_003c"><code>fx<</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fx_003c_003d"><code>fx<=</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fx_003d"><code>fx=</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fx_003e"><code>fx></code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fx_003e_003d"><code>fx>=</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxabs"><code>fxabs</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxand"><code>fxand</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxarithmetic_002dshift"><code>fxarithmetic-shift</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxarithmetic_002dshift_002dleft"><code>fxarithmetic-shift-left</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxarithmetic_002dshift_002dright"><code>fxarithmetic-shift-right</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxbit_002dcount"><code>fxbit-count</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxbit_002dset_003f"><code>fxbit-set?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxeven_003f"><code>fxeven?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxfirst_002dbit_002dset"><code>fxfirst-bit-set</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxif"><code>fxif</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxior"><code>fxior</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxlength"><code>fxlength</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxmax"><code>fxmax</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxmin"><code>fxmin</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxmodulo"><code>fxmodulo</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxnegative_003f"><code>fxnegative?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxnot"><code>fxnot</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxodd_003f"><code>fxodd?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxpositive_003f"><code>fxpositive?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxquotient"><code>fxquotient</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxremainder"><code>fxremainder</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxwrap_002a"><code>fxwrap*</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxwrap_002b"><code>fxwrap+</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxwrap_002d"><code>fxwrap-</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxwrapabs"><code>fxwrapabs</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxwraparithmetic_002dshift"><code>fxwraparithmetic-shift</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxwraparithmetic_002dshift_002dleft"><code>fxwraparithmetic-shift-left</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxwraplogical_002dshift_002dright"><code>fxwraplogical-shift-right</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxwrapquotient"><code>fxwrapquotient</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxxor"><code>fxxor</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fxzero_003f"><code>fxzero?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Gambit">Gambit</a></td><td valign="top"><a href="#Top">Gambit</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Gambit-1">Gambit</a></td><td valign="top"><a href="#The-Gambit-system">1. The Gambit system</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gambit_002dscheme"><code>gambit-scheme</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gambit_002eel">gambit.el</a></td><td valign="top"><a href="#Emacs-interface">5.6 Emacs interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-GAMBOPT_002c-environment-variable">GAMBOPT, environment variable</a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-GC">GC</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gc_002dreport_002dset_0021"><code>gc-report-set!</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generate_002dproper_002dtail_002dcalls"><code>generate-proper-tail-calls</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generative_002dlambda"><code>generative-lambda</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generic"><code>generic</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gensym"><code>gensym</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002denvironment_002dvariable"><code>get-environment-variable</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002denvironment_002dvariables"><code>get-environment-variables</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002doutput_002dstring"><code>get-output-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002doutput_002du8vector"><code>get-output-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002doutput_002dvector"><code>get-output-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-getenv"><code>getenv</code></a></td><td valign="top"><a href="#Environment-variables">16.6 Environment variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-group_002dinfo"><code>group-info</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-group_002dinfo_002dgid"><code>group-info-gid</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-group_002dinfo_002dmembers"><code>group-info-members</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-group_002dinfo_002dname"><code>group-info-name</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-group_002dinfo_003f"><code>group-info?</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsc"><code>gsc</code></a></td><td valign="top"><a href="#The-Gambit-system">1. The Gambit system</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsc-1"><code>gsc</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsc-2"><code>gsc</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsc-3"><code>gsc</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsc-4"><code>gsc</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsc-5"><code>gsc</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsc-6"><code>gsc</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsc_002dscript"><code>gsc-script</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsi"><code>gsi</code></a></td><td valign="top"><a href="#The-Gambit-system">1. The Gambit system</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsi-1"><code>gsi</code></a></td><td valign="top"><a href="#GSI">2. The Gambit Scheme interpreter</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsi-2"><code>gsi</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gsi_002dscript"><code>gsi-script</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-hashing">hashing</a></td><td valign="top"><a href="#Hashing-and-weak-references">11. Hashing and weak references</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-heap_002doverflow_002dexception_003f"><code>heap-overflow-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-memory-management">15.2 Exception objects related to memory management</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-help"><code>help</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-help_002dbrowser"><code>help-browser</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-home-directory">home directory</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-homogeneous-vectors">homogeneous vectors</a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-homogeneous-vectors-1">homogeneous vectors</a></td><td valign="top"><a href="#Homogeneous-vector-syntax">18.9 Homogeneous vector syntax</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-host_002dinfo"><code>host-info</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-host_002dinfo_002daddresses"><code>host-info-addresses</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-host_002dinfo_002daliases"><code>host-info-aliases</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-host_002dinfo_002dname"><code>host-info-name</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-host_002dinfo_003f"><code>host-info?</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-host_002dname"><code>host-name</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-identity"><code>identity</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ieee_002dscheme"><code>ieee-scheme</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-improper_002dlength_002dlist_002dexception_002darg_002dnum"><code>improper-length-list-exception-arg-num</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-improper_002dlength_002dlist_002dexception_002darguments"><code>improper-length-list-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-improper_002dlength_002dlist_002dexception_002dprocedure"><code>improper-length-list-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-improper_002dlength_002dlist_002dexception_003f"><code>improper-length-list-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-inactive_002dthread_002dexception_002darguments"><code>inactive-thread-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-inactive_002dthread_002dexception_002dprocedure"><code>inactive-thread-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-inactive_002dthread_002dexception_003f"><code>inactive-thread-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-include"><code>include</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-include-1"><code>include</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-infinite_003f"><code>infinite?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-initialized_002dthread_002dexception_002darguments"><code>initialized-thread-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-initialized_002dthread_002dexception_002dprocedure"><code>initialized-thread-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-initialized_002dthread_002dexception_003f"><code>initialized-thread-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-inline"><code>inline</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-inline_002dprimitives"><code>inline-primitives</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-inlining_002dlimit"><code>inlining-limit</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dbyte_002dposition"><code>input-port-byte-position</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dbytes_002dbuffered"><code>input-port-bytes-buffered</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dchar_002dposition"><code>input-port-char-position</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dcharacters_002dbuffered"><code>input-port-characters-buffered</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dcolumn"><code>input-port-column</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dline"><code>input-port-line</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dreadtable"><code>input-port-readtable</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dreadtable_002dset_0021"><code>input-port-readtable-set!</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dtimeout_002dset_0021"><code>input-port-timeout-set!</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-input_002dport_003f"><code>input-port?</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-installation-directories">installation directories</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-integer_002d_003echar"><code>integer->char</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-integer_002dlength"><code>integer-length</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-integer_002dnth_002droot"><code>integer-nth-root</code></a></td><td valign="top"><a href="#Integer-square-root-and-nth-root">9.3 Integer square root and nth root</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-integer_002dsqrt"><code>integer-sqrt</code></a></td><td valign="top"><a href="#Integer-square-root-and-nth-root">9.3 Integer square root and nth root</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-interpreter">interpreter</a></td><td valign="top"><a href="#GSI">2. The Gambit Scheme interpreter</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-interpreter-1">interpreter</a></td><td valign="top"><a href="#GSC">3. The Gambit Scheme compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-interrupts_002denabled"><code>interrupts-enabled</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-invalid_002dhash_002dnumber_002dexception_002darguments"><code>invalid-hash-number-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-invalid_002dhash_002dnumber_002dexception_002dprocedure"><code>invalid-hash-number-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-invalid_002dhash_002dnumber_002dexception_003f"><code>invalid-hash-number-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-iota"><code>iota</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-J">J</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-jiffies_002dper_002dsecond"><code>jiffies-per-second</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-join_002dtimeout_002dexception_002darguments"><code>join-timeout-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-join_002dtimeout_002dexception_002dprocedure"><code>join-timeout-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-join_002dtimeout_002dexception_003f"><code>join-timeout-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-K">K</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-keyword_002d_003estring"><code>keyword->string</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-keyword_002dexpected_002dexception_002darguments"><code>keyword-expected-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-keyword_002dexpected_002dexception_002dprocedure"><code>keyword-expected-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-keyword_002dexpected_002dexception_003f"><code>keyword-expected-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-keyword_002dhash"><code>keyword-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-keyword_003f"><code>keyword?</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-keywords">keywords</a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-lambda"><code>lambda</code></a></td><td valign="top"><a href="#Extensions-to-standard-special-forms">6.2 Extensions to standard special forms</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lambda_002dlift"><code>lambda-lift</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-last"><code>last</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-last_002dpair"><code>last-pair</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-last_005f_002ec"><code><var>last</var>_.c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-limitations">limitations</a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-link_002dflat"><code>link-flat</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-link_002dincremental"><code>link-incremental</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003ef32vector"><code>list->f32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003ef64vector"><code>list->f64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003es16vector"><code>list->s16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003es32vector"><code>list->s32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003es64vector"><code>list->s64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003es8vector"><code>list->s8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003etable"><code>list->table</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003eu16vector"><code>list->u16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003eu32vector"><code>list->u32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003eu64vector"><code>list->u64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002d_003eu8vector"><code>list->u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002dcopy"><code>list-copy</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002dset"><code>list-set</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002dset_0021"><code>list-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002dtabulate"><code>list-tabulate</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-load"><code>load</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-mailbox_002dreceive_002dtimeout_002dexception_002darguments"><code>mailbox-receive-timeout-exception-arguments</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mailbox_002dreceive_002dtimeout_002dexception_002dprocedure"><code>mailbox-receive-timeout-exception-procedure</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mailbox_002dreceive_002dtimeout_002dexception_003f"><code>mailbox-receive-timeout-exception?</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-main"><code>main</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dcondition_002dvariable"><code>make-condition-variable</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002df32vector"><code>make-f32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002df64vector"><code>make-f64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dlist"><code>make-list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dmutex"><code>make-mutex</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dparameter"><code>make-parameter</code></a></td><td valign="top"><a href="#Dynamic-environment">14. Dynamic environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002drandom_002dsource"><code>make-random-source</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002droot_002dthread"><code>make-root-thread</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002ds16vector"><code>make-s16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002ds32vector"><code>make-s32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002ds64vector"><code>make-s64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002ds8vector"><code>make-s8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dtable"><code>make-table</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dthread"><code>make-thread</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dthread_002dgroup"><code>make-thread-group</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dtls_002dcontext"><code>make-tls-context</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002du16vector"><code>make-u16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002du32vector"><code>make-u32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002du64vector"><code>make-u64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002du8vector"><code>make-u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dwill"><code>make-will</code></a></td><td valign="top"><a href="#Wills">11.2.1 Wills</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mostly_002dfixnum"><code>mostly-fixnum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mostly_002dfixnum_002dflonum"><code>mostly-fixnum-flonum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mostly_002dflonum"><code>mostly-flonum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mostly_002dflonum_002dfixnum"><code>mostly-flonum-fixnum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mostly_002dgeneric"><code>mostly-generic</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-multiple_002dc_002dreturn_002dexception_003f"><code>multiple-c-return-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_002dlock_0021"><code>mutex-lock!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_002dname"><code>mutex-name</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_002dspecific"><code>mutex-specific</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_002dspecific_002dset_0021"><code>mutex-specific-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_002dstate"><code>mutex-state</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_002dunlock_0021"><code>mutex-unlock!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_003f"><code>mutex?</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-N">N</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-namespace"><code>namespace</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nan_003f"><code>nan?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-network_002dinfo"><code>network-info</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-network_002dinfo_002daliases"><code>network-info-aliases</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-network_002dinfo_002dname"><code>network-info-name</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-network_002dinfo_002dnumber"><code>network-info-number</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-network_002dinfo_003f"><code>network-info?</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-newline"><code>newline</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_002darguments"><code>no-such-file-or-directory-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_002dprocedure"><code>no-such-file-or-directory-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_003f"><code>no-such-file-or-directory-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-noncontinuable_002dexception_002dreason"><code>noncontinuable-exception-reason</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-noncontinuable_002dexception_003f"><code>noncontinuable-exception?</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_002darguments"><code>nonempty-input-port-character-buffer-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_002dprocedure"><code>nonempty-input-port-character-buffer-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_003f"><code>nonempty-input-port-character-buffer-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_002darguments"><code>nonprocedure-operator-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_002dcode"><code>nonprocedure-operator-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_002doperator"><code>nonprocedure-operator-exception-operator</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_002drte"><code>nonprocedure-operator-exception-rte</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_003f"><code>nonprocedure-operator-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-normalized-path">normalized path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-number_002dof_002darguments_002dlimit_002dexception_002darguments"><code>number-of-arguments-limit-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-number_002dof_002darguments_002dlimit_002dexception_002dprocedure"><code>number-of-arguments-limit-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-number_002dof_002darguments_002dlimit_002dexception_003f"><code>number-of-arguments-limit-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-object-file">object file</a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-object_002d_003eserial_002dnumber"><code>object->serial-number</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-object_002d_003estring"><code>object->string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-object_002d_003eu8vector"><code>object->u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002ddirectory"><code>open-directory</code></a></td><td valign="top"><a href="#Directory_002dports">17.8 Directory-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002ddummy"><code>open-dummy</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002devent_002dqueue"><code>open-event-queue</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dfile"><code>open-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002dfile"><code>open-input-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002dprocess"><code>open-input-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002dstring"><code>open-input-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002du8vector"><code>open-input-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002dvector"><code>open-input-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002dfile"><code>open-output-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002dprocess"><code>open-output-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002dstring"><code>open-output-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002du8vector"><code>open-output-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002dvector"><code>open-output-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dprocess"><code>open-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dstring"><code>open-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dstring_002dpipe"><code>open-string-pipe</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dtcp_002dclient"><code>open-tcp-client</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dtcp_002dserver"><code>open-tcp-server</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002du8vector"><code>open-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002du8vector_002dpipe"><code>open-u8vector-pipe</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dudp"><code>open-udp</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dvector"><code>open-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dvector_002dpipe"><code>open-vector-pipe</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-optimize_002ddead_002ddefinitions"><code>optimize-dead-definitions</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-optimize_002ddead_002dlocal_002dvariables"><code>optimize-dead-local-variables</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-options_002c-compiler">options, compiler</a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-options_002c-runtime">options, runtime</a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-os_002dexception_002darguments"><code>os-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-os_002dexception_002dcode"><code>os-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-os_002dexception_002dmessage"><code>os-exception-message</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-os_002dexception_002dprocedure"><code>os-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-os_002dexception_003f"><code>os-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dbyte_002dposition"><code>output-port-byte-position</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dchar_002dposition"><code>output-port-char-position</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dcolumn"><code>output-port-column</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dline"><code>output-port-line</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dreadtable"><code>output-port-readtable</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dreadtable_002dset_0021"><code>output-port-readtable-set!</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dtimeout_002dset_0021"><code>output-port-timeout-set!</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dwidth"><code>output-port-width</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output_002dport_003f"><code>output-port?</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-overflow_002c-floating-point">overflow, floating point</a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-parameterize"><code>parameterize</code></a></td><td valign="top"><a href="#Dynamic-environment">14. Dynamic environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-path_002ddirectory"><code>path-directory</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-path_002dexpand"><code>path-expand</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-path_002dextension"><code>path-extension</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-path_002dnormalize"><code>path-normalize</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-path_002dstrip_002ddirectory"><code>path-strip-directory</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-path_002dstrip_002dextension"><code>path-strip-extension</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-path_002dstrip_002dtrailing_002ddirectory_002dseparator"><code>path-strip-trailing-directory-separator</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-path_002dstrip_002dvolume"><code>path-strip-volume</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-path_002dvolume"><code>path-volume</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-peek_002dchar"><code>peek-char</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-poll_002don_002dreturn"><code>poll-on-return</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-port_002dio_002dexception_002dhandler_002dset_0021"><code>port-io-exception-handler-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-port_002dsettings_002dset_0021"><code>port-settings-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-port_003f"><code>port?</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pp"><code>pp</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pretty_002dprint"><code>pretty-print</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-primordial_002dexception_002dhandler"><code>primordial-exception-handler</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-print"><code>print</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-println"><code>println</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dpid"><code>process-pid</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dstatus"><code>process-status</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dtimes"><code>process-times</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-processor_002did"><code>processor-id</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-processor_003f"><code>processor?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-proper-tail_002dcalls">proper tail-calls</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-proper-tail_002dcalls-1">proper tail-calls</a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-proper_002dtail_002dcalls"><code>proper-tail-calls</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo"><code>protocol-info</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo_002daliases"><code>protocol-info-aliases</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo_002dname"><code>protocol-info-name</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo_002dnumber"><code>protocol-info-number</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo_003f"><code>protocol-info?</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-r4rs_002dscheme"><code>r4rs-scheme</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-r5rs_002dscheme"><code>r5rs-scheme</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-raise"><code>raise</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002df64vector"><code>random-f64vector</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dinteger"><code>random-integer</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dreal"><code>random-real</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dmake_002df64vectors"><code>random-source-make-f64vectors</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dmake_002dintegers"><code>random-source-make-integers</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dmake_002dreals"><code>random-source-make-reals</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dmake_002du8vectors"><code>random-source-make-u8vectors</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dpseudo_002drandomize_0021"><code>random-source-pseudo-randomize!</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002drandomize_0021"><code>random-source-randomize!</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dstate_002dref"><code>random-source-state-ref</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dstate_002dset_0021"><code>random-source-state-set!</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002dsource_003f"><code>random-source?</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_002du8vector"><code>random-u8vector</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-range_002dexception_002darg_002dnum"><code>range-exception-arg-num</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-range_002dexception_002darguments"><code>range-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-range_002dexception_002dprocedure"><code>range-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-range_002dexception_003f"><code>range-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-read"><code>read</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-read_002dall"><code>read-all</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-read_002dchar"><code>read-char</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-read_002dline"><code>read-line</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-read_002dsubstring"><code>read-substring</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-read_002dsubu8vector"><code>read-subu8vector</code></a></td><td valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-read_002du8"><code>read-u8</code></a></td><td valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dcase_002dconversion_003f"><code>readtable-case-conversion?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dcase_002dconversion_003f_002dset"><code>readtable-case-conversion?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002deval_002dallowed_003f"><code>readtable-eval-allowed?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002deval_002dallowed_003f_002dset"><code>readtable-eval-allowed?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dkeywords_002dallowed_003f"><code>readtable-keywords-allowed?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dkeywords_002dallowed_003f_002dset"><code>readtable-keywords-allowed?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dunescaped_002dchar"><code>readtable-max-unescaped-char</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dunescaped_002dchar_002dset"><code>readtable-max-unescaped-char-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dwrite_002dlength"><code>readtable-max-write-length</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dwrite_002dlength_002dset"><code>readtable-max-write-length-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dwrite_002dlevel"><code>readtable-max-write-level</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dwrite_002dlevel_002dset"><code>readtable-max-write-level-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dsharing_002dallowed_003f"><code>readtable-sharing-allowed?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dsharing_002dallowed_003f_002dset"><code>readtable-sharing-allowed?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dstart_002dsyntax"><code>readtable-start-syntax</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dstart_002dsyntax_002dset"><code>readtable-start-syntax-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dwrite_002dcdr_002dread_002dmacros_003f"><code>readtable-write-cdr-read-macros?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dwrite_002dcdr_002dread_002dmacros_003f_002dset"><code>readtable-write-cdr-read-macros?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dwrite_002dextended_002dread_002dmacros_003f"><code>readtable-write-extended-read-macros?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dwrite_002dextended_002dread_002dmacros_003f_002dset"><code>readtable-write-extended-read-macros?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_003f"><code>readtable?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-real_002dtime"><code>real-time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-receive"><code>receive</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-relative-path">relative path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-relative-path-1">relative path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rename_002dfile"><code>rename-file</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-repl_002ddisplay_002denvironment_003f"><code>repl-display-environment?</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-repl_002dinput_002dport"><code>repl-input-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-repl_002doutput_002dport"><code>repl-output-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-repl_002dresult_002dhistory_002dmax_002dlength_002dset_0021"><code>repl-result-history-max-length-set!</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-repl_002dresult_002dhistory_002dref"><code>repl-result-history-ref</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-replace_002dbit_002dfield"><code>replace-bit-field</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-reverse_0021"><code>reverse!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rpc_002dremote_002derror_002dexception_002darguments"><code>rpc-remote-error-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rpc_002dremote_002derror_002dexception_002dmessage"><code>rpc-remote-error-exception-message</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rpc_002dremote_002derror_002dexception_002dprocedure"><code>rpc-remote-error-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rpc_002dremote_002derror_002dexception_003f"><code>rpc-remote-error-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-run_002dtime_002dbindings"><code>run-time-bindings</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-runtime-options">runtime options</a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector"><code>s16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_002d_003elist"><code>s16vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_002dappend"><code>s16vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_002dcopy"><code>s16vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_002dfill_0021"><code>s16vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_002dlength"><code>s16vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_002dref"><code>s16vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_002dset"><code>s16vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_002dset_0021"><code>s16vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_002dshrink_0021"><code>s16vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s16vector_003f"><code>s16vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector"><code>s32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_002d_003elist"><code>s32vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_002dappend"><code>s32vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_002dcopy"><code>s32vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_002dfill_0021"><code>s32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_002dlength"><code>s32vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_002dref"><code>s32vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_002dset"><code>s32vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_002dset_0021"><code>s32vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_002dshrink_0021"><code>s32vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s32vector_003f"><code>s32vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector"><code>s64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_002d_003elist"><code>s64vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_002dappend"><code>s64vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_002dcopy"><code>s64vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_002dfill_0021"><code>s64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_002dlength"><code>s64vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_002dref"><code>s64vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_002dset"><code>s64vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_002dset_0021"><code>s64vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_002dshrink_0021"><code>s64vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s64vector_003f"><code>s64vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector"><code>s8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_002d_003elist"><code>s8vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_002dappend"><code>s8vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_002dcopy"><code>s8vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_002dfill_0021"><code>s8vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_002dlength"><code>s8vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_002dref"><code>s8vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_002dset"><code>s8vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_002dset_0021"><code>s8vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_002dshrink_0021"><code>s8vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-s8vector_003f"><code>s8vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-safe"><code>safe</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-scheduler_002dexception_002dreason"><code>scheduler-exception-reason</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-scheduler_002dexception_003f"><code>scheduler-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Scheme">Scheme</a></td><td valign="top"><a href="#The-Gambit-system">1. The Gambit system</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Scheme_002c-implementation-of">Scheme, implementation of</a></td><td valign="top"><a href="#Top">Gambit</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-scheme_002dieee_002d1178_002d1990"><code>scheme-ieee-1178-1990</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-scheme_002dr4rs"><code>scheme-r4rs</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-scheme_002dr5rs"><code>scheme-r5rs</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-scheme_002dsrfi_002d0"><code>scheme-srfi-0</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-seconds_002d_003etime"><code>seconds->time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-separate"><code>separate</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-serial_002dnumber_002d_003eobject"><code>serial-number->object</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-serialization">serialization</a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-serialization-1">serialization</a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-service_002dinfo"><code>service-info</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_002daliases"><code>service-info-aliases</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_002dname"><code>service-info-name</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_002dport_002dnumber"><code>service-info-port-number</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_002dprotocol"><code>service-info-protocol</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_003f"><code>service-info?</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set_0021"><code>set!</code></a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set_002dbox_0021"><code>set-box!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-setenv"><code>setenv</code></a></td><td valign="top"><a href="#Environment-variables">16.6 Environment variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_002darguments"><code>sfun-conversion-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_002dcode"><code>sfun-conversion-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_002dmessage"><code>sfun-conversion-exception-message</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_002dprocedure"><code>sfun-conversion-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_003f"><code>sfun-conversion-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-shell_002dcommand"><code>shell-command</code></a></td><td valign="top"><a href="#Shell-command-execution">16.3 Shell command execution</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002dscript"><code>six-script</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002e_0021"><code>six.!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002e_0021x"><code>six.!x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002e_0026x"><code>six.&x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002e_002ax"><code>six.*x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002e_002b_002bx"><code>six.++x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002e_002bx"><code>six.+x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002e_002d_002dx"><code>six.--x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002e_002dx"><code>six.-x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002earrow"><code>six.arrow</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ebreak"><code>six.break</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ecall"><code>six.call</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ecase"><code>six.case</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002eclause"><code>six.clause</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ecompound"><code>six.compound</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002econs"><code>six.cons</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002econtinue"><code>six.continue</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002edefine_002dprocedure"><code>six.define-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002edefine_002dvariable"><code>six.define-variable</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002edo_002dwhile"><code>six.do-while</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002edot"><code>six.dot</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002efor"><code>six.for</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002egoto"><code>six.goto</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002eidentifier"><code>six.identifier</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002eif"><code>six.if</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002eindex"><code>six.index</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002elabel"><code>six.label</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002elist"><code>six.list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002eliteral"><code>six.literal</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002emake_002darray"><code>six.make-array</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002enew"><code>six.new</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002enull"><code>six.null</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002eprefix"><code>six.prefix</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002eprocedure"><code>six.procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002eprocedure_002dbody"><code>six.procedure-body</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ereturn"><code>six.return</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002eswitch"><code>six.switch</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ewhile"><code>six.while</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_0021_003dy"><code>six.x!=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_0025_003dy"><code>six.x%=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_0025y"><code>six.x%y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_0026_0026y"><code>six.x&&y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_0026_003dy"><code>six.x&=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_0026y"><code>six.x&y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002a_003dy"><code>six.x*=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002ay"><code>six.x*y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002b_002b"><code>six.x++</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002b_003dy"><code>six.x+=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002by"><code>six.x+y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002d_002d"><code>six.x--</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002d_003dy"><code>six.x-=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002dy"><code>six.x-y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002f_003dy"><code>six.x/=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_002fy"><code>six.x/y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003a_002dy"><code>six.x:-y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003a_003dy"><code>six.x:=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003ay"><code>six.x:y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003c_003c_003dy"><code>six.x<<=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003c_003cy"><code>six.x<<y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003c_003dy"><code>six.x<=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003cy"><code>six.x<y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003d_003dy"><code>six.x==y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003dy"><code>six.x=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003e_003dy"><code>six.x>=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003e_003e_003dy"><code>six.x>>=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003e_003ey"><code>six.x>>y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003ey"><code>six.x>y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_003fy_003az"><code>six.x?y:z</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_005e_003dy"><code>six.x^=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002ex_005ey"><code>six.x^y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-six_002e_007ex"><code>six.~x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dinfo_002daddress"><code>socket-info-address</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dinfo_002dfamily"><code>socket-info-family</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dinfo_002dport_002dnumber"><code>socket-info-port-number</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dinfo_003f"><code>socket-info?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stack_002doverflow_002dexception_003f"><code>stack-overflow-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-memory-management">15.2 Exception objects related to memory management</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-standard_002dbindings"><code>standard-bindings</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-started_002dthread_002dexception_002darguments"><code>started-thread-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-started_002dthread_002dexception_002dprocedure"><code>started-thread-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-started_002dthread_002dexception_003f"><code>started-thread-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-step"><code>step</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-step_002dlevel_002dset_0021"><code>step-level-set!</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002d_003ekeyword"><code>string->keyword</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002d_003euninterned_002dkeyword"><code>string->uninterned-keyword</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002d_003euninterned_002dsymbol"><code>string->uninterned-symbol</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002dci_003c_003d_003f"><code>string-ci<=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002dci_003c_003f"><code>string-ci<?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002dci_003d_003f"><code>string-ci=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002dci_003d_003f_002dhash"><code>string-ci=?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002dci_003e_003d_003f"><code>string-ci>=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002dci_003e_003f"><code>string-ci>?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002dshrink_0021"><code>string-shrink!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_003c_003d_003f"><code>string<=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_003c_003f"><code>string<?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_003d_003f"><code>string=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_003d_003f_002dhash"><code>string=?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_003e_003d_003f"><code>string>=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_003e_003f"><code>string>?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subf32vector"><code>subf32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subf32vector_002dfill_0021"><code>subf32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subf32vector_002dmove_0021"><code>subf32vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subf64vector"><code>subf64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subf64vector_002dfill_0021"><code>subf64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subf64vector_002dmove_0021"><code>subf64vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs16vector"><code>subs16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs16vector_002dfill_0021"><code>subs16vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs16vector_002dmove_0021"><code>subs16vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs32vector"><code>subs32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs32vector_002dfill_0021"><code>subs32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs32vector_002dmove_0021"><code>subs32vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs64vector"><code>subs64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs64vector_002dfill_0021"><code>subs64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs64vector_002dmove_0021"><code>subs64vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs8vector"><code>subs8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs8vector_002dfill_0021"><code>subs8vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subs8vector_002dmove_0021"><code>subs8vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-substring_002dfill_0021"><code>substring-fill!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-substring_002dmove_0021"><code>substring-move!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu16vector"><code>subu16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu16vector_002dfill_0021"><code>subu16vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu16vector_002dmove_0021"><code>subu16vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu32vector"><code>subu32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu32vector_002dfill_0021"><code>subu32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu32vector_002dmove_0021"><code>subu32vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu64vector"><code>subu64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu64vector_002dfill_0021"><code>subu64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu64vector_002dmove_0021"><code>subu64vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu8vector"><code>subu8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu8vector_002dfill_0021"><code>subu8vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subu8vector_002dmove_0021"><code>subu8vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subvector"><code>subvector</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subvector_002dfill_0021"><code>subvector-fill!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subvector_002dmove_0021"><code>subvector-move!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-symbol_002dhash"><code>symbol-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-syntax_002dcase"><code>syntax-case</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-syntax_002drules"><code>syntax-rules</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-system_002dstamp"><code>system-stamp</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-system_002dtype"><code>system-type</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-system_002dtype_002dstring"><code>system-type-string</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-system_002dversion"><code>system-version</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-system_002dversion_002dstring"><code>system-version-string</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_002d_003elist"><code>table->list</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_002dcopy"><code>table-copy</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_002dfor_002deach"><code>table-for-each</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_002dlength"><code>table-length</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_002dmerge"><code>table-merge</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_002dmerge_0021"><code>table-merge!</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_002dref"><code>table-ref</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_002dsearch"><code>table-search</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_002dset_0021"><code>table-set!</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-table_003f"><code>table?</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tables">tables</a></td><td valign="top"><a href="#Hashing-and-weak-references">11. Hashing and weak references</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tail_002dcalls">tail-calls</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tail_002dcalls-1">tail-calls</a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-take"><code>take</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tcp_002dclient_002dlocal_002dsocket_002dinfo"><code>tcp-client-local-socket-info</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tcp_002dclient_002dpeer_002dsocket_002dinfo"><code>tcp-client-peer-socket-info</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tcp_002dserver_002dsocket_002dinfo"><code>tcp-server-socket-info</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tcp_002dservice_002dregister_0021"><code>tcp-service-register!</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tcp_002dservice_002dunregister_0021"><code>tcp-service-unregister!</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-terminated_002dthread_002dexception_002darguments"><code>terminated-thread-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-terminated_002dthread_002dexception_002dprocedure"><code>terminated-thread-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-terminated_002dthread_002dexception_003f"><code>terminated-thread-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-test_002dbit_002dfield_003f"><code>test-bit-field?</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-this_002dsource_002dfile"><code>this-source-file</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dbase_002dpriority"><code>thread-base-priority</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dbase_002dpriority_002dset_0021"><code>thread-base-priority-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dgroup_002dlist"><code>thread-group->thread-group-list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dgroup_002dvector"><code>thread-group->thread-group-vector</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dlist"><code>thread-group->thread-list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dvector"><code>thread-group->thread-vector</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dname"><code>thread-group-name</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dparent"><code>thread-group-parent</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dresume_0021"><code>thread-group-resume!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dsuspend_0021"><code>thread-group-suspend!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dterminate_0021"><code>thread-group-terminate!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_003f"><code>thread-group?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dinit_0021"><code>thread-init!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dinterrupt_0021"><code>thread-interrupt!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002djoin_0021"><code>thread-join!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dmailbox_002dextract_002dand_002drewind"><code>thread-mailbox-extract-and-rewind</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dmailbox_002dnext"><code>thread-mailbox-next</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dmailbox_002drewind"><code>thread-mailbox-rewind</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dname"><code>thread-name</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dpriority_002dboost"><code>thread-priority-boost</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dpriority_002dboost_002dset_0021"><code>thread-priority-boost-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dquantum"><code>thread-quantum</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dquantum_002dset_0021"><code>thread-quantum-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dreceive"><code>thread-receive</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dresume_0021"><code>thread-resume!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dsend"><code>thread-send</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dsleep_0021"><code>thread-sleep!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dspecific"><code>thread-specific</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dspecific_002dset_0021"><code>thread-specific-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstart_0021"><code>thread-start!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate"><code>thread-state</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dabnormally_002dterminated_002dreason"><code>thread-state-abnormally-terminated-reason</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dabnormally_002dterminated_003f"><code>thread-state-abnormally-terminated?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dinitialized_003f"><code>thread-state-initialized?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dnormally_002dterminated_002dresult"><code>thread-state-normally-terminated-result</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dnormally_002dterminated_003f"><code>thread-state-normally-terminated?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002drunning_002dprocessor"><code>thread-state-running-processor</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002drunning_003f"><code>thread-state-running?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002duninitialized_003f"><code>thread-state-uninitialized?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dwaiting_002dfor"><code>thread-state-waiting-for</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dwaiting_002dtimeout"><code>thread-state-waiting-timeout</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dwaiting_003f"><code>thread-state-waiting?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dsuspend_0021"><code>thread-suspend!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dterminate_0021"><code>thread-terminate!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dthread_002dgroup"><code>thread-thread-group</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dyield_0021"><code>thread-yield!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_003f"><code>thread?</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-threads">threads</a></td><td valign="top"><a href="#Threads">13. Threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-time"><code>time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-time_002d_003eseconds"><code>time->seconds</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-time_003f"><code>time?</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-timeout_002d_003etime"><code>timeout->time</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-top"><code>top</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-touch"><code>touch</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-trace"><code>trace</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-transcript_002doff"><code>transcript-off</code></a></td><td valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-transcript_002don"><code>transcript-on</code></a></td><td valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tty_002dhistory"><code>tty-history</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tty_002dhistory_002dmax_002dlength_002dset_0021"><code>tty-history-max-length-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tty_002dhistory_002dset_0021"><code>tty-history-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tty_002dmode_002dset_0021"><code>tty-mode-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tty_002dparen_002dbalance_002dduration_002dset_0021"><code>tty-paren-balance-duration-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tty_002dtext_002dattributes_002dset_0021"><code>tty-text-attributes-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tty_002dtype_002dset_0021"><code>tty-type-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tty_003f"><code>tty?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-type_002dexception_002darg_002dnum"><code>type-exception-arg-num</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-type_002dexception_002darguments"><code>type-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-type_002dexception_002dprocedure"><code>type-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-type_002dexception_002dtype_002did"><code>type-exception-type-id</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-type_002dexception_003f"><code>type-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector"><code>u16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_002d_003elist"><code>u16vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_002dappend"><code>u16vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_002dcopy"><code>u16vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_002dfill_0021"><code>u16vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_002dlength"><code>u16vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_002dref"><code>u16vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_002dset"><code>u16vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_002dset_0021"><code>u16vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_002dshrink_0021"><code>u16vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u16vector_003f"><code>u16vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector"><code>u32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_002d_003elist"><code>u32vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_002dappend"><code>u32vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_002dcopy"><code>u32vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_002dfill_0021"><code>u32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_002dlength"><code>u32vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_002dref"><code>u32vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_002dset"><code>u32vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_002dset_0021"><code>u32vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_002dshrink_0021"><code>u32vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u32vector_003f"><code>u32vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector"><code>u64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_002d_003elist"><code>u64vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_002dappend"><code>u64vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_002dcopy"><code>u64vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_002dfill_0021"><code>u64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_002dlength"><code>u64vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_002dref"><code>u64vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_002dset"><code>u64vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_002dset_0021"><code>u64vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_002dshrink_0021"><code>u64vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u64vector_003f"><code>u64vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector"><code>u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002d_003elist"><code>u8vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002d_003eobject"><code>u8vector->object</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002dappend"><code>u8vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002dcopy"><code>u8vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002dfill_0021"><code>u8vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002dlength"><code>u8vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002dref"><code>u8vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002dset"><code>u8vector-set</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002dset_0021"><code>u8vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_002dshrink_0021"><code>u8vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-u8vector_003f"><code>u8vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-udp_002ddestination_002dset_0021"><code>udp-destination-set!</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-udp_002dlocal_002dsocket_002dinfo"><code>udp-local-socket-info</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-udp_002dread_002dsubu8vector"><code>udp-read-subu8vector</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-udp_002dread_002du8vector"><code>udp-read-u8vector</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-udp_002dsource_002dsocket_002dinfo"><code>udp-source-socket-info</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-udp_002dwrite_002dsubu8vector"><code>udp-write-subu8vector</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-udp_002dwrite_002du8vector"><code>udp-write-u8vector</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dglobal_002dexception_002dcode"><code>unbound-global-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dglobal_002dexception_002drte"><code>unbound-global-exception-rte</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dglobal_002dexception_002dvariable"><code>unbound-global-exception-variable</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dglobal_002dexception_003f"><code>unbound-global-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dos_002denvironment_002dvariable_002dexception_002darguments"><code>unbound-os-environment-variable-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dos_002denvironment_002dvariable_002dexception_002dprocedure"><code>unbound-os-environment-variable-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dos_002denvironment_002dvariable_002dexception_003f"><code>unbound-os-environment-variable-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dserial_002dnumber_002dexception_002darguments"><code>unbound-serial-number-exception-arguments</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dserial_002dnumber_002dexception_002dprocedure"><code>unbound-serial-number-exception-procedure</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dserial_002dnumber_002dexception_003f"><code>unbound-serial-number-exception?</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dtable_002dkey_002dexception_002darguments"><code>unbound-table-key-exception-arguments</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dtable_002dkey_002dexception_002dprocedure"><code>unbound-table-key-exception-procedure</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbound_002dtable_002dkey_002dexception_003f"><code>unbound-table-key-exception?</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbox"><code>unbox</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unbreak"><code>unbreak</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uncaught_002dexception_002darguments"><code>uncaught-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uncaught_002dexception_002dprocedure"><code>uncaught-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uncaught_002dexception_002dreason"><code>uncaught-exception-reason</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uncaught_002dexception_003f"><code>uncaught-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uninitialized_002dthread_002dexception_002darguments"><code>uninitialized-thread-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uninitialized_002dthread_002dexception_002dprocedure"><code>uninitialized-thread-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uninitialized_002dthread_002dexception_003f"><code>uninitialized-thread-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uninterned_002dkeyword_003f"><code>uninterned-keyword?</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uninterned_002dsymbol_003f"><code>uninterned-symbol?</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unknown_002dkeyword_002dargument_002dexception_002darguments"><code>unknown-keyword-argument-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unknown_002dkeyword_002dargument_002dexception_002dprocedure"><code>unknown-keyword-argument-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unknown_002dkeyword_002dargument_002dexception_003f"><code>unknown-keyword-argument-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unterminated_002dprocess_002dexception_002darguments"><code>unterminated-process-exception-arguments</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unterminated_002dprocess_002dexception_002dprocedure"><code>unterminated-process-exception-procedure</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unterminated_002dprocess_002dexception_003f"><code>unterminated-process-exception?</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-untrace"><code>untrace</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-user_002dinfo"><code>user-info</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002dgid"><code>user-info-gid</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002dhome"><code>user-info-home</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002dname"><code>user-info-name</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002dshell"><code>user-info-shell</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002duid"><code>user-info-uid</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_003f"><code>user-info?</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-user_002dname"><code>user-name</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-vector_002dappend"><code>vector-append</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-vector_002dcopy"><code>vector-copy</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-vector_002dshrink_0021"><code>vector-shrink!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-void"><code>void</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-weak-references">weak references</a></td><td valign="top"><a href="#Hashing-and-weak-references">11. Hashing and weak references</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-will_002dexecute_0021"><code>will-execute!</code></a></td><td valign="top"><a href="#Wills">11.2.1 Wills</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-will_002dtestator"><code>will-testator</code></a></td><td valign="top"><a href="#Wills">11.2.1 Wills</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-will_003f"><code>will?</code></a></td><td valign="top"><a href="#Wills">11.2.1 Wills</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dexception_002dcatcher"><code>with-exception-catcher</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dexception_002dhandler"><code>with-exception-handler</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dfile"><code>with-input-from-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dport"><code>with-input-from-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dprocess"><code>with-input-from-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dstring"><code>with-input-from-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002du8vector"><code>with-input-from-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dvector"><code>with-input-from-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dfile"><code>with-output-to-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dport"><code>with-output-to-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dprocess"><code>with-output-to-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dstring"><code>with-output-to-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002du8vector"><code>with-output-to-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dvector"><code>with-output-to-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-write"><code>write</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-write_002dchar"><code>write-char</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-write_002dsubstring"><code>write-substring</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-write_002dsubu8vector"><code>write-subu8vector</code></a></td><td valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-write_002du8"><code>write-u8</code></a></td><td valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-wrong_002dnumber_002dof_002darguments_002dexception_002darguments"><code>wrong-number-of-arguments-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-wrong_002dnumber_002dof_002darguments_002dexception_002dprocedure"><code>wrong-number-of-arguments-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-wrong_002dnumber_002dof_002darguments_002dexception_003f"><code>wrong-number-of-arguments-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="General-index-1_cp_letter-X">X</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-xcons"><code>xcons</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: </th><td><a href="#General-index-1_cp_symbol-1" class="summary-letter"><b>#</b></a>
<a href="#General-index-1_cp_symbol-2" class="summary-letter"><b>+</b></a>
<a href="#General-index-1_cp_symbol-3" class="summary-letter"><b>,</b></a>
<a href="#General-index-1_cp_symbol-4" class="summary-letter"><b>-</b></a>
<a href="#General-index-1_cp_symbol-5" class="summary-letter"><b>.</b></a>
<a href="#General-index-1_cp_symbol-6" class="summary-letter"><b><</b></a>
<a href="#General-index-1_cp_symbol-7" class="summary-letter"><b>=</b></a>
<a href="#General-index-1_cp_symbol-8" class="summary-letter"><b>></b></a>
<a href="#General-index-1_cp_symbol-9" class="summary-letter"><b>^</b></a>
<a href="#General-index-1_cp_symbol-10" class="summary-letter"><b>_</b></a>
<a href="#General-index-1_cp_symbol-11" class="summary-letter"><b>|</b></a>
<a href="#General-index-1_cp_symbol-12" class="summary-letter"><b>~</b></a>
<br>
<a href="#General-index-1_cp_letter-A" class="summary-letter"><b>A</b></a>
<a href="#General-index-1_cp_letter-B" class="summary-letter"><b>B</b></a>
<a href="#General-index-1_cp_letter-C" class="summary-letter"><b>C</b></a>
<a href="#General-index-1_cp_letter-D" class="summary-letter"><b>D</b></a>
<a href="#General-index-1_cp_letter-E" class="summary-letter"><b>E</b></a>
<a href="#General-index-1_cp_letter-F" class="summary-letter"><b>F</b></a>
<a href="#General-index-1_cp_letter-G" class="summary-letter"><b>G</b></a>
<a href="#General-index-1_cp_letter-H" class="summary-letter"><b>H</b></a>
<a href="#General-index-1_cp_letter-I" class="summary-letter"><b>I</b></a>
<a href="#General-index-1_cp_letter-J" class="summary-letter"><b>J</b></a>
<a href="#General-index-1_cp_letter-K" class="summary-letter"><b>K</b></a>
<a href="#General-index-1_cp_letter-L" class="summary-letter"><b>L</b></a>
<a href="#General-index-1_cp_letter-M" class="summary-letter"><b>M</b></a>
<a href="#General-index-1_cp_letter-N" class="summary-letter"><b>N</b></a>
<a href="#General-index-1_cp_letter-O" class="summary-letter"><b>O</b></a>
<a href="#General-index-1_cp_letter-P" class="summary-letter"><b>P</b></a>
<a href="#General-index-1_cp_letter-R" class="summary-letter"><b>R</b></a>
<a href="#General-index-1_cp_letter-S" class="summary-letter"><b>S</b></a>
<a href="#General-index-1_cp_letter-T" class="summary-letter"><b>T</b></a>
<a href="#General-index-1_cp_letter-U" class="summary-letter"><b>U</b></a>
<a href="#General-index-1_cp_letter-V" class="summary-letter"><b>V</b></a>
<a href="#General-index-1_cp_letter-W" class="summary-letter"><b>W</b></a>
<a href="#General-index-1_cp_letter-X" class="summary-letter"><b>X</b></a>
</td></tr></table>
<hr size="6">
<a name="SEC_Contents"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1>Table of Contents</h1>
<div class="contents">
<ul class="toc">
<li><a name="toc-The-Gambit-system-1" href="#The-Gambit-system">1. The Gambit system</a>
<ul class="toc">
<li><a name="toc-Accessing-the-system-files-1" href="#Accessing-the-system-files">1.1 Accessing the system files</a></li>
</ul></li>
<li><a name="toc-The-Gambit-Scheme-interpreter" href="#GSI">2. The Gambit Scheme interpreter</a>
<ul class="toc">
<li><a name="toc-Interactive-mode-1" href="#GSI-interactive-mode">2.1 Interactive mode</a></li>
<li><a name="toc-Batch-mode-1" href="#GSI-batch-mode">2.2 Batch mode</a></li>
<li><a name="toc-Customization" href="#GSI-customization">2.3 Customization</a></li>
<li><a name="toc-Process-exit-status" href="#GSI-exit-status">2.4 Process exit status</a></li>
<li><a name="toc-Scheme-scripts-1" href="#Scheme-scripts">2.5 Scheme scripts</a>
<ul class="toc">
<li><a name="toc-Scripts-under-UNIX-and-Mac-OS-X-1" href="#Scripts-under-UNIX-and-Mac-OS-X">2.5.1 Scripts under UNIX and Mac OS X</a></li>
<li><a name="toc-Scripts-under-Microsoft-Windows-1" href="#Scripts-under-Microsoft-Windows">2.5.2 Scripts under Microsoft Windows</a></li>
<li><a name="toc-Compiling-scripts-1" href="#Compiling-scripts">2.5.3 Compiling scripts</a></li>
</ul>
</li>
</ul></li>
<li><a name="toc-The-Gambit-Scheme-compiler" href="#GSC">3. The Gambit Scheme compiler</a>
<ul class="toc">
<li><a name="toc-Interactive-mode" href="#GSC-interactive-mode">3.1 Interactive mode</a></li>
<li><a name="toc-Customization-1" href="#GSC-customization">3.2 Customization</a></li>
<li><a name="toc-Batch-mode" href="#GSC-batch-mode">3.3 Batch mode</a></li>
<li><a name="toc-Link-files-1" href="#Link-files">3.4 Link files</a>
<ul class="toc">
<li><a name="toc-Building-an-executable-program-1" href="#Building-an-executable-program">3.4.1 Building an executable program</a></li>
<li><a name="toc-Building-a-loadable-library-1" href="#Building-a-loadable-library">3.4.2 Building a loadable library</a></li>
<li><a name="toc-Building-a-shared_002dlibrary-1" href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></li>
<li><a name="toc-Other-compilation-options-1" href="#Other-compilation-options">3.4.4 Other compilation options</a></li>
</ul></li>
<li><a name="toc-Procedures-specific-to-compiler-1" href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></li>
</ul></li>
<li><a name="toc-Runtime-options-1" href="#Runtime-options">4. Runtime options</a></li>
<li><a name="toc-Debugging-1" href="#Debugging">5. Debugging</a>
<ul class="toc">
<li><a name="toc-Debugging-model-1" href="#Debugging-model">5.1 Debugging model</a></li>
<li><a name="toc-Debugging-commands-1" href="#Debugging-commands">5.2 Debugging commands</a></li>
<li><a name="toc-Debugging-example-1" href="#Debugging-example">5.3 Debugging example</a></li>
<li><a name="toc-Procedures-related-to-debugging-1" href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></li>
<li><a name="toc-Console-line_002dediting-1" href="#Console-line_002dediting">5.5 Console line-editing</a></li>
<li><a name="toc-Emacs-interface-1" href="#Emacs-interface">5.6 Emacs interface</a></li>
<li><a name="toc-GUIDE-1" href="#GUIDE">5.7 GUIDE</a></li>
</ul></li>
<li><a name="toc-Scheme-extensions-1" href="#Scheme-extensions">6. Scheme extensions</a>
<ul class="toc">
<li><a name="toc-Extensions-to-standard-procedures-1" href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></li>
<li><a name="toc-Extensions-to-standard-special-forms-1" href="#Extensions-to-standard-special-forms">6.2 Extensions to standard special forms</a></li>
<li><a name="toc-Miscellaneous-extensions-1" href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></li>
<li><a name="toc-Undocumented-extensions-1" href="#Undocumented-extensions">6.4 Undocumented extensions</a></li>
</ul></li>
<li><a name="toc-Namespaces-1" href="#Namespaces">7. Namespaces</a></li>
<li><a name="toc-Characters-and-strings-1" href="#Characters-and-strings">8. Characters and strings</a>
<ul class="toc">
<li><a name="toc-Extensions-to-character-procedures-1" href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></li>
<li><a name="toc-Extensions-to-string-procedures-1" href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></li>
</ul></li>
<li><a name="toc-Numbers-1" href="#Numbers">9. Numbers</a>
<ul class="toc">
<li><a name="toc-Extensions-to-numeric-procedures-1" href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></li>
<li><a name="toc-IEEE-floating-point-arithmetic-1" href="#IEEE-floating-point-arithmetic">9.2 IEEE floating point arithmetic</a></li>
<li><a name="toc-Integer-square-root-and-nth-root-1" href="#Integer-square-root-and-nth-root">9.3 Integer square root and nth root</a></li>
<li><a name="toc-Bitwise_002doperations-on-exact-integers-1" href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></li>
<li><a name="toc-Fixnum-specific-operations-1" href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></li>
<li><a name="toc-Flonum-specific-operations-1" href="#Flonum-specific-operations">9.6 Flonum specific operations</a></li>
<li><a name="toc-Pseudo-random-numbers-1" href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></li>
</ul></li>
<li><a name="toc-Homogeneous-vectors-1" href="#Homogeneous-vectors">10. Homogeneous vectors</a></li>
<li><a name="toc-Hashing-and-weak-references-1" href="#Hashing-and-weak-references">11. Hashing and weak references</a>
<ul class="toc">
<li><a name="toc-Hashing-1" href="#Hashing">11.1 Hashing</a></li>
<li><a name="toc-Weak-references-1" href="#Weak-references">11.2 Weak references</a>
<ul class="toc">
<li><a name="toc-Wills-1" href="#Wills">11.2.1 Wills</a></li>
<li><a name="toc-Tables-1" href="#Tables">11.2.2 Tables</a></li>
</ul>
</li>
</ul></li>
<li><a name="toc-Records-1" href="#Records">12. Records</a></li>
<li><a name="toc-Threads-1" href="#Threads">13. Threads</a>
<ul class="toc">
<li><a name="toc-Introduction-1" href="#Introduction">13.1 Introduction</a></li>
<li><a name="toc-Thread-objects-1" href="#Thread-objects">13.2 Thread objects</a></li>
<li><a name="toc-Mutex-objects-1" href="#Mutex-objects">13.3 Mutex objects</a></li>
<li><a name="toc-Condition-variable-objects-1" href="#Condition-variable-objects">13.4 Condition variable objects</a></li>
<li><a name="toc-Fairness-1" href="#Fairness">13.5 Fairness</a></li>
<li><a name="toc-Memory-coherency-1" href="#Memory-coherency">13.6 Memory coherency</a></li>
<li><a name="toc-Timeouts-1" href="#Timeouts">13.7 Timeouts</a></li>
<li><a name="toc-Primordial-thread-1" href="#Primordial-thread">13.8 Primordial thread</a></li>
<li><a name="toc-Procedures-1" href="#Procedures">13.9 Procedures</a></li>
</ul></li>
<li><a name="toc-Dynamic-environment-1" href="#Dynamic-environment">14. Dynamic environment</a></li>
<li><a name="toc-Exceptions-1" href="#Exceptions">15. Exceptions</a>
<ul class="toc">
<li><a name="toc-Exception_002dhandling-1" href="#Exception_002dhandling">15.1 Exception-handling</a></li>
<li><a name="toc-Exception-objects-related-to-memory-management-1" href="#Exception-objects-related-to-memory-management">15.2 Exception objects related to memory management</a></li>
<li><a name="toc-Exception-objects-related-to-the-host-environment-1" href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></li>
<li><a name="toc-Exception-objects-related-to-threads-1" href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></li>
<li><a name="toc-Exception-objects-related-to-C_002dinterface-1" href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></li>
<li><a name="toc-Exception-objects-related-to-the-reader-1" href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></li>
<li><a name="toc-Exception-objects-related-to-evaluation-and-compilation-1" href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></li>
<li><a name="toc-Exception-objects-related-to-type-checking-1" href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></li>
<li><a name="toc-Exception-objects-related-to-procedure-call-1" href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></li>
<li><a name="toc-Other-exception-objects-1" href="#Other-exception-objects">15.10 Other exception objects</a></li>
</ul></li>
<li><a name="toc-Host-environment-1" href="#Host-environment">16. Host environment</a>
<ul class="toc">
<li><a name="toc-Handling-of-file-names-1" href="#Handling-of-file-names">16.1 Handling of file names</a></li>
<li><a name="toc-Filesystem-operations-1" href="#Filesystem-operations">16.2 Filesystem operations</a></li>
<li><a name="toc-Shell-command-execution-1" href="#Shell-command-execution">16.3 Shell command execution</a></li>
<li><a name="toc-Process-termination-1" href="#Process-termination">16.4 Process termination</a></li>
<li><a name="toc-Command-line-arguments-1" href="#Command-line-arguments">16.5 Command line arguments</a></li>
<li><a name="toc-Environment-variables-1" href="#Environment-variables">16.6 Environment variables</a></li>
<li><a name="toc-Measuring-time-1" href="#Measuring-time">16.7 Measuring time</a></li>
<li><a name="toc-File-information-1" href="#File-information">16.8 File information</a></li>
<li><a name="toc-Group-information-1" href="#Group-information">16.9 Group information</a></li>
<li><a name="toc-User-information-1" href="#User-information">16.10 User information</a></li>
<li><a name="toc-Host-information-1" href="#Host-information">16.11 Host information</a></li>
<li><a name="toc-Service-information-1" href="#Service-information">16.12 Service information</a></li>
<li><a name="toc-Protocol-information-1" href="#Protocol-information">16.13 Protocol information</a></li>
<li><a name="toc-Network-information-1" href="#Network-information">16.14 Network information</a></li>
</ul></li>
<li><a name="toc-I_002fO-and-ports-1" href="#I_002fO-and-ports">17. I/O and ports</a>
<ul class="toc">
<li><a name="toc-Unidirectional-and-bidirectional-ports-1" href="#Unidirectional-and-bidirectional-ports">17.1 Unidirectional and bidirectional ports</a></li>
<li><a name="toc-Port-classes-1" href="#Port-classes">17.2 Port classes</a></li>
<li><a name="toc-Port-settings-1" href="#Port-settings">17.3 Port settings</a></li>
<li><a name="toc-Object_002dports-1" href="#Object_002dports">17.4 Object-ports</a>
<ul class="toc">
<li><a name="toc-Object_002dport-settings-1" href="#Object_002dport-settings">17.4.1 Object-port settings</a></li>
<li><a name="toc-Object_002dport-operations-1" href="#Object_002dport-operations">17.4.2 Object-port operations</a></li>
</ul></li>
<li><a name="toc-Character_002dports-1" href="#Character_002dports">17.5 Character-ports</a>
<ul class="toc">
<li><a name="toc-Character_002dport-settings-1" href="#Character_002dport-settings">17.5.1 Character-port settings</a></li>
<li><a name="toc-Character_002dport-operations-1" href="#Character_002dport-operations">17.5.2 Character-port operations</a></li>
</ul></li>
<li><a name="toc-Byte_002dports-1" href="#Byte_002dports">17.6 Byte-ports</a>
<ul class="toc">
<li><a name="toc-Byte_002dport-settings-1" href="#Byte_002dport-settings">17.6.1 Byte-port settings</a></li>
<li><a name="toc-Byte_002dport-operations-1" href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></li>
</ul></li>
<li><a name="toc-Device_002dports-1" href="#Device_002dports">17.7 Device-ports</a>
<ul class="toc">
<li><a name="toc-Filesystem-devices-1" href="#Filesystem-devices">17.7.1 Filesystem devices</a></li>
<li><a name="toc-Process-devices-1" href="#Process-devices">17.7.2 Process devices</a></li>
<li><a name="toc-Network-devices-1" href="#Network-devices">17.7.3 Network devices</a></li>
</ul></li>
<li><a name="toc-Directory_002dports-1" href="#Directory_002dports">17.8 Directory-ports</a></li>
<li><a name="toc-Vector_002dports-1" href="#Vector_002dports">17.9 Vector-ports</a></li>
<li><a name="toc-String_002dports-1" href="#String_002dports">17.10 String-ports</a></li>
<li><a name="toc-U8vector_002dports-1" href="#U8vector_002dports">17.11 U8vector-ports</a></li>
<li><a name="toc-Other-procedures-related-to-I_002fO-1" href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></li>
</ul></li>
<li><a name="toc-Lexical-syntax-and-readtables-1" href="#Lexical-syntax-and-readtables">18. Lexical syntax and readtables</a>
<ul class="toc">
<li><a name="toc-Readtables-1" href="#Readtables">18.1 Readtables</a></li>
<li><a name="toc-Boolean-syntax-1" href="#Boolean-syntax">18.2 Boolean syntax</a></li>
<li><a name="toc-Character-syntax-1" href="#Character-syntax">18.3 Character syntax</a></li>
<li><a name="toc-String-syntax-1" href="#String-syntax">18.4 String syntax</a></li>
<li><a name="toc-Symbol-syntax-1" href="#Symbol-syntax">18.5 Symbol syntax</a></li>
<li><a name="toc-Keyword-syntax-1" href="#Keyword-syntax">18.6 Keyword syntax</a></li>
<li><a name="toc-Box-syntax-1" href="#Box-syntax">18.7 Box syntax</a></li>
<li><a name="toc-Number-syntax-1" href="#Number-syntax">18.8 Number syntax</a></li>
<li><a name="toc-Homogeneous-vector-syntax-1" href="#Homogeneous-vector-syntax">18.9 Homogeneous vector syntax</a></li>
<li><a name="toc-Special-_0023_0021-syntax-1" href="#Special-_0023_0021-syntax">18.10 Special <code>#!</code> syntax</a></li>
<li><a name="toc-Multiline-comment-syntax-1" href="#Multiline-comment-syntax">18.11 Multiline comment syntax</a></li>
<li><a name="toc-Scheme-infix-syntax-extension-1" href="#Scheme-infix-syntax-extension">18.12 Scheme infix syntax extension</a>
<ul class="toc">
<li><a name="toc-SIX-grammar" href="#SIX-grammar">18.12.1 SIX grammar</a></li>
<li><a name="toc-SIX-semantics" href="#SIX-semantics">18.12.2 SIX semantics</a></li>
</ul>
</li>
</ul></li>
<li><a name="toc-C_002dinterface-1" href="#C_002dinterface">19. C-interface</a>
<ul class="toc">
<li><a name="toc-The-mapping-of-types-between-C-and-Scheme" href="#mapping-of-types">19.1 The mapping of types between C and Scheme</a></li>
<li><a name="toc-The-c_002ddeclare-special-form" href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></li>
<li><a name="toc-The-c_002dinitialize-special-form" href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></li>
<li><a name="toc-The-c_002dlambda-special-form" href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></li>
<li><a name="toc-The-c_002ddefine-special-form" href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></li>
<li><a name="toc-The-c_002ddefine_002dtype-special-form" href="#c_002ddefine_002dtype">19.6 The <code>c-define-type</code> special form</a></li>
<li><a name="toc-Continuations-and-the-C_002dinterface" href="#continuations">19.7 Continuations and the C-interface</a></li>
</ul></li>
<li><a name="toc-System-limitations-1" href="#System-limitations">20. System limitations</a></li>
<li><a name="toc-Copyright-and-license-1" href="#Copyright-and-license">21. Copyright and license</a></li>
<li><a name="toc-General-index-1" href="#General-index">General index</a></li>
</ul>
</div>
<hr size="1">
<a name="SEC_About"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#General-index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1>About This Document</h1>
<p>
This document was generated by <em>Marc Feeley</em> on <em>February 5, 2019</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</p>
<p>
The buttons in the navigation panels have the following meaning:
</p>
<table border="1">
<tr>
<th> Button </th>
<th> Name </th>
<th> Go to </th>
<th> From 1.2.3 go to</th>
</tr>
<tr>
<td align="center"> [ < ] </td>
<td align="center">Back</td>
<td>Previous section in reading order</td>
<td>1.2.2</td>
</tr>
<tr>
<td align="center"> [ > ] </td>
<td align="center">Forward</td>
<td>Next section in reading order</td>
<td>1.2.4</td>
</tr>
<tr>
<td align="center"> [ << ] </td>
<td align="center">FastBack</td>
<td>Beginning of this chapter or previous chapter</td>
<td>1</td>
</tr>
<tr>
<td align="center"> [ Up ] </td>
<td align="center">Up</td>
<td>Up section</td>
<td>1.2</td>
</tr>
<tr>
<td align="center"> [ >> ] </td>
<td align="center">FastForward</td>
<td>Next chapter</td>
<td>2</td>
</tr>
<tr>
<td align="center"> [Top] </td>
<td align="center">Top</td>
<td>Cover (top) of document</td>
<td> </td>
</tr>
<tr>
<td align="center"> [Contents] </td>
<td align="center">Contents</td>
<td>Table of contents</td>
<td> </td>
</tr>
<tr>
<td align="center"> [Index] </td>
<td align="center">Index</td>
<td>Index</td>
<td> </td>
</tr>
<tr>
<td align="center"> [ ? ] </td>
<td align="center">About</td>
<td>About (help)</td>
<td> </td>
</tr>
</table>
<p>
where the <strong> Example </strong> assumes that the current position is at <strong> Subsubsection One-Two-Three </strong> of a document of the following structure:
</p>
<ul>
<li> 1. Section One
<ul>
<li>1.1 Subsection One-One
<ul>
<li>...</li>
</ul>
</li>
<li>1.2 Subsection One-Two
<ul>
<li>1.2.1 Subsubsection One-Two-One</li>
<li>1.2.2 Subsubsection One-Two-Two</li>
<li>1.2.3 Subsubsection One-Two-Three
<strong><== Current Position </strong></li>
<li>1.2.4 Subsubsection One-Two-Four</li>
</ul>
</li>
<li>1.3 Subsection One-Three
<ul>
<li>...</li>
</ul>
</li>
<li>1.4 Subsection One-Four</li>
</ul>
</li>
</ul>
<hr size="1">
<p>
<font size="-1">
This document was generated by <em>Marc Feeley</em> on <em>February 5, 2019</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</font>
<br>
</p>
</body>
</html>
|