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
|
<a href = "part18.html">Previous Section</a> | <a href = "indx.html">Next Section (Index)</a> | <a href = "title.html#toc">Table of Contents</a> | <a href = "title.html">Title Page</a>
<hr>
<html><head><title>Appendix 3: XLISP: An Object-oriented Lisp</title>
<link rel="stylesheet" type="text/css" href="nyquiststyle.css">
</head>
<a name = "227"><h2>Appendix 3: XLISP: An Object-oriented Lisp</h2></a>
<blockquote>
<p>
<b>Version 2.0</b>
<p>
February 6, 1988
<p>
by<br>
<b>David Michael Betz</b><br>
127 Taylor Road<br>
Peterborough, NH 03458
<p>
Copyright (c) 1988, by David Michael Betz<br>
All Rights Reserved<br>
Permission is granted for unrestricted non-commercial use<br>
</blockquote>
<a name = "228"><h3>Introduction</h3></a>
XLISP is an experimental programming language combining some of
the features of Common Lisp with an object-oriented extension
capability. It was implemented to allow experimentation with
object-oriented programming on small computers.
<p>
Implementations of XLISP run on virtually every operating system.
XLISP is completely written in the programming language
C and is easily extended with user written built-in functions
and classes. It is available in source form to non-commercial
users.
<p>
Many Common Lisp functions are built into XLISP. In addition,
XLISP defines the objects Object and Class as primitives.
Object is the only class that has no superclass and hence is
the root of the class hierarchy tree. Class is the class of
which all classes are instances (it is the only object that is
an instance of itself).
<p>
This document is a brief description of XLISP. It assumes some
knowledge of LISP and some understanding of the concepts of
object-oriented programming.
<p>
I recommend the book <i>Lisp</i> by Winston and Horn and published by
Addison Wesley for learning Lisp. The first edition of this
book is based on MacLisp and the second edition is based on
Common Lisp.
<p>
You will probably also need a copy of <i>Common Lisp: The
Language</i> by Guy L. Steele, Jr., published by Digital Press to
use as a reference for some of the Common Lisp functions that
are described only briefly in this document.
<p>
<a name = "229"><h3>A Note From The Author</h3></a>
<p>
If you have any problems with XLISP, feel free to contact me [me being David Betz - RBD] for
help or advice. Please remember that since XLISP is available
in source form in a high level language, many users [e.g. that Dannenberg fellow - RBD] have been
making versions available on a variety of machines. If you call
to report a problem with a specific version, I may not be able
to help you if that version runs on a machine to which I don't
have access. Please have the version number of the version that
you are running readily accessible before calling me.
<p>
If you find a bug in XLISP, first try to fix the bug yourself
using the source code provided. If you are successful in fixing
the bug, send the bug report along with the fix to me. If you
don't have access to a C compiler or are unable to fix a bug,
please send the bug report to me and I'll try to fix it.
<p>
Any suggestions for improvements will be welcomed. Feel free to
extend the language in whatever way suits your needs. However,
PLEASE DO NOT RELEASE ENHANCED VERSIONS WITHOUT CHECKING WITH ME
FIRST!! I would like to be the clearing house for new features
added to XLISP. If you want to add features for your own
personal use, go ahead. But, if you want to distribute your
enhanced version, contact me first. Please remember that the
goal of XLISP is to provide a language to learn and experiment
with LISP and object-oriented programming on small computers. I
don't want it to get so big that it requires megabytes of memory
to run.
<p>
<a name = "230"><h3>XLISP Command Loop</h3></a><a name="index1410"></a><a name="index1411"></a>
<p>
When XLISP is started, it first tries to load the workspace
<code>xlisp.wks</code> from the current directory. If that file doesn't
exist, XLISP builds an initial workspace, empty except for the
built-in functions and symbols.
<p>
Then XLISP attempts to load <code>init.lsp</code> from the current
directory. It then loads any files named as parameters on the
command line (after appending <code>.lsp</code> to their names).
<p>
XLISP then issues the following prompt:
<p><pre>
>
</pre></p>
This indicates that XLISP is waiting for an expression to be
typed.
<p>
When a complete expression has been entered, XLISP attempts to
evaluate that expression. If the expression evaluates
successfully, XLISP prints the result and then returns to the
initial prompt waiting for another expression to be typed.
<p>
<a name = "231"><h3>Special Characters</h3></a><a name="index1412"></a>
<p>
When XLISP is running from a console, some control characters invoke operations:
<ul>
<li>
Backspace and Delete characters erase the previous character on the input line (if any).
<li>Control-U erases the entire input line.
<li>Control-C executes the TOP-LEVEL function.
<li>Control-G executes the CLEAN-UP function.
<li>Control-P executes the CONTINUE function.
<li>Control-B stops execution and enters the break command loop. Execution can be continued by typing Control-P or (CONTINUE).
<li>Control-E turns on character echoing (Linux and Mac OS X only).
<li>Control-F turns off character echoing (Linux and Mac OS X only).
<li>Control-T evaluates the INFO function.
</ul>
<p>
<a name = "232"><h3>Break Command Loop</h3></a><a name="index1413"></a>
<p>
When XLISP encounters an error while evaluating an expression,
it attempts to handle the error in the following way:
<p>
If the symbol <code>*breakenable*<a name="index1414"></a></code> is
true, the message corresponding to the error is printed. If
the error is correctable, the correction message is printed.
<p>
If the symbol <code>*tracenable*<a name="index1415"></a></code> is true, a trace back is printed.
The number of entries printed depends on the value of the symbol
<code>*tracelimit*<a name="index1416"></a></code>. If this symbol is set to something other than a
number, the entire trace back stack is printed.
<p>
XLISP then enters a read/eval/print loop to allow the user to
examine the state of the interpreter in the context of the
error. This loop differs from the normal top-level
read/eval/print loop in that if the user invokes the function
<code>continue</code>, XLISP will continue from a correctable error. If
the user invokes the function <code>clean-up</code>, XLISP will abort the
break loop and return to the top level or the next lower
numbered break loop. When in a break loop, XLISP prefixes the
break level to the normal prompt.
<p>
If the symbol <code>*breakenable*<a name="index1417"></a></code> is <code>nil</code>, XLISP looks for a
surrounding errset function. If one is found, XLISP examines
the value of the print flag. If this flag is true, the error
message is printed. In any case, XLISP causes the errset
function call to return <code>nil</code>.
<p>
If there is no surrounding errset function, XLISP prints the
error message and returns to the top level.
<p>
<a name = "233"><h3>Data Types</h3></a><a name="index1418"></a><a name="index1419"></a>
<p>
There are several different data types available to XLISP
programmers.
<p>
<ul>
<li>
lists
<li>symbols
<li>strings
<li>integers
<li>characters
<li>floats
<li>objects
<li>arrays
<li>streams
<li>subrs (built-in functions)
<li>fsubrs (special forms)
<li>closures (user defined functions)
</ul>
<p>
<a name = "234"><h3>The Evaluator</h3></a><a name="index1420"></a><a name="index1421"></a>
<p>
The process of evaluation in XLISP:
<ul>
<li>
Strings, integers, characters, floats, objects, arrays, streams,
subrs, fsubrs and closures evaluate to themselves.
<li> Symbols act as variables and are evaluated by retrieving the
value associated with their current binding.
<li> Lists are evaluated by examining the first element of the list
and then taking one of the following actions:
<ul>
<li>
If it is a symbol, the functional binding of the symbol is
retrieved.
<li> If it is a lambda expression, a closure is constructed for
the function described by the lambda expression.
<li> If it is a subr, fsubr or closure, it stands for itself.
<li> Any other value is an error.
</ul>
Then, the value produced by the previous step is examined:
<ul>
<li>
If it is a subr or closure, the remaining list elements are
evaluated and the subr or closure is called with these
evaluated expressions as arguments.
<li> If it is an fsubr, the fsubr is called using the remaining
list elements as arguments (unevaluated).
<li> If it is a macro, the macro is expanded using the remaining
list elements as arguments (unevaluated). The macro
expansion is then evaluated in place of the original macro
call.
</ul>
</ul>
<p>
<a name = "235"><h3>Lexical Conventions</h3></a><a name="index1422"></a><a name="index1423"></a>
<p>
The following conventions must be followed when entering XLISP
programs:
<p>
Comments in XLISP code begin with a semi-colon character and
continue to the end of the line.
<p>
Symbol names in XLISP can consist of any sequence of non-blank
printable characters except the following:
<p><pre>
( ) ' ` , " ;
</pre></p>
Uppercase and lowercase characters are not distinguished within
symbol names. All lowercase characters are mapped to uppercase
on input.
<p>
Integer literals consist of a sequence of digits optionally
beginning with a <code>+</code> or <code>-</code>. The range of values an integer can
represent is limited by the size of a C <code>long</code> on the machine on
which XLISP is running.
<p>
Floating point literals consist of a sequence of digits
optionally beginning with a <code>+</code> or <code>-</code> and including an embedded
decimal point. The range of values a floating point number can
represent is limited by the size of a C <code>float</code> (<code>double</code> on
machines with 32 bit addresses) on the machine on which XLISP is
running.
<p>
Literal strings are sequences of characters surrounded by double
quotes. Within quoted strings the "<code>\</code>" character is used to
allow non-printable characters to be included. The codes
recognized are:
<ul>
<li>
<code>\\</code> means the character "<code>\</code>"
<li><code>\n</code> means newline
<li><code>\t</code> means tab
<li><code>\r</code> means return
<li><code>\f</code> means form feed
<li><code>\nnn</code> means the character whose octal code is nnn
</ul>
<p>
<a name = "236"><h3>Readtables</h3></a><a name="index1424"></a>
<p>
The behavior of the reader is controlled by a data structure
called a <i>readtable</i>. The reader uses the symbol <code>*readtable*<a name="index1425"></a></code> to
locate the current readtable. This table controls the
interpretation of input characters. It is an array with 128
entries, one for each of the ASCII character codes. Each entry
contains one of the following things:
<ul>
<li>
<code>NIL</code> – Indicating an invalid character
<li> <code>:CONSTITUENT</code> – Indicating a symbol constituent
<li> <code>:WHITE-SPACE</code> – Indicating a whitespace character
<li> <code>(:TMACRO . <i>fun</i>)</code> – Terminating readmacro
<li> <code>(:NMACRO . <i>fun</i>)</code> – Non-terminating readmacro
<li> <code>:SESCAPE</code> – Single escape character ('\')
<li> <code>:MESCAPE</code> – Multiple escape character ('|')
</ul>
<p>
In the case of <code>:TMACRO</code> and <code>:NMACRO</code>, the <i>fun</i> component is a
function. This can either be a built-in readmacro function or a
lambda expression. The function should take two parameters.
The first is the input stream and the second is the character
that caused the invocation of the readmacro. The readmacro
function should return <code>NIL</code> to indicate that the character should
be treated as white space or a value consed with <code>NIL</code> to indicate
that the readmacro should be treated as an occurence of the
specified value. Of course, the readmacro code is free to read
additional characters from the input stream.
<p>
XLISP defines several useful read macros<a name="index1426"></a>:
<ul>
<li>
<code>'</code><i><expr></i> == <code>(quote</code> <i><expr></i><code>)</code>
<li> <code>#'</code><i><expr></i> == <code>(function</code> <i><expr></i><code>)</code>
<li> <code>#(</code><i><expr></i>...<code>)</code> == an array of the specified expressions
<li> <code>#x</code><i><hdigits></i> == a hexadecimal number (0-9,A-F)
<li> <code>#o</code><i><odigits></i> == an octal number (0-7)
<li> <code>#b</code><i><bdigits></i> == a binary number (0-1)
<li> <code>#\</code><i><char></i> == the ASCII code of the character
<li> <code>#|</code> ... <code>|#</code> == a comment
<li> <code>#:</code><i><symbol></i> == an uninterned symbol
<li> <code>`</code><i><expr></i> == <code>(backquote</code> <i><expr></i><code>)</code>
<li> <code>,</code><i><expr></i> == <code>(comma</code> <i><expr></i><code>)</code>
<li> <code>,@</code><i><expr></i> == <code>(comma-at</code> <i><expr></i><code>)</code></ul>
<a name = "237"><h3>Lambda Lists</h3></a><a name="index1427"></a>
<p>
There are several forms in XLISP that require that a "lambda
list" be specified. A lambda list is a definition of the
arguments accepted by a function. There are four different
types of arguments.
<p>
The lambda list starts with required arguments. Required
arguments must be specified in every call to the function.
<p>
The required arguments are followed by the <code>&optional</code> arguments.
Optional arguments may be provided or omitted in a call. An
initialization expression may be specified to provide a default
value for an <code>&optional</code> argument if it is omitted from a call.
If no initialization expression is specified, an omitted
argument is initialized to <code>NIL</code>. It is also possible to provide
the name of a <code>supplied-p</code> variable that can be used to
determine if a call provided a value for the argument or if the
initialization expression was used. If specified, the supplied-
p variable will be bound to T if a value was specified in the
call and <code>NIL</code> if the default value was used.
<p>
The <code>&optional</code> arguments are followed by the <code>&rest</code> argument. The
<code>&rest</code> argument gets bound to the remainder of the argument list
after the required and <code>&optional</code> arguments have been removed.
<p>
The <code>&rest</code> argument is followed by the <code>&key</code> arguments. When a
keyword argument is passed to a function, a pair of values
appears in the argument list. The first expression in the pair
should evaluate to a keyword symbol (a symbol that begins with a
"<code>:</code>"). The value of the second expression is the value of the
keyword argument. Like <code>&optional</code> arguments, <code>&key</code> arguments can
have initialization expressions and supplied-p variables. In
addition, it is possible to specify the keyword to be used in a
function call. If no keyword is specified, the keyword obtained
by adding a "<code>:</code>" to the beginning of the keyword argument symbol
is used. In other words, if the keyword argument symbol is
<code>foo</code>, the keyword will be <code>:foo</code>.
<p>
The <code>&key</code> arguments are followed by the <code>&aux</code> variables. These
are local variables that are bound during the evaluation of the
function body. It is possible to have initialization
expressions for the <code>&aux</code> variables.
<p>
Here is the complete syntax for lambda lists:
<blockquote>
(<i>rarg</i>...<br>
[<code>&optional</code> [<i>oarg</i> | (<i>oarg</i> [<i>init</i> [<i>svar</i>]])]...]<br>
[<code>&rest</code> <i>rarg</i>]<br>
[<code>&key</code><br>
[<i>karg</i> | ([<i>karg</i> | (<i>key</i> <i>karg</i>)] [<i>init</i> [<i>svar</i>]])]...<br>
<code>&allow</code>-other-keys]<br>
[<code>&aux</code><br>
[<i>aux</i> | (<i>aux</i> [<i>init</i>])]...])
<p>
where:
<p>
<i>rarg</i> is a required argument symbol<br>
<i>oarg</i> is an <code>&optional</code> argument symbol<br>
<i>rarg</i> is the <code>&rest</code> argument symbol<br>
<i>karg</i> is a <code>&key</code> argument symbol<br>
<i>key</i> is a keyword symbol<br>
<i>aux</i> is an auxiliary variable symbol<br>
<i>init</i> is an initialization expression<br>
<i>svar</i> is a supplied-p variable symbol </blockquote>
<a name = "238"><h3>Objects</h3></a><a name="index1428"></a>
Definitions:
<ul>
<li>
selector – a symbol used to select an appropriate method
<li>message – a selector and a list of actual arguments
<li>method – the code that implements a message
</ul>
Since XLISP was created to provide a simple basis for
experimenting with object-oriented programming, one of the
primitive data types included is <i>object</i>. In XLISP, an object
consists of a data structure containing a pointer to the
object's class as well as an array containing the values of the
object's instance variables.
<p>
Officially, there is no way to see inside an object (look at the
values of its instance variables). The only way to communicate
with an object is by sending it a message.
<p>
You can send a message to an object using the <code>send</code> function.
This function takes the object as its first argument, the
message selector as its second argument (which must be a symbol)
and the message arguments as its remaining arguments.
<p>
The <code>send</code> function determines the class of the receiving object
and attempts to find a method corresponding to the message
selector in the set of messages defined for that class. If the
message is not found in the object's class and the class has a
super-class, the search continues by looking at the messages
defined for the super-class. This process continues from one
super-class to the next until a method for the message is found.
If no method is found, an error occurs.
<p>
<p>
When a method is found, the evaluator binds the receiving object
to the symbol <code>self</code> and evaluates the method using the
remaining elements of the original list as arguments to the
method. These arguments are always evaluated prior to being
bound to their corresponding formal arguments. The result of
evaluating the method becomes the result of the expression.
<p>
Within the body of a method, a message can be sent to the current
object by calling the <code>(send self ...)</code>. The method lookup
starts with the object's class regardless of the class containing
the current method.
<p>
Sometimes it is desirable to invoke a general method in a superclass
even when it is overridden by a more specific method in a subclass.
This can be accomplished by calling <code>send-super</code>, which begins
the method lookup in the superclass of the class defining the current
method rather than in the class of the current object.
<p>
The <code>send-super</code> function takes a selector as its first argument
(which must be a symbol) and the message arguments as its remaining
arguments. Notice that <code>send-super</code> can only be sent from within
a method, and the target of the message is always the current object
(<code>self</code>). <code>(send-super ...)</code> is similar to
<code>(send self ...)</code> except that method lookup begins in the
superclass of the class containing the current method
rather than the class of the current object.
<p>
<a name = "239"><h3>The "Object" Class</h3></a><a name="index1429"></a>
<p>
<code>Object</code><a name="index1430"></a> – the top of the class hierarchy.
<p>
Messages:
<div style="padding-left: 0em;">
<code>:show<a name="index1431"></a></code> – show an object's instance variables.
</div><div style="padding-left: 2em;">
returns – the object<br>
</div>
<br>
<code>:class<a name="index1432"></a></code> – return the class of an object
</div><div style="padding-left: 2em;">
returns – the class of the object<br>
</div>
<br>
<code>:isa<a name="index1433"></a></code> <i>class</i> – test if object inherits from class
</div><div style="padding-left: 2em;">
returns – <code>t</code> if object is an instance of <i>class</i> or a subclass of <i>class</i>, otherwise <code>nil</code><br>
</div>
<br>
<code>:isnew<a name="index1434"></a></code> – the default object initialization routine
</div><div style="padding-left: 2em;">
returns – the object<br>
</div>
</div>
<p>
<a name = "240"><h3>The "Class" Class</h3></a><a name="index1435"></a>
<p>
<code>Class<a name="index1436"></a></code> – class of all object classes (including itself)
<p>
Messages:
<div style="padding-left: 0em;">
<code>:new<a name="index1437"></a></code> – create a new instance of a class
</div><div style="padding-left: 2em;">
returns – the new class object<br>
</div>
<br>
<code>:isnew<a name="index1438"></a></code> <i>ivars</i> [<i>cvars</i> [<i>super</i>]] – initialize a new class
</div><div style="padding-left: 2em;">
<i>ivars</i> – the list of instance variable symbols</div>
<div style="padding-left: 2em;"> <i>cvars</i> – the list of class variable symbols</div>
<div style="padding-left: 2em;"> <i>super</i> – the superclass (default is object)</div>
<div style="padding-left: 2em;"> returns – the new class object<br>
</div>
<br>
<code>:answer<a name="index1439"></a></code> <i>msg</i> <i>fargs</i> <i>code</i> – add a message to a class
</div><div style="padding-left: 2em;">
<i>msg</i> – the message symbol</div>
<div style="padding-left: 2em;"> <i>fargs</i> – the formal argument list (lambda list)</div>
<div style="padding-left: 2em;"> <i>code</i> – a list of executable expressions</div>
<div style="padding-left: 2em;"> returns – the object<br>
</div>
</div>
<p>
When a new instance of a class is created by sending the message
<code>:new</code> to an existing class, the message <code>:isnew</code> followed by
whatever parameters were passed to the <code>:new</code> message is sent to
the newly created object.
<p>
When a new class is created by sending the <code>:new</code> message to the
object <code>Class</code>, an optional parameter may be specified
indicating the superclass of the new class. If this parameter
is omitted, the new class will be a subclass of <code>Object</code>. A
class inherits all instance variables, class variables, and
methods from its super-class.
<p>
<a name = "241"><h3>Profiling</h3></a><a name="index1440"></a>
The Xlisp 2.0 release has been extended with a profiling facility, which counts how many times and where <code>eval</code> is executed. A separate count is maintained for each named function, closure, or macro, and a count indicates an <code>eval</code> in the immediately (lexically) enclosing named function, closure, or macro. Thus, the count gives an indication of the amount of time spent in a function, not counting nested function calls. The list of all functions executed is maintained on the global <code>*profile*</code> variable. These functions in turn have <code>*profile*</code> properties, which maintain the counts. The profile system merely increments counters and puts symbols on the <code>*profile*</code> list. It is up to the user to initialize data and gather results. Profiling is turned on or off with the <code>profile</code> function. Unfortunately, methods cannot be profiled with this facility.
<p>
<a name = "242"><h3>Symbols</h3></a><a name="index1441"></a>
<ul>
<li>
<code>self</code><a name="index1442"></a> - the current object (within a method context)
<li><code>*obarray*<a name="index1443"></a></code> - the object hash table
<li><code>*standard-input*<a name="index1444"></a></code> - the standard input stream
<li><code>*standard-output*<a name="index1445"></a></code> - the standard output stream
<li><code>*error-output*<a name="index1446"></a></code> - the error output stream
<li><code>*trace-output*<a name="index1447"></a></code> - the trace output stream
<li><code>*debug-io*<a name="index1448"></a></code> - the debug i/o stream
<li><code>*breakenable*<a name="index1449"></a></code> - flag controlling entering break loop on errors
<li><code>*tracelist*<a name="index1450"></a></code> - list of names of functions to trace
<li><code>*tracenable*<a name="index1451"></a></code> - enable trace back printout on errors
<li><code>*tracelimit*<a name="index1452"></a></code> - number of levels of trace back information
<li><code>*evalhook*<a name="index1453"></a></code> - user substitute for the evaluator function
<li><code>*applyhook*<a name="index1454"></a></code> - (not yet implemented)
<li><code>*readtable*<a name="index1455"></a></code> - the current readtable
<li><code>*unbound*<a name="index1456"></a></code> - indicator for unbound symbols
<li><code>*gc-flag*<a name="index1457"></a></code> - controls the printing of gc messages
<li><code>*gc-hook*<a name="index1458"></a></code> - function to call after garbage collection
<li><code>*integer-format*<a name="index1459"></a></code> - format for printing integers ("%d" or "%ld")
<li><code>*float-format*<a name="index1460"></a></code> - format for printing floats ("%g")
<li><code>*print-case*<a name="index1461"></a></code> - symbol output case (:upcase or :downcase)
</ul>
<p>
There are several symbols maintained by the read/eval/print
loop. The symbols <code>+</code>, <code>++</code>, and <code>+++</code> are bound to the most
recent three input expressions. The symbols <code>*</code>, <code>**</code> and <code>***</code>
are bound to the most recent three results. The symbol <code>-</code> is
bound to the expression currently being evaluated. It becomes
the value of <code>+</code> at the end of the evaluation.
<a name = "243"><h3>Evaluation Functions</h3></a><a name="index1462"></a>
<div style="padding-left: 0em;">
<code>eval<a name="index1463"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(eval <tt><i>expr</i></tt>)</code> [LISP] – evaluate an xlisp expression<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to be evaluated</div>
<div style="padding-left: 2em;"> returns – the result of evaluating the expression<br>
</div>
<br>
<code>apply<a name="index1464"></a>(<i>fun</i>, <i>args</i>)</code> [SAL]<br>
<code>(apply <tt><i>fun</i></tt> <tt><i>args</i></tt>)</code> [LISP] – apply a function to a list of arguments<br>
</div><div style="padding-left: 2em;">
<i>fun</i> – the function to apply (or function symbol)</div>
<div style="padding-left: 2em;"> <i>args</i> – the argument list</div>
<div style="padding-left: 2em;"> returns – the result of applying the function to the arguments<br>
</div>
<br>
<code>funcall<a name="index1465"></a>(<i>fun</i>, <i>arg</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(funcall <tt><i>fun</i></tt> <tt><i>arg</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – call a function with arguments<br>
</div><div style="padding-left: 2em;">
<i>fun</i> – the function to call (or function symbol)</div>
<div style="padding-left: 2em;"> <i>arg</i> – arguments to pass to the function</div>
<div style="padding-left: 2em;"> returns – the result of calling the function with the arguments<br>
</div>
<br>
<code>quote<a name="index1466"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(quote <tt><i>expr</i></tt>)</code> [LISP] – return an expression unevaluated<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to be quoted (quoted)</div>
<div style="padding-left: 2em;"> returns – <i>expr</i> unevaluated<br>
</div>
<br>
<code>function<a name="index1467"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(function <tt><i>expr</i></tt>)</code> [LISP] – get the functional interpretation<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the symbol or lambda expression (quoted)</div>
<div style="padding-left: 2em;"> returns – the functional interpretation<br>
</div>
<br>
<code>backquote<a name="index1468"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(backquote <tt><i>expr</i></tt>)</code> [LISP] – fill in a template<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the template</div>
<div style="padding-left: 2em;"> returns – a copy of the template with comma and comma-at</div>
<div style="padding-left: 2em;"> expressions expanded<br>
</div>
<br>
<code>lambda<a name="index1469"></a>(<i>args</i>, <i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(lambda <tt><i>args</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – make a function closure<br>
</div><div style="padding-left: 2em;">
<i>args</i> – formal argument list (lambda list) (quoted)</div>
<div style="padding-left: 2em;"> <i>expr</i> – expressions of the function body</div>
<div style="padding-left: 2em;"> returns – the function closure<br>
</div>
<br>
<code>get-lambda-expression<a name="index1470"></a>(<i>closure</i>)</code> [SAL]<br>
<code>(get-lambda-expression <tt><i>closure</i></tt>)</code> [LISP] – get the lambda expression<br>
</div><div style="padding-left: 2em;">
<i>closure</i> – the closure</div>
<div style="padding-left: 2em;"> returns – the original lambda expression<br>
</div>
<br>
<code>macroexpand<a name="index1471"></a>(<i>form</i>)</code> [SAL]<br>
<code>(macroexpand <tt><i>form</i></tt>)</code> [LISP] – recursively expand macro calls<br>
</div><div style="padding-left: 2em;">
<i>form</i> – the form to expand</div>
<div style="padding-left: 2em;"> returns – the macro expansion<br>
</div>
<br>
<code>macroexpand-1<a name="index1472"></a>(<i>form</i>)</code> [SAL]<br>
<code>(macroexpand-1 <tt><i>form</i></tt>)</code> [LISP] – expand a macro call<br>
</div><div style="padding-left: 2em;">
<i>form</i> – the macro call form</div>
<div style="padding-left: 2em;"> returns – the macro expansion<br>
</div>
</div>
<p>
<a name = "244"><h3>Symbol Functions</h3></a><a name="index1473"></a>
<div style="padding-left: 0em;">
<code>(set<a name="index1474"></a> <tt><i>sym</i></tt> <tt><i>expr</i></tt>)</code> [LISP] – set the value of a symbol. Note that in SAL, the function can be accessed as <code>#set</code>.<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol being set</div>
<div style="padding-left: 2em;"> <i>expr</i> – the new value</div>
<div style="padding-left: 2em;"> returns – the new value<br>
</div>
<br>
<code>setq<a name="index1475"></a>([<i>sym</i>, <i>expr</i>]<span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(setq [<tt><i>sym</i></tt> <tt><i>expr</i></tt>]<span style="font-style:normal">...</span>)</code> [LISP] – set the value of a symbol. Note that in SAL, the <code>set</code> command is normally used.<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol being set (quoted)</div>
<div style="padding-left: 2em;"> <i>expr</i> – the new value</div>
<div style="padding-left: 2em;"> returns – the new value<br>
</div>
<br>
<code>psetq<a name="index1476"></a>([<i>sym</i>, <i>expr</i>]<span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(psetq [<tt><i>sym</i></tt> <tt><i>expr</i></tt>]<span style="font-style:normal">...</span>)</code> [LISP] – parallel version of setq<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol being set (quoted)</div>
<div style="padding-left: 2em;"> <i>expr</i> – the new value</div>
<div style="padding-left: 2em;"> returns – the new value<br>
</div>
<br>
<code>setf<a name="index1477"></a>([<i>place</i>, <i>expr</i>]<span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(setf [<tt><i>place</i></tt> <tt><i>expr</i></tt>]<span style="font-style:normal">...</span>)</code> [LISP] – set the value of a field<br>
</div><div style="padding-left: 2em;">
<i>place</i> – the field specifier (quoted):<br>
</div><div style="padding-left: 4em;">
<i>sym</i> – set value of a symbol</div>
<div style="padding-left: 4em;"> (car <i>expr</i>) – set car of a cons node</div>
<div style="padding-left: 4em;"> (cdr <i>expr</i>) – set cdr of a cons node</div>
<div style="padding-left: 4em;"> (nth <i>n</i> <i>expr</i>) – set nth car of a list</div>
<div style="padding-left: 4em;"> (aref <i>expr</i> <i>n</i>) – set nth element of an array</div>
<div style="padding-left: 4em;"> (get <i>sym</i> <i>prop</i>) – set value of a property</div>
<div style="padding-left: 4em;"> (symbol-value <i>sym</i>) – set value of a symbol</div>
<div style="padding-left: 4em;"> (symbol-function <i>sym</i>) – set functional value of a symbol</div>
<div style="padding-left: 4em;"> (symbol-plist <i>sym</i>) – set property list of a symbol<br>
</div></div>
<div style="padding-left: 2em;"> <i>expr</i> – the new value</div>
<div style="padding-left: 2em;"> returns – the new value<br>
</div>
<br>
<code>(defun<a name="index1478"></a> <tt><i>sym</i></tt> <tt><i>fargs</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – define a function<br>
<code>(defmacro<a name="index1479"></a> <tt><i>sym</i></tt> <tt><i>fargs</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – define a macro<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – symbol being defined (quoted)</div>
<div style="padding-left: 2em;"> <i>fargs</i> – formal argument list (lambda list) (quoted)</div>
<div style="padding-left: 2em;"> <i>expr</i> – expressions constituting the body of the</div>
<div style="padding-left: 2em;"> function (quoted)<br>
returns – the function symbol<br>
</div>
<br>
<code>gensym<a name="index1480"></a>([<i>tag</i>])</code> [SAL]<br>
<code>(gensym [<tt><i>tag</i></tt>])</code> [LISP] – generate a symbol<br>
</div><div style="padding-left: 2em;">
<i>tag</i> – string or number</div>
<div style="padding-left: 2em;"> returns – the new symbol<br>
</div>
<br>
<code>intern<a name="index1481"></a>(<i>pname</i>)</code> [SAL]<br>
<code>(intern <tt><i>pname</i></tt>)</code> [LISP] – make an interned symbol<br>
</div><div style="padding-left: 2em;">
<i>pname</i> – the symbol's print name string</div>
<div style="padding-left: 2em;"> returns – the new symbol<br>
</div>
<br>
<code>make-symbol<a name="index1482"></a>(<i>pname</i>)</code> [SAL]<br>
<code>(make-symbol <tt><i>pname</i></tt>)</code> [LISP] – make an uninterned symbol<br>
</div><div style="padding-left: 2em;">
<i>pname</i> – the symbol's print name string</div>
<div style="padding-left: 2em;"> returns – the new symbol<br>
</div>
<br>
<code>symbol-name<a name="index1483"></a>(<i>sym</i>)</code> [SAL]<br>
<code>(symbol-name <tt><i>sym</i></tt>)</code> [LISP] – get the print name of a symbol<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol</div>
<div style="padding-left: 2em;"> returns – the symbol's print name<br>
</div>
<br>
<code>symbol-value<a name="index1484"></a>(<i>sym</i>)</code> [SAL]<br>
<code>(symbol-value <tt><i>sym</i></tt>)</code> [LISP] – get the value of a symbol<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol</div>
<div style="padding-left: 2em;"> returns – the symbol's value<br>
</div>
<br>
<code>symbol-function<a name="index1485"></a>(<i>sym</i>)</code> [SAL]<br>
<code>(symbol-function <tt><i>sym</i></tt>)</code> [LISP] – get the functional value of a symbol<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol</div>
<div style="padding-left: 2em;"> returns – the symbol's functional value<br>
</div>
<br>
<code>symbol-plist<a name="index1486"></a>(<i>sym</i>)</code> [SAL]<br>
<code>(symbol-plist <tt><i>sym</i></tt>)</code> [LISP] – get the property list of a symbol<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol</div>
<div style="padding-left: 2em;"> returns – the symbol's property list<br>
</div>
<br>
<code>hash<a name="index1487"></a>(<i>sym</i>, <i>n</i>)</code> [SAL]<br>
<code>(hash <tt><i>sym</i></tt> <tt><i>n</i></tt>)</code> [LISP] – compute the hash index for a symbol<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol or string</div>
<div style="padding-left: 2em;"> <i>n</i> – the table size (integer)</div>
<div style="padding-left: 2em;"> returns – the hash index (integer)<br>
</div>
</div>
<p>
<a name = "245"><h3>Property List Functions</h3></a><a name="index1488"></a>
<div style="padding-left: 0em;">
<code>get<a name="index1489"></a>(<i>sym</i>, <i>prop</i>)</code> [SAL]<br>
<code>(get <tt><i>sym</i></tt> <tt><i>prop</i></tt>)</code> [LISP] – get the value of a property<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol</div>
<div style="padding-left: 2em;"> <i>prop</i> – the property symbol</div>
<div style="padding-left: 2em;"> returns – the property value or <code>nil</code><br>
</div>
<br>
<code>putprop<a name="index1490"></a>(<i>sym</i>, <i>val</i>, <i>prop</i>)</code> [SAL]<br>
<code>(putprop <tt><i>sym</i></tt> <tt><i>val</i></tt> <tt><i>prop</i></tt>)</code> [LISP] – put a property onto a property list<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol</div>
<div style="padding-left: 2em;"> <i>val</i> – the property value</div>
<div style="padding-left: 2em;"> <i>prop</i> – the property symbol</div>
<div style="padding-left: 2em;"> returns – the property value<br>
</div>
<br>
<code>remprop<a name="index1491"></a>(<i>sym</i>, <i>prop</i>)</code> [SAL]<br>
<code>(remprop <tt><i>sym</i></tt> <tt><i>prop</i></tt>)</code> [LISP] – remove a property<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol</div>
<div style="padding-left: 2em;"> <i>prop</i> – the property symbol</div>
<div style="padding-left: 2em;"> returns – <code>nil</code><br>
</div>
</div>
<p>
<a name = "246"><h3>Array Functions</h3></a><a name="index1492"></a>
<div style="padding-left: 0em;">
<code>aref<a name="index1493"></a>(<i>array</i>, <i>n</i>)</code> [SAL]<br>
<code>(aref <tt><i>array</i></tt> <tt><i>n</i></tt>)</code> [LISP] – get the nth element of an array<br>
</div><div style="padding-left: 2em;">
<i>array</i> – the array</div>
<div style="padding-left: 2em;"> <i>n</i> – the array index (integer)</div>
<div style="padding-left: 2em;"> returns – the value of the array element<br>
</div>
<br>
<code>make-array<a name="index1494"></a>(<i>size</i>)</code> [SAL]<br>
<code>(make-array <tt><i>size</i></tt>)</code> [LISP] – make a new array<br>
</div><div style="padding-left: 2em;">
<i>size</i> – the size of the new array (integer)</div>
<div style="padding-left: 2em;"> returns – the new array<br>
</div>
<br>
<code>vector<a name="index1495"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(vector <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – make an initialized vector<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the vector elements</div>
<div style="padding-left: 2em;"> returns – the new vector<br>
</div>
</div>
<p>
<a name = "247"><h3>List Functions</h3></a><a name="index1496"></a>
<div style="padding-left: 0em;">
<code>car<a name="index1497"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(car <tt><i>expr</i></tt>)</code> [LISP] – return the car of a list node<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the list node</div>
<div style="padding-left: 2em;"> returns – the car of the list node<br>
</div>
<br>
<code>cdr<a name="index1498"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(cdr <tt><i>expr</i></tt>)</code> [LISP] – return the cdr of a list node<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the list node</div>
<div style="padding-left: 2em;"> returns – the cdr of the list node<br>
</div>
<br>
<code>c<i>xx</i>r(<i>expr</i>)</code> [SAL]<br>
<code>(c<i>xx</i>r<a name="index1499"></a> <tt><i>expr</i></tt>)</code> [LISP] – all c<i>xx</i>r combinations<br>
</div><div style="padding-left: 2em;">
</div>
<br>
<code>c<i>xxx</i>r(<i>expr</i>)</code> [SAL]<br>
<code>(c<i>xxx</i>r<a name="index1500"></a> <tt><i>expr</i></tt>)</code> [LISP] – all c<i>xxx</i>r combinations<br>
</div><div style="padding-left: 2em;">
</div>
<br>
<code>c<i>xxxx</i>r(<i>expr</i>)</code> [SAL]<br>
<code>(c<i>xxxx</i>r<a name="index1501"></a> <tt><i>expr</i></tt>)</code> [LISP] – all c<i>xxxx</i>r combinations<br>
</div><div style="padding-left: 2em;">
</div>
<br>
<code>first<a name="index1502"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(first <tt><i>expr</i></tt>)</code> [LISP] – a synonym for car<br>
</div><div style="padding-left: 2em;">
</div>
<br>
<code>second<a name="index1503"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(second <tt><i>expr</i></tt>)</code> [LISP] – a synonym for cadr<br>
</div><div style="padding-left: 2em;">
</div>
<br>
<code>third<a name="index1504"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(third <tt><i>expr</i></tt>)</code> [LISP] – a synonym for caddr<br>
</div><div style="padding-left: 2em;">
</div>
<br>
<code>fourth<a name="index1505"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(fourth <tt><i>expr</i></tt>)</code> [LISP] – a synonym for cadddr<br>
</div><div style="padding-left: 2em;">
</div>
<br>
<code>rest<a name="index1506"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(rest <tt><i>expr</i></tt>)</code> [LISP] – a synonym for cdr<br>
</div><div style="padding-left: 2em;">
</div>
<br>
<code>cons<a name="index1507"></a>(<i>expr1</i>, <i>expr2</i>)</code> [SAL]<br>
<code>(cons <tt><i>expr1</i></tt> <tt><i>expr2</i></tt>)</code> [LISP] – construct a new list node<br>
</div><div style="padding-left: 2em;">
<i>expr1</i> – the car of the new list node</div>
<div style="padding-left: 2em;"> <i>expr2</i> – the cdr of the new list node</div>
<div style="padding-left: 2em;"> returns – the new list node<br>
</div>
<br>
<code>list<a name="index1508"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(list <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – create a list of values<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – expressions to be combined into a list</div>
<div style="padding-left: 2em;"> returns – the new list<br>
</div>
<br>
<code>append<a name="index1509"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(append <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – append lists<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – lists whose elements are to be appended</div>
<div style="padding-left: 2em;"> returns – the new list<br>
</div>
<br>
<code>reverse<a name="index1510"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(reverse <tt><i>expr</i></tt>)</code> [LISP] – reverse a list<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the list to reverse</div>
<div style="padding-left: 2em;"> returns – a new list in the reverse order<br>
</div>
<br>
<code>last<a name="index1511"></a>(<i>list</i>)</code> [SAL]<br>
<code>(last <tt><i>list</i></tt>)</code> [LISP] – return the last list node of a list<br>
</div><div style="padding-left: 2em;">
<i>list</i> – the list</div>
<div style="padding-left: 2em;"> returns – the last list node in the list<br>
</div>
<br>
<code>member<a name="index1512"></a>(<i>expr</i>, <i>list</i>, test: <i>test</i>, test-not: <i>test-not</i>)</code> [SAL]<br>
<code>(member <tt><i>expr</i></tt> <tt><i>list</i></tt> <tt>&key </tt><tt>:test</tt> <tt>:test-not</tt>)</code> [LISP] – find an expression in a list<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to find</div>
<div style="padding-left: 2em;"> <i>list</i> – the list to search</div>
<div style="padding-left: 2em;"> :test – the test function (defaults to eql)</div>
<div style="padding-left: 2em;"> :test-not – the test function (sense inverted) </div>
<div style="padding-left: 2em;"> returns – the remainder of the list starting with the expression<br>
</div>
<br>
<code>assoc<a name="index1513"></a>(<i>expr</i>, <i>alist</i>, test: <i>test</i>, test-not: <i>test-not</i>)</code> [SAL]<br>
<code>(assoc <tt><i>expr</i></tt> <tt><i>alist</i></tt> <tt>&key </tt><tt>:test</tt> <tt>:test-not</tt>)</code> [LISP] – find an expression in an a-list<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to find</div>
<div style="padding-left: 2em;"> <i>alist</i> – the association list</div>
<div style="padding-left: 2em;"> :test – the test function (defaults to eql)</div>
<div style="padding-left: 2em;"> :test-not – the test function (sense inverted) </div>
<div style="padding-left: 2em;"> returns – the alist entry or <code>nil</code><br>
</div>
<br>
<code>remove<a name="index1514"></a>(<i>expr</i>, <i>list</i>, test: <i>test</i>, test-not: <i>test-not</i>)</code> [SAL]<br>
<code>(remove <tt><i>expr</i></tt> <tt><i>list</i></tt> <tt>&key </tt><tt>:test</tt> <tt>:test-not</tt>)</code> [LISP] – remove elements from a list<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the element to remove</div>
<div style="padding-left: 2em;"> <i>list</i> – the list</div>
<div style="padding-left: 2em;"> :test – the test function (defaults to eql)</div>
<div style="padding-left: 2em;"> :test-not – the test function (sense inverted) </div>
<div style="padding-left: 2em;"> returns – copy of list with matching expressions removed<br>
</div>
<br>
<code>remove-if<a name="index1515"></a>(<i>test</i>, <i>list</i>)</code> [SAL]<br>
<code>(remove-if <tt><i>test</i></tt> <tt><i>list</i></tt>)</code> [LISP] – remove elements that pass test<br>
</div><div style="padding-left: 2em;">
<i>test</i> – the test predicate</div>
<div style="padding-left: 2em;"> <i>list</i> – the list</div>
<div style="padding-left: 2em;"> returns – copy of list with matching elements removed<br>
</div>
<br>
<code>remove-if-not<a name="index1516"></a>(<i>test</i>, <i>list</i>)</code> [SAL]<br>
<code>(remove-if-not <tt><i>test</i></tt> <tt><i>list</i></tt>)</code> [LISP] – remove elements that fail test<br>
</div><div style="padding-left: 2em;">
<i>test</i> – the test predicate</div>
<div style="padding-left: 2em;"> <i>list</i> – the list</div>
<div style="padding-left: 2em;"> returns – copy of list with non-matching elements removed<br>
</div>
<br>
<code>length<a name="index1517"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(length <tt><i>expr</i></tt>)</code> [LISP] – find the length of a list, vector or string<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the list, vector or string</div>
<div style="padding-left: 2em;"> returns – the length of the list, vector or string<br>
</div>
<br>
<code>nth<a name="index1518"></a>(<i>n</i>, <i>list</i>)</code> [SAL]<br>
<code>(nth <tt><i>n</i></tt> <tt><i>list</i></tt>)</code> [LISP] – return the nth element of a list<br>
</div><div style="padding-left: 2em;">
<i>n</i> – the number of the element to return (zero origin)</div>
<div style="padding-left: 2em;"> <i>list</i> – the list</div>
<div style="padding-left: 2em;"> returns – the nth element or <code>nil</code> if the list isn't that long<br>
</div>
<br>
<code>nthcdr<a name="index1519"></a>(<i>n</i>, <i>list</i>)</code> [SAL]<br>
<code>(nthcdr <tt><i>n</i></tt> <tt><i>list</i></tt>)</code> [LISP] – return the nth cdr of a list<br>
</div><div style="padding-left: 2em;">
<i>n</i> – the number of the element to return (zero origin)</div>
<div style="padding-left: 2em;"> <i>list</i> – the list</div>
<div style="padding-left: 2em;"> returns – the nth cdr or <code>nil</code> if the list isn't that long<br>
</div>
<br>
<code>mapc<a name="index1520"></a>(<i>fcn</i>, <i>list1</i>, <i>list</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(mapc <tt><i>fcn</i></tt> <tt><i>list1</i></tt> <tt><i>list</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – apply function to successive cars<br>
</div><div style="padding-left: 2em;">
<i>fcn</i> – the function or function name</div>
<div style="padding-left: 2em;"> <i>listn</i> – a list for each argument of the function</div>
<div style="padding-left: 2em;"> returns – the first list of arguments<br>
</div>
<br>
<code>mapcar<a name="index1521"></a>(<i>fcn</i>, <i>list1</i>, <i>list</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(mapcar <tt><i>fcn</i></tt> <tt><i>list1</i></tt> <tt><i>list</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – apply function to successive cars<br>
</div><div style="padding-left: 2em;">
<i>fcn</i> – the function or function name</div>
<div style="padding-left: 2em;"> <i>listn</i> – a list for each argument of the function</div>
<div style="padding-left: 2em;"> returns – a list of the values returned<br>
</div>
<br>
<code>mapl<a name="index1522"></a>(<i>fcn</i>, <i>list1</i>, <i>list</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(mapl <tt><i>fcn</i></tt> <tt><i>list1</i></tt> <tt><i>list</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – apply function to successive cdrs<br>
</div><div style="padding-left: 2em;">
<i>fcn</i> – the function or function name</div>
<div style="padding-left: 2em;"> <i>listn</i> – a list for each argument of the function</div>
<div style="padding-left: 2em;"> returns – the first list of arguments<br>
</div>
<br>
<code>maplist<a name="index1523"></a>(<i>fcn</i>, <i>list1</i>, <i>list</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(maplist <tt><i>fcn</i></tt> <tt><i>list1</i></tt> <tt><i>list</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – apply function to successive cdrs<br>
</div><div style="padding-left: 2em;">
<i>fcn</i> – the function or function name</div>
<div style="padding-left: 2em;"> <i>listn</i> – a list for each argument of the function</div>
<div style="padding-left: 2em;"> returns – a list of the values returned<br>
</div>
<br>
<code>subst<a name="index1524"></a>(<i>to</i>, <i>from</i>, <i>expr</i>, test: <i>test</i>, test-not: <i>test-not</i>)</code> [SAL]<br>
<code>(subst <tt><i>to</i></tt> <tt><i>from</i></tt> <tt><i>expr</i></tt> <tt>&key </tt><tt>:test</tt> <tt>:test-not</tt>)</code> [LISP] – substitute expressions<br>
</div><div style="padding-left: 2em;">
<i>to</i> – the new expression</div>
<div style="padding-left: 2em;"> <i>from</i> – the old expression</div>
<div style="padding-left: 2em;"> <i>expr</i> – the expression in which to do the substitutions</div>
<div style="padding-left: 2em;"> :test – the test function (defaults to eql)</div>
<div style="padding-left: 2em;"> :test-not – the test function (sense inverted) </div>
<div style="padding-left: 2em;"> returns – the expression with substitutions<br>
</div>
<br>
<code>sublis<a name="index1525"></a>(<i>alist</i>, <i>expr</i>, test: <i>test</i>, test-not: <i>test-not</i>)</code> [SAL]<br>
<code>(sublis <tt><i>alist</i></tt> <tt><i>expr</i></tt> <tt>&key </tt><tt>:test</tt> <tt>:test-not</tt>)</code> [LISP] – substitute with an a-list<br>
</div><div style="padding-left: 2em;">
<i>alist</i> – the association list</div>
<div style="padding-left: 2em;"> <i>expr</i> – the expression in which to do the substitutions</div>
<div style="padding-left: 2em;"> :test – the test function (defaults to eql)</div>
<div style="padding-left: 2em;"> :test-not – the test function (sense inverted) </div>
<div style="padding-left: 2em;"> returns – the expression with substitutions<br>
</div>
</div>
<p>
<a name = "248"><h3>Destructive List Functions</h3></a><a name="index1526"></a>
<div style="padding-left: 0em;">
<code>rplaca<a name="index1527"></a>(<i>list</i>, <i>expr</i>)</code> [SAL]<br>
<code>(rplaca <tt><i>list</i></tt> <tt><i>expr</i></tt>)</code> [LISP] – replace the car of a list node<br>
</div><div style="padding-left: 2em;">
<i>list</i> – the list node</div>
<div style="padding-left: 2em;"> <i>expr</i> – the new value for the car of the list node</div>
<div style="padding-left: 2em;"> returns – the list node after updating the car<br>
</div>
<br>
<code>rplacd<a name="index1528"></a>(<i>list</i>, <i>expr</i>)</code> [SAL]<br>
<code>(rplacd <tt><i>list</i></tt> <tt><i>expr</i></tt>)</code> [LISP] – replace the cdr of a list node<br>
</div><div style="padding-left: 2em;">
<i>list</i> – the list node</div>
<div style="padding-left: 2em;"> <i>expr</i> – the new value for the cdr of the list node</div>
<div style="padding-left: 2em;"> returns – the list node after updating the cdr<br>
</div>
<br>
<code>nconc<a name="index1529"></a>(<i>list</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(nconc <tt><i>list</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – destructively concatenate lists<br>
</div><div style="padding-left: 2em;">
<i>list</i> – lists to concatenate</div>
<div style="padding-left: 2em;"> returns – the result of concatenating the lists<br>
</div>
<br>
<code>delete<a name="index1530"></a>(<i>expr</i>, test: <i>test</i>, test-not: <i>test-not</i>)</code> [SAL]<br>
<code>(delete <tt><i>expr</i></tt> <tt>&key </tt><tt>:test</tt> <tt>:test-not</tt>)</code> [LISP] – delete elements from a list<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the element to delete</div>
<div style="padding-left: 2em;"> <i>list</i> – the list</div>
<div style="padding-left: 2em;"> :test – the test function (defaults to eql)</div>
<div style="padding-left: 2em;"> :test-not – the test function (sense inverted) </div>
<div style="padding-left: 2em;"> returns – the list with the matching expressions deleted<br>
</div>
<br>
<code>delete-if<a name="index1531"></a>(<i>test</i>, <i>list</i>)</code> [SAL]<br>
<code>(delete-if) <tt><i>test</i></tt> <tt><i>list</i></tt>)</code> [LISP] – delete elements that pass test<br>
</div><div style="padding-left: 2em;">
<i>test</i> – the test predicate</div>
<div style="padding-left: 2em;"> <i>list</i> – the list</div>
<div style="padding-left: 2em;"> returns – the list with matching elements deleted<br>
</div>
<br>
<code>delete-if-not<a name="index1532"></a>(<i>test</i>, <i>list</i>)</code> [SAL]<br>
<code>(delete-if-not) <tt><i>test</i></tt> <tt><i>list</i></tt>)</code> [LISP] – delete elements that fail test<br>
</div><div style="padding-left: 2em;">
<i>test</i> – the test predicate</div>
<div style="padding-left: 2em;"> <i>list</i> – the list</div>
<div style="padding-left: 2em;"> returns – the list with non-matching elements deleted<br>
</div>
<br>
<code>sort<a name="index1533"></a>(<i>list</i>, <i>test</i>)</code> [SAL]<br>
<code>(sort <tt><i>list</i></tt> <tt><i>test</i></tt>)</code> [LISP] – sort a list<br>
</div><div style="padding-left: 2em;">
<i>list</i> – the list to sort</div>
<div style="padding-left: 2em;"> <i>test</i> – the comparison function</div>
<div style="padding-left: 2em;"> returns – the sorted list</div>
<div style="padding-left: 2em;"> Note: The comparison function should have two parameters and return true if the first parameter should come before the second parameter in the sorted result. For a list of numbers, built-in comparison functions can be used, e.g. <tt>(sort '(3 2 1) #'<)</tt> returns <tt>(1 2 3)</tt>. To sort a list of lists by the first element of each list, you can write a function to access the keys and compare them, e.g. <br>
<tt>(sort '((3 c) (2 b) (1 a)) #'(lambda (x y) (< (car x) (car y))))</tt> returns<br>
<tt>((1 A) (2 B) (3 C))</tt>. In SAL, you could write<br>
<tt>function my-sort(a, b) return first(a) < first(b)</tt><br>
<tt>print sort({{3 c} {2 b} {1 a}}, quote(my-sort))</tt>, which will print<br>
<tt>{{1 A} {2 B} {3 C}}</tt>.</div>
<div style="padding-left: 2em;"></div>
<br>
</div>
<p>
<a name = "249"><h3>Predicate Functions</h3></a><a name="index1534"></a>
<div style="padding-left: 0em;">
<code>atom<a name="index1535"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(atom <tt><i>expr</i></tt>)</code> [LISP] – is this an atom?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is an atom, <code>nil</code> otherwise<br>
</div>
<br>
<code>symbolp<a name="index1536"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(symbolp <tt><i>expr</i></tt>)</code> [LISP] – is this a symbol?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the expression is a symbol, <code>nil</code> otherwise<br>
</div>
<br>
<code>numberp<a name="index1537"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(numberp <tt><i>expr</i></tt>)</code> [LISP] – is this a number?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the expression is a number, <code>nil</code> otherwise<br>
</div>
<br>
<code>null<a name="index1538"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(null <tt><i>expr</i></tt>)</code> [LISP] – is this an empty list?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the list to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the list is empty, <code>nil</code> otherwise<br>
</div>
<br>
<code>not<a name="index1539"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(not <tt><i>expr</i></tt>)</code> [LISP] – is this false?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> return – <code>t</code> if the value is <code>nil</code>, <code>nil</code> otherwise<br>
</div>
<br>
<code>listp<a name="index1540"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(listp <tt><i>expr</i></tt>)</code> [LISP] – is this a list?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is a cons or <code>nil</code>, <code>nil</code> otherwise<br>
</div>
<br>
<code>endp<a name="index1541"></a>(<i>list</i>)</code> [SAL]<br>
<code>(endp <tt><i>list</i></tt>)</code> [LISP] – is this the end of a list<br>
</div><div style="padding-left: 2em;">
<i>list</i> – the list</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is <code>nil</code>, <code>nil</code> otherwise<br>
</div>
<br>
<code>consp<a name="index1542"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(consp <tt><i>expr</i></tt>)</code> [LISP] – is this a non-empty list?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is a cons, <code>nil</code> otherwise<br>
</div>
<br>
<code>integerp<a name="index1543"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(integerp <tt><i>expr</i></tt>)</code> [LISP] – is this an integer?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is an integer, <code>nil</code> otherwise<br>
</div>
<br>
<code>floatp<a name="index1544"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(floatp <tt><i>expr</i></tt>)</code> [LISP] – is this a float?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is a float, <code>nil</code> otherwise<br>
</div>
<br>
<code>stringp<a name="index1545"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(stringp <tt><i>expr</i></tt>)</code> [LISP] – is this a string?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is a string, <code>nil</code> otherwise<br>
</div>
<br>
<code>characterp<a name="index1546"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(characterp <tt><i>expr</i></tt>)</code> [LISP] – is this a character?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is a character, <code>nil</code> otherwise<br>
</div>
<br>
<code>arrayp<a name="index1547"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(arrayp <tt><i>expr</i></tt>)</code> [LISP] – is this an array?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is an array, <code>nil</code> otherwise<br>
</div>
<br>
<code>streamp<a name="index1548"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(streamp <tt><i>expr</i></tt>)</code> [LISP] – is this a stream?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is a stream, <code>nil</code> otherwise<br>
</div>
<br>
<code>objectp<a name="index1549"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(objectp <tt><i>expr</i></tt>)</code> [LISP] – is this an object?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is an object, <code>nil</code> otherwise<br>
</div>
<br>
<code>filep<a name="index1550"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(filep <tt><i>expr</i></tt>)</code> [LISP] <a href = "foot.html#foot7">(Footnote 7)</a> – is this a file? <br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to check</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the value is an object, <code>nil</code> otherwise<br>
</div>
<br>
<code>boundp<a name="index1551"></a>(<i>sym</i>)</code> [SAL]<br>
<code>(boundp <tt><i>sym</i></tt>)</code> [LISP] – is a value bound to this symbol?<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if a value is bound to the symbol, <code>nil</code> otherwise<br>
</div>
<br>
<code>fboundp<a name="index1552"></a>(<i>sym</i>)</code> [SAL]<br>
<code>(fboundp <tt><i>sym</i></tt>)</code> [LISP] – is a functional value bound to this symbol?<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if a functional value is bound to the symbol,</div>
<div style="padding-left: 2em;"> <code>nil</code> otherwise<br>
</div>
<br>
<code>minusp<a name="index1553"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(minusp <tt><i>expr</i></tt>)</code> [LISP] – is this number negative?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the number to test</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the number is negative, <code>nil</code> otherwise<br>
</div>
<br>
<code>zerop<a name="index1554"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(zerop <tt><i>expr</i></tt>)</code> [LISP] – is this number zero?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the number to test</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the number is zero, <code>nil</code> otherwise<br>
</div>
<br>
<code>plusp<a name="index1555"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(plusp <tt><i>expr</i></tt>)</code> [LISP] – is this number positive?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the number to test</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the number is positive, <code>nil</code> otherwise<br>
</div>
<br>
<code>evenp<a name="index1556"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(evenp <tt><i>expr</i></tt>)</code> [LISP] – is this integer even?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the integer to test</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the integer is even, <code>nil</code> otherwise<br>
</div>
<br>
<code>oddp<a name="index1557"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(oddp <tt><i>expr</i></tt>)</code> [LISP] – is this integer odd?<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the integer to test</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the integer is odd, <code>nil</code> otherwise<br>
</div>
<br>
<code>eq<a name="index1558"></a>(<i>expr1</i>, <i>expr2</i>)</code> [SAL]<br>
<code>(eq <tt><i>expr1</i></tt> <tt><i>expr2</i></tt>)</code> [LISP] – are the expressions identical?<br>
</div><div style="padding-left: 2em;">
<i>expr1</i> – the first expression</div>
<div style="padding-left: 2em;"> <i>expr2</i> – the second expression</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if they are equal, <code>nil</code> otherwise<br>
</div>
<br>
<code>eql<a name="index1559"></a>(<i>expr1</i>, <i>expr2</i>)</code> [SAL]<br>
<code>(eql <tt><i>expr1</i></tt> <tt><i>expr2</i></tt>)</code> [LISP] – are the expressions identical? (<code>eql</code> "works" with all numbers, but a FIXNUM is never eql to a FLONUM, i.e. <code>(eql 1 1.0)</code> is false.)<br>
</div><div style="padding-left: 2em;">
<i>expr1</i> – the first expression</div>
<div style="padding-left: 2em;"> <i>expr2</i> – the second expression</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if they are equal, <code>nil</code> otherwise<br>
</div>
<br>
<code>equal<a name="index1560"></a>(<i>expr1</i>, <i>expr2</i>)</code> [SAL]<br>
<code>(equal <tt><i>expr1</i></tt> <tt><i>expr2</i></tt>)</code> [LISP] – are the expressions equal?<br>
</div><div style="padding-left: 2em;">
<i>expr1</i> – the first expression</div>
<div style="padding-left: 2em;"> <i>expr2</i> – the second expression</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if they are equal, <code>nil</code> otherwise<br>
</div>
</div>
<p>
<a name = "250"><h3>Control Constructs</h3></a><a name="index1561"></a>
<div style="padding-left: 0em;">
<code>(cond<a name="index1562"></a> <tt><i>pair</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – evaluate conditionally
</div><div style="padding-left: 2em;">
<i>pair</i> – pair consisting of:<br>
</div><div style="padding-left: 4em;">
(<i>pred</i> <i>expr</i>...)<br>
</div></div>
<div style="padding-left: 2em;"> where:<br>
</div><div style="padding-left: 4em;">
<i>pred</i> – is a predicate expression</div>
<div style="padding-left: 4em;"> <i>expr</i> – evaluated if the predicate<br>
is not <code>nil</code><br>
</div></div>
<div style="padding-left: 2em;">returns – the value of the first expression whose predicate is not <br>
<code>nil</code><br>
</div>
<br>
<code>and<a name="index1563"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(and <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – the logical and of a list of expressions<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expressions to be anded</div>
<div style="padding-left: 2em;"> returns – <code>nil</code> if any expression evaluates to <code>nil</code>,<br>
otherwise the value of the last expression<br>
(evaluation of expressions stops after the first<br>
expression that evaluates to <code>nil</code>)<br>
</div>
<br>
<code>or<a name="index1564"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(or <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – the logical or of a list of expressions<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expressions to be ored</div>
<div style="padding-left: 2em;"> returns – <code>nil</code> if all expressions evaluate to <code>nil</code>,<br>
otherwise the value of the first non-<code>nil</code> expression<br>
(evaluation of expressions stops after the first<br>
expression that does not evaluate to <code>nil</code>)<br>
</div>
<br>
<code>(if<a name="index1565"></a> <tt><i>texpr</i></tt> <tt><i>expr1</i></tt> [<tt><i>expr2</i></tt>])</code> [LISP] – evaluate expressions conditionally. Note that the SAL conditional expression syntax is <code>#?(<i>test</i>, <i>iftrue-expression</i>, <i>iffalse-expression</i>)</code>, but <code>#if</code> may be used instead of <code>#?</code>. Either form may omit the third argument, which defaults to <code>nil</code>.<br>
</div><div style="padding-left: 2em;">
<i>texpr</i> – the test expression</div>
<div style="padding-left: 2em;"> <i>expr1</i> – the expression to be evaluated if texpr is non-<code>nil</code></div>
<div style="padding-left: 2em;"> <i>expr2</i> – the expression to be evaluated if texpr is <code>nil</code></div>
<div style="padding-left: 2em;"> returns – the value of the selected expression.<br>
</div>
<br>
<code>when<a name="index1566"></a>(<i>texpr</i>, <i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(when <tt><i>texpr</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – evaluate only when a condition is true<br>
</div><div style="padding-left: 2em;">
<i>texpr</i> – the test expression</div>
<div style="padding-left: 2em;"> <i>expr</i> – the expression(s) to be evaluated if texpr is non-<code>nil</code></div>
<div style="padding-left: 2em;"> returns – the value of the last expression or <code>nil</code><br>
</div>
<br>
<code>unless<a name="index1567"></a>(<i>texpr</i>, <i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(unless <tt><i>texpr</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – evaluate only when a condition is false<br>
</div><div style="padding-left: 2em;">
<i>texpr</i> – the test expression</div>
<div style="padding-left: 2em;"> <i>expr</i> – the expression(s) to be evaluated if texpr is <code>nil</code></div>
<div style="padding-left: 2em;"> returns – the value of the last expression or <code>nil</code><br>
</div>
<br>
<code>(case<a name="index1568"></a> <tt><i>expr</i></tt> <tt><i>case</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – select by case
</div><div style="padding-left: 2em;">
<i>expr</i> – the selection expression</div>
<div style="padding-left: 2em;"> <i>case</i> – pair consisting of:<br>
</div><div style="padding-left: 4em;">
(<i>value</i> <i>expr</i>...)<br>
</div></div>
<div style="padding-left: 2em;"> where:<br>
</div><div style="padding-left: 4em;">
<i>value</i> – is a single expression or a list of<br>
expressions (unevaluated)</div>
<div style="padding-left: 4em;"> <i>expr</i> – are expressions to execute if the<br>
case matches<br>
</div></div>
<div style="padding-left: 2em;"> returns – the value of the last expression of the matching case<br>
</div>
<code>(let<a name="index1569"></a> (<tt><i>binding</i></tt><span style="font-style:normal">...</span>) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – create local bindings<br>
<br>
<code>(let*<a name="index1570"></a> (<tt><i>binding</i></tt><span style="font-style:normal">...</span>) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – let with sequential binding<br>
</div><div style="padding-left: 2em;">
<i>binding</i> – the variable bindings each of which is either:<br>
</div><div style="padding-left: 4em;">
1) a symbol (which is initialized to <code>nil</code>)</div>
<div style="padding-left: 4em;"> 2) a list whose car is a symbol and whose cadr<br>
is an initialization expression<br>
</div></div>
<div style="padding-left: 2em;"> <i>expr</i> – the expressions to be evaluated</div>
<div style="padding-left: 2em;"> returns – the value of the last expression<br>
</div>
<code>(flet<a name="index1571"></a> (<tt><i>binding</i></tt><span style="font-style:normal">...</span>) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – create local functions<br>
<br>
<code>(labels<a name="index1572"></a> (<tt><i>binding</i></tt><span style="font-style:normal">...</span>) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – flet with recursive functions<br>
<br>
<code>(macrolet<a name="index1573"></a> (<tt><i>binding</i></tt><span style="font-style:normal">...</span>) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – create local macros<br>
</div><div style="padding-left: 2em;">
<i>binding</i> – the function bindings each of which is:<br>
</div><div style="padding-left: 4em;">
(<i>sym</i> <i>fargs</i> <i>expr</i>...)<br>
</div></div>
<div style="padding-left: 2em;"> where:<br>
</div><div style="padding-left: 4em;">
<i>sym</i> – the function/macro name</div>
<div style="padding-left: 4em;"> <i>fargs</i> – formal argument list (lambda list)</div>
<div style="padding-left: 4em;"> <i>expr</i> – expressions constituting the body of<br>
the function/macro<br>
</div></div>
<div style="padding-left: 2em;"> <i>expr</i> – the expressions to be evaluated</div>
<div style="padding-left: 2em;"> returns – the value of the last expression<br>
</div>
<br>
<code>catch<a name="index1574"></a>(<i>sym</i>, <i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(catch <tt><i>sym</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – evaluate expressions and catch throws<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the catch tag</div>
<div style="padding-left: 2em;"> <i>expr</i> – expressions to evaluate</div>
<div style="padding-left: 2em;"> returns – the value of the last expression the throw expression<br>
</div>
<br>
<code>throw<a name="index1575"></a>(<i>sym</i> [, <i>expr</i>])</code> [SAL]<br>
<code>(throw <tt><i>sym</i></tt> [<tt><i>expr</i></tt>])</code> [LISP] – throw to a catch<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the catch tag</div>
<div style="padding-left: 2em;"> <i>expr</i> – the value for the catch to return (defaults to <code>nil</code>)</div>
<div style="padding-left: 2em;"> returns – never returns<br>
</div>
<br>
<code>unwind-protect<a name="index1576"></a>(<i>expr</i>, <i>cexpr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(unwind-protect <tt><i>expr</i></tt> <tt><i>cexpr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – protect evaluation of an expression<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to protect</div>
<div style="padding-left: 2em;"> <i>cexpr</i> – the cleanup expressions</div>
<div style="padding-left: 2em;"> returns – the value of the expression<br>
</div>
<div style="padding-left: 2em;"> Note: unwind-protect guarantees to execute the cleanup expressions<br>
even if a non-local exit terminates the evaluation of the<br>
protected expression<br>
</div>
</div>
<p>
<a name = "251"><h3>Looping Constructs</h3></a><a name="index1577"></a>
<div style="padding-left: 0em;">
<code>(loop<a name="index1578"></a> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – basic looping form
</div><div style="padding-left: 2em;">
<i>expr</i> – the body of the loop</div>
<div style="padding-left: 2em;"> returns – never returns (must use non-local exit)<br>
</div>
<code>(do<a name="index1579"></a> (<tt><i>binding</i></tt><span style="font-style:normal">...</span>) (<tt><i>texpr</i></tt> <tt><i>rexpr</i></tt><span style="font-style:normal">...</span>) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
<code>(do*<a name="index1580"></a> (<tt><i>binding</i></tt><span style="font-style:normal">...</span>) (<tt><i>texpr</i></tt> <tt><i>rexpr</i></tt><span style="font-style:normal">...</span>) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
<i>binding</i> – the variable bindings each of which is either:<br>
</div><div style="padding-left: 4em;">
1) a symbol (which is initialized to <code>nil</code>)</div>
<div style="padding-left: 4em;"> 2) a list of the form: (<i>sym</i> <i>init</i> [<i>step</i>])<br>
where:<br>
</div><div style="padding-left: 6em;">
<i>sym</i> – is the symbol to bind</div>
<div style="padding-left: 6em;"> <i>init</i> – is the initial value of the symbol</div>
<div style="padding-left: 6em;"> <i>step</i> – is a step expression<br>
</div></div></div>
<div style="padding-left: 2em;"> <i>texpr</i> – the termination test expression</div>
<div style="padding-left: 2em;"> <i>rexpr</i> – result expressions (the default is <code>nil</code>)</div>
<div style="padding-left: 2em;"> <i>expr</i> – the body of the loop (treated like an implicit prog)</div>
<div style="padding-left: 2em;"> returns – the value of the last result expression<br>
</div>
<br>
<code>(dolist<a name="index1581"></a> (<tt><i>sym</i></tt> <tt><i>expr</i></tt> [<tt><i>rexpr</i></tt>]) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – loop through a list
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol to bind to each list element</div>
<div style="padding-left: 2em;"> <i>expr</i> – the list expression</div>
<div style="padding-left: 2em;"> <i>rexpr</i> – the result expression (the default is <code>nil</code>)</div>
<div style="padding-left: 2em;"> <i>expr</i> – the body of the loop (treated like an implicit prog)<br>
</div>
<br>
<code>(dotimes<a name="index1582"></a> (<tt><i>sym</i></tt> <tt><i>expr</i></tt> [<tt><i>rexpr</i></tt>]) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – loop from zero to n-1
</div><div style="padding-left: 2em;">
<i>sym</i> – the symbol to bind to each value from 0 to n-1</div>
<div style="padding-left: 2em;"> <i>expr</i> – the number of times to loop</div>
<div style="padding-left: 2em;"> <i>rexpr</i> – the result expression (the default is <code>nil</code>)</div>
<div style="padding-left: 2em;"> <i>expr</i> – the body of the loop (treated like an implicit prog)<br>
</div>
</div>
<p>
<a name = "252"><h3>The Program Feature</h3></a><a name="index1583"></a>
<div style="padding-left: 0em;">
<code>(prog<a name="index1584"></a> (<tt><i>binding</i></tt><span style="font-style:normal">...</span>) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – the program feature<br>
<br>
<code>(prog*<a name="index1585"></a> (<tt><i>binding</i></tt><span style="font-style:normal">...</span>) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – prog with sequential binding<br>
</div><div style="padding-left: 2em;">
<i>binding</i> – the variable bindings each of which is either:<br>
</div><div style="padding-left: 4em;">
1) a symbol (which is initialized to <code>nil</code>)</div>
<div style="padding-left: 4em;"> 2) a list whose car is a symbol and whose cadr<br>
is an initialization expression<br>
</div></div>
<div style="padding-left: 2em;"> <i>expr</i> – expressions to evaluate or tags (symbols)</div>
<div style="padding-left: 2em;"> returns – <code>nil</code> or the argument passed to the return function<br>
</div>
<br>
<code>block(<i>name</i>, <i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(block<a name="index1586"></a> <tt><i>name</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – named block<br>
</div><div style="padding-left: 2em;">
<i>name</i> – the block name (symbol)</div>
<div style="padding-left: 2em;"> <i>expr</i> – the block body</div>
<div style="padding-left: 2em;"> returns – the value of the last expression<br>
</div>
<br>
<code>(return<a name="index1587"></a> [<tt><i>expr</i></tt>])</code> [LISP] – cause a prog construct to return a value
</div><div style="padding-left: 2em;">
<i>expr</i> – the value (defaults to <code>nil</code>)</div>
<div style="padding-left: 2em;"> returns – never returns<br>
</div>
<br>
<code>return-from<a name="index1588"></a>(<i>name</i> [, <i>value</i>])</code> [SAL]<br>
<code>(return-from <tt><i>name</i></tt> [<tt><i>value</i></tt>])</code> [LISP] – return from a named block<br>
</div><div style="padding-left: 2em;">
<i>name</i> – the block name (symbol)</div>
<div style="padding-left: 2em;"> <i>value</i> – the value to return (defaults to <code>nil</code>)</div>
<div style="padding-left: 2em;"> returns – never returns<br>
</div>
<br>
<code>tagbody<a name="index1589"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(tagbody <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – block with labels<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – expression(s) to evaluate or tags (symbols)</div>
<div style="padding-left: 2em;"> returns – <code>nil</code><br>
</div>
<br>
<code>go<a name="index1590"></a>(<i>sym</i>)</code> [SAL]<br>
<code>(go <tt><i>sym</i></tt>)</code> [LISP] – go to a tag within a tagbody or prog<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the tag (quoted)</div>
<div style="padding-left: 2em;"> returns – never returns<br>
</div>
<br>
<code>(progv<a name="index1591"></a> <tt><i>slist</i></tt> <tt><i>vlist</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – dynamically bind symbols
</div><div style="padding-left: 2em;">
<i>slist</i> – list of symbols</div>
<div style="padding-left: 2em;"> <i>vlist</i> – list of values to bind to the symbols</div>
<div style="padding-left: 2em;"> <i>expr</i> – expression(s) to evaluate</div>
<div style="padding-left: 2em;"> returns – the value of the last expression<br>
</div>
<br>
<code>prog1(<i>expr1</i>, <i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(prog1<a name="index1592"></a> <tt><i>expr1</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – execute expressions sequentially<br>
</div><div style="padding-left: 2em;">
<i>expr1</i> – the first expression to evaluate</div>
<div style="padding-left: 2em;"> <i>expr</i> – the remaining expressions to evaluate</div>
<div style="padding-left: 2em;"> returns – the value of the first expression<br>
</div>
<br>
<code>prog2(<i>expr1</i>, <i>expr2</i>, <i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(prog2<a name="index1593"></a> <tt><i>expr1</i></tt> <tt><i>expr2</i></tt> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – execute expressions sequentially<br>
</div><div style="padding-left: 2em;">
<i>expr1</i> – the first expression to evaluate</div>
<div style="padding-left: 2em;"> <i>expr2</i> – the second expression to evaluate</div>
<div style="padding-left: 2em;"> <i>expr</i> – the remaining expressions to evaluate</div>
<div style="padding-left: 2em;"> returns – the value of the second expression<br>
</div>
<br>
<code>progn(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(progn<a name="index1594"></a> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – execute expressions sequentially<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expressions to evaluate</div>
<div style="padding-left: 2em;"> returns – the value of the last expression (or <code>nil</code>)<br>
</div>
</div>
<p>
<a name = "253"><h3>Debugging and Error Handling</h3></a><a name="index1595"></a><a name="index1596"></a>
<div style="padding-left: 0em;">
<code>trace<a name="index1597"></a>(<i>sym</i>)</code> [SAL]<br>
<code>(trace <tt><i>sym</i></tt>)</code> [LISP] – add a function to the trace list<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the function to add (quoted)</div>
<div style="padding-left: 2em;"> returns – the trace list<br>
</div>
<br>
<code>untrace<a name="index1598"></a>(<i>sym</i>)</code> [SAL]<br>
<code>(untrace <tt><i>sym</i></tt>)</code> [LISP] – remove a function from the trace list<br>
</div><div style="padding-left: 2em;">
<i>sym</i> – the function to remove (quoted)</div>
<div style="padding-left: 2em;"> returns – the trace list<br>
</div>
<br>
<code>error<a name="index1599"></a>(<i>emsg</i> [, <i>arg</i>])</code> [SAL]<br>
<code>(error <tt><i>emsg</i></tt> [<tt><i>arg</i></tt>])</code> [LISP] – signal a non-correctable error<br>
</div><div style="padding-left: 2em;">
<i>emsg</i> – the error message string</div>
<div style="padding-left: 2em;"> <i>arg</i> – the argument expression (printed after the message)</div>
<div style="padding-left: 2em;"> returns – never returns<br>
</div>
<br>
<code>cerror<a name="index1600"></a>(<i>cmsg</i>, <i>emsg</i> [, <i>arg</i>])</code> [SAL]<br>
<code>(cerror <tt><i>cmsg</i></tt> <tt><i>emsg</i></tt> [<tt><i>arg</i></tt>])</code> [LISP] – signal a correctable error<br>
</div><div style="padding-left: 2em;">
<i>cmsg</i> – the continue message string</div>
<div style="padding-left: 2em;"> <i>emsg</i> – the error message string</div>
<div style="padding-left: 2em;"> <i>arg</i> – the argument expression (printed after the message)</div>
<div style="padding-left: 2em;"> returns – <code>nil</code> when continued from the break loop<br>
</div>
<br>
<code>break<a name="index1601"></a>([<i>bmsg</i> [, <i>arg</i>]])</code> [SAL]<br>
<code>(break [<tt><i>bmsg</i></tt> [<tt><i>arg</i></tt>]])</code> [LISP] – enter a break loop<br>
</div><div style="padding-left: 2em;">
<i>bmsg</i> – the break message string (defaults to <code>**break**</code>)</div>
<div style="padding-left: 2em;"> <i>arg</i> – the argument expression (printed after the message)</div>
<div style="padding-left: 2em;"> returns – <code>nil</code> when continued from the break loop<br>
</div>
<br>
<code>(clean-up<a name="index1602"></a>)</code> [LISP] – clean-up after an error
</div><div style="padding-left: 2em;">
returns – never returns<br>
</div>
<br>
<code>(top-level<a name="index1603"></a>)</code> [LISP] – clean-up after an error and return to the top level
</div><div style="padding-left: 2em;">
returns – never returns<br>
</div>
<br>
<code>(continue<a name="index1604"></a>)</code> [LISP] – continue from a correctable error
</div><div style="padding-left: 2em;">
returns – never returns<br>
</div>
<br>
<code>(errset<a name="index1605"></a> <tt><i>expr</i></tt> [<tt><i>pflag</i></tt>])</code> [LISP] – trap errors
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to execute</div>
<div style="padding-left: 2em;"> <i>pflag</i> – flag to control printing of the error message</div>
<div style="padding-left: 2em;"> returns – the value of the last expression consed with <code>nil</code></div>
<div style="padding-left: 2em;"> or <code>nil</code> on error<br>
</div>
<br>
<code>(baktrace<a name="index1606"></a><a name="index1607"></a><a name="index1608"></a> [<tt><i>n</i></tt>])</code> [LISP] – print n levels of trace back information
</div><div style="padding-left: 2em;">
<i>n</i> – the number of levels (defaults to all levels)</div>
<div style="padding-left: 2em;"> returns – <code>nil</code><br>
</div>
<br>
<code>(evalhook<a name="index1609"></a> <tt><i>expr</i></tt> <tt><i>ehook</i></tt> <tt><i>ahook</i></tt> [<tt><i>env</i></tt>])</code> [LISP] – evaluate with hooks
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to evaluate</div>
<div style="padding-left: 2em;"> <i>ehook</i> – the value for <code>*evalhook*</code></div>
<div style="padding-left: 2em;"> <i>ahook</i> – the value for <code>*applyhook*</code></div>
<div style="padding-left: 2em;"> <i>env</i> – the environment (default is <code>nil</code>)</div>
<div style="padding-left: 2em;"> returns – the result of evaluating the expression<br>
</div>
<br>
<code>profile(<i>flag</i>)</code> [SAL]<br>
<code>(profile<a name="index1610"></a> <tt><i>flag</i></tt>)</code> [LISP] <a href = "foot.html#foot8">(Footnote 8)</a> – turn profiling on or off.<br>
</div><div style="padding-left: 2em;">
<i>flag</i> – <code>nil</code> turns profiling off, otherwise on</div>
<div style="padding-left: 2em;"> returns – the previous state of profiling.<br>
</div>
</div>
<p>
<a name = "254"><h3>Arithmetic Functions</h3></a><a name="index1611"></a>
<div style="padding-left: 0em;">
<code>truncate<a name="index1612"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(truncate <tt><i>expr</i></tt>)</code> [LISP] – truncates a floating point number to an integer<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the number</div>
<div style="padding-left: 2em;"> returns – the result of truncating the number<br>
</div>
<br>
<code>float<a name="index1613"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(float <tt><i>expr</i></tt>)</code> [LISP] – converts an integer to a floating point number<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the number</div>
<div style="padding-left: 2em;"> returns – the result of floating the integer<br>
</div>
<br>
<code>(+<a name="index1614"></a> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – add a list of numbers
</div><div style="padding-left: 2em;">
<i>expr</i> – the numbers</div>
<div style="padding-left: 2em;"> returns – the result of the addition<br>
</div>
<br>
<code>(-<a name="index1615"></a> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – subtract a list of numbers or negate a single number
</div><div style="padding-left: 2em;">
<i>expr</i> – the numbers</div>
<div style="padding-left: 2em;"> returns – the result of the subtraction<br>
</div>
<br>
<code>(*<a name="index1616"></a> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – multiply a list of numbers
</div><div style="padding-left: 2em;">
<i>expr</i> – the numbers</div>
<div style="padding-left: 2em;"> returns – the result of the multiplication<br>
</div>
<br>
<code>(/<a name="index1617"></a> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – divide a list of numbers
</div><div style="padding-left: 2em;">
<i>expr</i> – the numbers</div>
<div style="padding-left: 2em;"> returns – the result of the division<br>
</div>
<br>
<code>(1+<a name="index1618"></a> <tt><i>expr</i></tt>)</code> [LISP] – add one to a number
</div><div style="padding-left: 2em;">
<i>expr</i> – the number</div>
<div style="padding-left: 2em;"> returns – the number plus one<br>
</div>
<br>
<code>(1-<a name="index1619"></a> <tt><i>expr</i></tt>)</code> [LISP] – subtract one from a number
</div><div style="padding-left: 2em;">
<i>expr</i> – the number</div>
<div style="padding-left: 2em;"> returns – the number minus one<br>
</div>
<br>
<code>rem<a name="index1620"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(rem<a name="index1621"></a><a name="index1622"></a> function) <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – remainder of a list of numbers<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the numbers</div>
<div style="padding-left: 2em;"> returns – the result of the remainder operation<br>
</div>
<br>
<code>min<a name="index1623"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(min<a name="index1624"></a> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – the smallest of a list of numbers<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expressions to be checked</div>
<div style="padding-left: 2em;"> returns – the smallest number in the list<br>
</div>
<br>
<code>max<a name="index1625"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(max<a name="index1626"></a> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – the largest of a list of numbers<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expressions to be checked</div>
<div style="padding-left: 2em;"> returns – the largest number in the list<br>
</div>
<br>
<code>abs<a name="index1627"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(abs <tt><i>expr</i></tt>)</code> [LISP] – the absolute value of a number<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the number</div>
<div style="padding-left: 2em;"> returns – the absolute value of the number<br>
</div>
<br>
<code>gcd<a name="index1628"></a>(<i>n1</i>, <i>n2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(gcd <tt><i>n1</i></tt> <tt><i>n2</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – compute the greatest common divisor<br>
</div><div style="padding-left: 2em;">
<i>n1</i> – the first number (integer)</div>
<div style="padding-left: 2em;"> <i>n2</i> – the second number(s) (integer)</div>
<div style="padding-left: 2em;"> returns – the greatest common divisor<br>
</div>
<br>
<code>random<a name="index1629"></a>(<i>n</i>)</code> [SAL]<br>
<code>(random <tt><i>n</i></tt>)</code><br>
[LISP] – compute a random number between 0 and |n|-1<br>
inclusive. If n is 0, return 0.<br>
</div><div style="padding-left: 2em;">
<i>n</i> – the upper bound (integer)</div>
<div style="padding-left: 2em;"> returns – a random number<br>
</div>
<br>
<code>rrandom<a name="index1630"></a>()</code> [SAL]<br>
<code>(rrandom<a name="index1631"></a>)</code> [LISP] – compute a random real number between 0 and 1 inclusive<br>
</div><div style="padding-left: 2em;">
returns – a random floating point number<br>
</div>
<br>
<code>random-seed<a name="index1632"></a>(<i>n</i>)</code> [SAL]<br>
<code>(random-seed<a name="index1633"></a> <tt><i>n</i></tt>)</code><br>
[LISP] – seed the random number generator with starting seed <i>n</i>. If <code>random-seed</code> is not called, <code>sranddev</code> or some other initialization method will be used by default.<br>
</div><div style="padding-left: 2em;">
<i>n</i> – the upper bound (integer)</div>
<div style="padding-left: 2em;"> returns – a random number<br>
</div>
<br>
<code>sin<a name="index1634"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(sin <tt><i>expr</i></tt>)</code> [LISP] – compute the sine of a number<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the floating point number</div>
<div style="padding-left: 2em;"> returns – the sine of the number<br>
</div>
<br>
<code>cos<a name="index1635"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(cos <tt><i>expr</i></tt>)</code> [LISP] – compute the cosine of a number<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the floating point number</div>
<div style="padding-left: 2em;"> returns – the cosine of the number<br>
</div>
<br>
<code>tan<a name="index1636"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(tan <tt><i>expr</i></tt>)</code> [LISP] – compute the tangent of a number<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the floating point number</div>
<div style="padding-left: 2em;"> returns – the tangent of the number<br>
</div>
<br>
<code>atan<a name="index1637"></a>(<i>expr</i> [, <i>expr2</i>])</code> [SAL]<br>
<code>(atan <tt><i>expr</i></tt> [<tt><i>expr2</i></tt>])</code> [LISP] <a href = "foot.html#foot9">(Footnote 9)</a> – compute the arctangent<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the value of <i>x</i></div>
<div style="padding-left: 2em;"> <i>expr2</i> – the value of <i>y</i> (default value is 1.0)</div>
<div style="padding-left: 2em;"> returns – the arctangent of <i>x</i>/<i>y</i><br>
</div>
<br>
<code>expt<a name="index1638"></a>(<i>x-expr</i>, <i>y-expr</i>)</code> [SAL]<br>
<code>(expt <tt><i>x-expr</i></tt> <tt><i>y-expr</i></tt>)</code> [LISP] – compute x to the y power<br>
</div><div style="padding-left: 2em;">
<i>x-expr</i> – the floating point number</div>
<div style="padding-left: 2em;"> <i>y-expr</i> – the floating point exponent</div>
<div style="padding-left: 2em;"> returns – x to the y power<br>
</div>
<br>
<code>exp<a name="index1639"></a>(<i>x-expr</i>)</code> [SAL]<br>
<code>(exp <tt><i>x-expr</i></tt>)</code> [LISP] – compute e to the x power<br>
</div><div style="padding-left: 2em;">
<i>x-expr</i> – the floating point number</div>
<div style="padding-left: 2em;"> returns – e to the x power<br>
</div>
<br>
<code>sqrt<a name="index1640"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(sqrt <tt><i>expr</i></tt>)</code> [LISP] – compute the square root of a number<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the floating point number</div>
<div style="padding-left: 2em;"> returns – the square root of the number<br>
</div>
<code>(<<a name="index1641"></a> <tt><i>n1</i></tt> <tt><i>n2</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – test for less than<br>
<code>(<=<a name="index1642"></a> <tt><i>n1</i></tt> <tt><i>n2</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – test for less than or equal to<br>
<code>(=<a name="index1643"></a> <tt><i>n1</i></tt> <tt><i>n2</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – test for equal to<br>
<code>(/=<a name="index1644"></a> <tt><i>n1</i></tt> <tt><i>n2</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – test for not equal to<br>
<code>(>=<a name="index1645"></a> <tt><i>n1</i></tt> <tt><i>n2</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – test for greater than or equal to<br>
<code>(><a name="index1646"></a> <tt><i>n1</i></tt> <tt><i>n2</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – test for greater than<br>
</div><div style="padding-left: 2em;">
<i>n1</i> – the first number to compare</div>
<div style="padding-left: 2em;"> <i>n2</i> – the second number to compare</div>
<div style="padding-left: 2em;">returns – <code>t</code> if the results of comparing <i>n1</i> with <i>n2</i>,<br>
<i>n2</i> with <i>n3</i>, etc., are all true.<br>
</div>
</div>
<p>
<a name = "255"><h3>Bitwise Logical Functions</h3></a><a name="index1647"></a>
<div style="padding-left: 0em;">
<code>logand<a name="index1648"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(logand <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – the bitwise and of a list of numbers<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the numbers</div>
<div style="padding-left: 2em;"> returns – the result of the and operation<br>
</div>
<br>
<code>logior<a name="index1649"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(logior <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – the bitwise inclusive or of a list of numbers<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the numbers</div>
<div style="padding-left: 2em;"> returns – the result of the inclusive or operation<br>
</div>
<br>
<code>logxor<a name="index1650"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(logxor <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – the bitwise exclusive or of a list of numbers<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the numbers</div>
<div style="padding-left: 2em;"> returns – the result of the exclusive or operation<br>
</div>
<br>
<code>lognot<a name="index1651"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(lognot <tt><i>expr</i></tt>)</code> [LISP] – the bitwise not of a number<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the number</div>
<div style="padding-left: 2em;"> returns – the bitwise inversion of number<br>
</div>
</div>
<p>
<a name = "256"><h3>String Functions</h3></a><a name="index1652"></a>
<div style="padding-left: 0em;">
<code>string<a name="index1653"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(string <tt><i>expr</i></tt>)</code> [LISP] – make a string from a value<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – an integer (which is first converted into its ASCII character value), string, character, or symbol</div>
<div style="padding-left: 2em;"> returns – the string representation of the argument<br>
</div>
<br>
<code>string-search<a name="index1654"></a>(<i>pat</i>, <i>str</i>, start: <i>start</i>, end: <i>end</i>)</code> [SAL]<br>
<code>(string-search<a name="index1655"></a> <tt><i>pat</i></tt> <tt><i>str</i></tt> <tt>&key </tt><tt>:start</tt> <tt>:end</tt>)</code> [LISP] <a href = "foot.html#foot10">(Footnote 10)</a> – search for pattern in string<br>
</div><div style="padding-left: 2em;">
<i>pat</i> – a string to search for</div>
<div style="padding-left: 2em;"> <i>str</i> – the string to be searched</div>
<div style="padding-left: 2em;"> :start – the starting offset in str</div>
<div style="padding-left: 2em;"> :end – the ending offset + 1</div>
<div style="padding-left: 2em;"> returns – index of pat in str or NIL if not found<br>
</div>
<br>
<code>string-trim<a name="index1656"></a>(<i>bag</i>, <i>str</i>)</code> [SAL]<br>
<code>(string-trim <tt><i>bag</i></tt> <tt><i>str</i></tt>)</code> [LISP] – trim both ends of a string<br>
</div><div style="padding-left: 2em;">
<i>bag</i> – a string containing characters to trim</div>
<div style="padding-left: 2em;"> <i>str</i> – the string to trim</div>
<div style="padding-left: 2em;"> returns – a trimed copy of the string<br>
</div>
<br>
<code>string-left-trim<a name="index1657"></a>(<i>bag</i>, <i>str</i>)</code> [SAL]<br>
<code>(string-left-trim <tt><i>bag</i></tt> <tt><i>str</i></tt>)</code> [LISP] – trim the left end of a string<br>
</div><div style="padding-left: 2em;">
<i>bag</i> – a string containing characters to trim</div>
<div style="padding-left: 2em;"> <i>str</i> – the string to trim</div>
<div style="padding-left: 2em;"> returns – a trimed copy of the string<br>
</div>
<br>
<code>string-right-trim<a name="index1658"></a>(<i>bag</i>, <i>str</i>)</code> [SAL]<br>
<code>(string-right-trim <tt><i>bag</i></tt> <tt><i>str</i></tt>)</code> [LISP] – trim the right end of a string<br>
</div><div style="padding-left: 2em;">
<i>bag</i> – a string containing characters to trim</div>
<div style="padding-left: 2em;"> <i>str</i> – the string to trim</div>
<div style="padding-left: 2em;"> returns – a trimed copy of the string<br>
</div>
<br>
<code>string-upcase<a name="index1659"></a>(<i>str</i>, start: <i>start</i>, end: <i>end</i>)</code> [SAL]<br>
<code>(string-upcase <tt><i>str</i></tt> <tt>&key </tt><tt>:start</tt> <tt>:end</tt>)</code> [LISP] – convert to uppercase<br>
</div><div style="padding-left: 2em;">
<i>str</i> – the string</div>
<div style="padding-left: 2em;"> :start – the starting offset</div>
<div style="padding-left: 2em;"> :end – the ending offset + 1</div>
<div style="padding-left: 2em;"> returns – a converted copy of the string<br>
</div>
<br>
<code>string-downcase<a name="index1660"></a>(<i>str</i>, start: <i>start</i>, end: <i>end</i>)</code> [SAL]<br>
<code>(string-downcase <tt><i>str</i></tt> <tt>&key </tt><tt>:start</tt> <tt>:end</tt>)</code> [LISP] – convert to lowercase<br>
</div><div style="padding-left: 2em;">
<i>str</i> – the string</div>
<div style="padding-left: 2em;"> :start – the starting offset</div>
<div style="padding-left: 2em;"> :end – the ending offset + 1</div>
<div style="padding-left: 2em;"> returns – a converted copy of the string<br>
</div>
<br>
<code>nstring-upcase<a name="index1661"></a>(<i>str</i>, start: <i>start</i>, end: <i>end</i>)</code> [SAL]<br>
<code>(nstring-upcase <tt><i>str</i></tt> <tt>&key </tt><tt>:start</tt> <tt>:end</tt>)</code> [LISP] – convert to uppercase<br>
</div><div style="padding-left: 2em;">
<i>str</i> – the string</div>
<div style="padding-left: 2em;"> :start – the starting offset</div>
<div style="padding-left: 2em;"> :end – the ending offset + 1</div>
<div style="padding-left: 2em;"> returns – the converted string (not a copy)<br>
</div>
<br>
<code>nstring-downcase<a name="index1662"></a>(<i>str</i>, start: <i>start</i>, end: <i>end</i>)</code> [SAL]<br>
<code>(nstring-downcase <tt><i>str</i></tt> <tt>&key </tt><tt>:start</tt> <tt>:end</tt>)</code> [LISP] – convert to lowercase<br>
</div><div style="padding-left: 2em;">
<i>str</i> – the string</div>
<div style="padding-left: 2em;"> :start – the starting offset</div>
<div style="padding-left: 2em;"> :end – the ending offset + 1</div>
<div style="padding-left: 2em;"> returns – the converted string (not a copy)<br>
</div>
<br>
<code>strcat<a name="index1663"></a>(<i>expr</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(strcat<a name="index1664"></a> <tt><i>expr</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – concatenate strings<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the strings to concatenate</div>
<div style="padding-left: 2em;"> returns – the result of concatenating the strings<br>
</div>
<br>
<code>subseq<a name="index1665"></a>(<i>string</i>, <i>start</i> [, <i>end</i>])</code> [SAL]<br>
<code>(subseq <tt><i>string</i></tt> <tt><i>start</i></tt> [<tt><i>end</i></tt>])</code> [LISP] – extract a substring<br>
</div><div style="padding-left: 2em;">
<i>string</i> – the string</div>
<div style="padding-left: 2em;"> <i>start</i> – the starting position (zero origin)</div>
<div style="padding-left: 2em;"> <i>end</i> – the ending position + 1 (defaults to end)</div>
<div style="padding-left: 2em;"> returns – substring between <i>start</i> and <i>end</i><br>
</div>
<br>
<code>string<<a name="index1666"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string< <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string<=<a name="index1667"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string<= <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string=<a name="index1668"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string= <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string/=<a name="index1669"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string/= <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string>=<a name="index1670"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string>= <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string><a name="index1671"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string> <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
<i>str1</i> – the first string to compare</div>
<div style="padding-left: 2em;"> <i>str2</i> – the second string to compare</div>
<div style="padding-left: 2em;"> :start1 – first substring starting offset</div>
<div style="padding-left: 2em;"> :end1 – first substring ending offset + 1</div>
<div style="padding-left: 2em;"> :start2 – second substring starting offset</div>
<div style="padding-left: 2em;"> :end2 – second substring ending offset + 1</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if predicate is true, <code>nil</code> otherwise</div>
<div style="padding-left: 2em;"> Note: case is significant with these comparison functions.<br>
</div>
<code>string-lessp<a name="index1672"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string-lessp <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string-not-greaterp<a name="index1673"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string-not-greaterp <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string-equal<a name="index1674"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string-equal <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string-not-equal<a name="index1675"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string-not-equal <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string-not-lessp<a name="index1676"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string-not-lessp <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>string-greaterp<a name="index1677"></a>(<i>str1</i>, <i>str2</i>, start1: <i>start1</i>, end1: <i>end1</i>, start2: <i>start2</i>, end2: <i>end2</i>)</code> [SAL]<br>
<code>(string-greaterp <tt><i>str1</i></tt> <tt><i>str2</i></tt> <tt>&key </tt><tt>:start1</tt> <tt>:end1</tt> <tt>:start2</tt> <tt>:end2</tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
<i>str1</i> – the first string to compare</div>
<div style="padding-left: 2em;"> <i>str2</i> – the second string to compare</div>
<div style="padding-left: 2em;"> :start1 – first substring starting offset</div>
<div style="padding-left: 2em;"> :end1 – first substring ending offset + 1</div>
<div style="padding-left: 2em;"> :start2 – second substring starting offset</div>
<div style="padding-left: 2em;"> :end2 – second substring ending offset + 1</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if predicate is true, <code>nil</code> otherwise</div>
<div style="padding-left: 2em;"> Note: case is not significant with these comparison functions.<br>
</div>
</div>
<p>
<a name = "257"><h3>Character Functions</h3></a><a name="index1678"></a>
<div style="padding-left: 0em;">
<code>char<a name="index1679"></a>(<i>string</i>, <i>index</i>)</code> [SAL]<br>
<code>(char <tt><i>string</i></tt> <tt><i>index</i></tt>)</code> [LISP] – extract a character from a string<br>
</div><div style="padding-left: 2em;">
<i>string</i> – the string</div>
<div style="padding-left: 2em;"> <i>index</i> – the string index (zero relative)</div>
<div style="padding-left: 2em;"> returns – the ascii code of the character<br>
</div>
<br>
<code>upper-case-p<a name="index1680"></a>(<i>chr</i>)</code> [SAL]<br>
<code>(upper-case-p <tt><i>chr</i></tt>)</code> [LISP] – is this an upper case character?<br>
</div><div style="padding-left: 2em;">
<i>chr</i> – the character</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the character is upper case, <code>nil</code> otherwise<br>
</div>
<br>
<code>lower-case-p<a name="index1681"></a>(<i>chr</i>)</code> [SAL]<br>
<code>(lower-case-p <tt><i>chr</i></tt>)</code> [LISP] – is this a lower case character?<br>
</div><div style="padding-left: 2em;">
<i>chr</i> – the character</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the character is lower case, <code>nil</code> otherwise<br>
</div>
<br>
<code>both-case-p<a name="index1682"></a>(<i>chr</i>)</code> [SAL]<br>
<code>(both-case-p <tt><i>chr</i></tt>)</code> [LISP] – is this an alphabetic (either case) character?<br>
</div><div style="padding-left: 2em;">
<i>chr</i> – the character</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the character is alphabetic, <code>nil</code> otherwise<br>
</div>
<br>
<code>digit-char-p<a name="index1683"></a>(<i>chr</i>)</code> [SAL]<br>
<code>(digit-char-p <tt><i>chr</i></tt>)</code> [LISP] – is this a digit character?<br>
</div><div style="padding-left: 2em;">
<i>chr</i> – the character</div>
<div style="padding-left: 2em;"> returns – the digit weight if character is a digit, <code>nil</code> otherwise<br>
</div>
<br>
<code>char-code<a name="index1684"></a>(<i>chr</i>)</code> [SAL]<br>
<code>(char-code <tt><i>chr</i></tt>)</code> [LISP] – get the ascii code of a character<br>
</div><div style="padding-left: 2em;">
<i>chr</i> – the character</div>
<div style="padding-left: 2em;"> returns – the ascii character code (integer)<br>
</div>
<br>
<code>code-char<a name="index1685"></a>(<i>code</i>)</code> [SAL]<br>
<code>(code-char <tt><i>code</i></tt>)</code> [LISP] – get the character with a specified ascii code<br>
</div><div style="padding-left: 2em;">
<i>code</i> – the ascii code (integer)</div>
<div style="padding-left: 2em;"> returns – the character with that code or <code>nil</code><br>
</div>
<br>
<code>char-upcase<a name="index1686"></a>(<i>chr</i>)</code> [SAL]<br>
<code>(char-upcase <tt><i>chr</i></tt>)</code> [LISP] – convert a character to upper case<br>
</div><div style="padding-left: 2em;">
<i>chr</i> – the character</div>
<div style="padding-left: 2em;"> returns – the upper case character<br>
</div>
<br>
<code>char-downcase<a name="index1687"></a>(<i>chr</i>)</code> [SAL]<br>
<code>(char-downcase <tt><i>chr</i></tt>)</code> [LISP] – convert a character to lower case<br>
</div><div style="padding-left: 2em;">
<i>chr</i> – the character</div>
<div style="padding-left: 2em;"> returns – the lower case character<br>
</div>
<br>
<code>digit-char<a name="index1688"></a>(<i>n</i>)</code> [SAL]<br>
<code>(digit-char <tt><i>n</i></tt>)</code> [LISP] – convert a digit weight to a digit<br>
</div><div style="padding-left: 2em;">
<i>n</i> – the digit weight (integer)</div>
<div style="padding-left: 2em;"> returns – the digit character or <code>nil</code><br>
</div>
<br>
<code>char-int<a name="index1689"></a>(<i>chr</i>)</code> [SAL]<br>
<code>(char-int <tt><i>chr</i></tt>)</code> [LISP] – convert a character to an integer<br>
</div><div style="padding-left: 2em;">
<i>chr</i> – the character</div>
<div style="padding-left: 2em;"> returns – the ascii character code<br>
</div>
<br>
<code>int-char<a name="index1690"></a>(<i>int</i>)</code> [SAL]<br>
<code>(int-char <tt><i>int</i></tt>)</code> [LISP] – convert an integer to a character<br>
</div><div style="padding-left: 2em;">
<i>int</i> – the ascii character code</div>
<div style="padding-left: 2em;"> returns – the character with that code<br>
</div>
<code>char<<a name="index1691"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char< <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>char<=<a name="index1692"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char<= <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
<code>char=<a name="index1693"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char= <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>char/=<a name="index1694"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char/= <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>char>=<a name="index1695"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char>= <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>char><a name="index1696"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char> <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
<i>chr1</i> – the first character to compare</div>
<div style="padding-left: 2em;"> <i>chr2</i> – the second character(s) to compare</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if predicate is true, <code>nil</code> otherwise</div>
<div style="padding-left: 2em;"> Note: case is significant with these comparison functions.<br>
</div>
<code>char-lessp<a name="index1697"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char-lessp <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>char-not-greaterp<a name="index1698"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char-not-greaterp <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>char-equal<a name="index1699"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char-equal <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>char-not-equal<a name="index1700"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char-not-equal <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>char-not-lessp<a name="index1701"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char-not-lessp <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
</div>
<code>char-greaterp<a name="index1702"></a>(<i>chr1</i>, <i>chr2</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(char-greaterp <tt><i>chr1</i></tt> <tt><i>chr2</i></tt><span style="font-style:normal">...</span>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
<i>chr1</i> – the first string to compare</div>
<div style="padding-left: 2em;"><i>chr2</i> – the second string(s) to compare</div>
<div style="padding-left: 2em;">returns – <code>t</code> if predicate is true, <code>nil</code> otherwise</div>
<div style="padding-left: 2em;"> Note: case is not significant with these comparison functions.<br>
</div>
</div>
<p>
<a name = "258"><h3>Input/Output Functions</h3></a><a name="index1703"></a>
<div style="padding-left: 0em;">
<code>read<a name="index1704"></a>([<i>stream</i> [, <i>eof</i> [, <i>rflag</i>]]])</code> [SAL]<br>
<code>(read [<tt><i>stream</i></tt> [<tt><i>eof</i></tt> [<tt><i>rflag</i></tt>]]])</code> [LISP] – read an expression<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the input stream (default is standard input)</div>
<div style="padding-left: 2em;"> <i>eof</i> – the value to return on end of file (default is <code>nil</code>)</div>
<div style="padding-left: 2em;"> <i>rflag</i> – recursive read flag (default is <code>nil</code>)</div>
<div style="padding-left: 2em;"> returns – the expression read<br>
</div>
<br>
<code>(print<a name="index1705"></a> <tt><i>expr</i></tt> [<tt><i>stream</i></tt>])</code> [LISP] – print an expression on a new line
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to be printed</div>
<div style="padding-left: 2em;"> <i>stream</i> – the output stream (default is standard output)</div>
<div style="padding-left: 2em;"> returns – the expression<br>
</div>
<br>
<code>prin1<a name="index1706"></a>(<i>expr</i> [, <i>stream</i>])</code> [SAL]<br>
<code>(prin1 <tt><i>expr</i></tt> [<tt><i>stream</i></tt>])</code> [LISP] – print an expression<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to be printed</div>
<div style="padding-left: 2em;"> <i>stream</i> – the output stream (default is standard output)</div>
<div style="padding-left: 2em;"> returns – the expression<br>
</div>
<br>
<code>princ<a name="index1707"></a>(<i>expr</i> [, <i>stream</i>])</code> [SAL]<br>
<code>(princ <tt><i>expr</i></tt> [<tt><i>stream</i></tt>])</code> [LISP] – print an expression without quoting<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expressions to be printed</div>
<div style="padding-left: 2em;"> <i>stream</i> – the output stream (default is standard output)</div>
<div style="padding-left: 2em;"> returns – the expression<br>
</div>
<br>
<code>pprint<a name="index1708"></a>(<i>expr</i> [, <i>stream</i>])</code> [SAL]<br>
<code>(pprint <tt><i>expr</i></tt> [<tt><i>stream</i></tt>])</code> [LISP] – pretty print an expression<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expressions to be printed</div>
<div style="padding-left: 2em;"> <i>stream</i> – the output stream (default is standard output)</div>
<div style="padding-left: 2em;"> returns – the expression<br>
</div>
<br>
<code>terpri<a name="index1709"></a>([<i>stream</i>])</code> [SAL]<br>
<code>(terpri [<tt><i>stream</i></tt>])</code> [LISP] – terminate the current print line<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the output stream (default is standard output)</div>
<div style="padding-left: 2em;"> returns – <code>nil</code><br>
</div>
<br>
<code>flatsize<a name="index1710"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(flatsize <tt><i>expr</i></tt>)</code> [LISP] – length of printed representation using prin1<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression</div>
<div style="padding-left: 2em;"> returns – the length<br>
</div>
<br>
<code>flatc<a name="index1711"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(flatc <tt><i>expr</i></tt>)</code> [LISP] – length of printed representation using princ<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression</div>
<div style="padding-left: 2em;"> returns – the length<br>
</div>
</div>
<p>
<a name = "259"><h3>The Format Function</h3></a><a name="index1712"></a>
<div style="padding-left: 0em;">
<code>format<a name="index1713"></a>(<i>stream</i>, <i>fmt</i>, <i>arg</i><span style="font-style:normal">...</span>)</code> [SAL]<br>
<code>(format <tt><i>stream</i></tt> <tt><i>fmt</i></tt> <tt><i>arg</i></tt><span style="font-style:normal">...</span>)</code> [LISP] – do formated<br>
output
</div><div style="padding-left: 2em;">
<i>stream</i> – the output stream</div>
<div style="padding-left: 2em;"> <i>fmt</i> – the format string</div>
<div style="padding-left: 2em;"> <i>arg</i> – the format arguments</div>
<div style="padding-left: 2em;"> returns – output string if <i>stream</i> is <code>nil</code>, <code>nil</code> otherwise<br>
</div>
</div>
The format string can contain characters that should be copied
directly to the output and formatting directives. The
formatting directives are:
<blockquote>
<code>~A</code> – print next argument using princ<br>
<code>~S</code> – print next argument using prin1<br>
<code>~%</code> – start a new line<br>
<code>~~</code> – print a tilde character<br>
<code>~</code><newline> – ignore this one newline and white space on the <br>
next line up to the first non-white-space character or newline. This <br>
allows strings to continue across multiple lines<br>
</blockquote>
<p>
<a name = "260"><h3>File I/O Functions</h3></a><a name="index1714"></a>
Note that files are ordinarily opened as text. Binary files (such as standard midi files) must be opened with <code>open-binary</code> on non-unix systems.
<p>
<p>
<div style="padding-left: 0em;">
<code>open<a name="index1715"></a>(<i>fname</i>, direction: <i>direction</i>)</code> [SAL]<br>
<code>(open <tt><i>fname</i></tt> <tt>&key </tt><tt>:direction</tt>)</code> [LISP] – open a file stream<br>
</div><div style="padding-left: 2em;">
<i>fname</i> – the file name string or symbol</div>
<div style="padding-left: 2em;"> :direction – :input or :output (default is :input)</div>
<div style="padding-left: 2em;"> returns – a stream<br>
</div>
<code>open-binary<a name="index1716"></a>(<i>fname</i>, direction: <i>direction</i>)</code> [SAL]<br>
<code>(open-binary<a name="index1717"></a><a name="index1718"></a> <tt><i>fname</i></tt> <tt>&key </tt><tt>:direction</tt>)</code> [LISP] – open a binary file stream<br>
</div><div style="padding-left: 2em;">
<i>fname</i> – the file name string or symbol</div>
<div style="padding-left: 2em;"> :direction – :input or :output (default is :input)</div>
<div style="padding-left: 2em;"> returns – a stream<br>
</div>
<br>
<code>close<a name="index1719"></a>(<i>stream</i>)</code> [SAL]<br>
<code>(close <tt><i>stream</i></tt>)</code> [LISP] – close a file stream<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the stream</div>
<div style="padding-left: 2em;"> returns – <code>nil</code><br>
</div>
<br>
<code>setdir<a name="index1720"></a>(<i>path</i> [, <i>verbose</i>])</code> [SAL]<br>
<code>(setdir<a name="index1721"></a> <tt><i>path</i></tt> [<tt><i>verbose</i></tt>])</code> [LISP] <a href = "foot.html#foot11">(Footnote 11)</a> – set current directory<br>
</div><div style="padding-left: 2em;">
<i>path</i> – the path of the new directory</div>
<div style="padding-left: 2em;"> <i>verbose</i> – print error message if current directory cannot be changed to <i>path</i></div>
<div style="padding-left: 2em;"> returns – the resulting full path, e.g. (setdir ".") gets the current working directory, or <code>nil</code> if an error occurs<br>
</div>
<br>
<code>listdir<a name="index1722"></a>(<i>path</i>)</code> [SAL]<br>
<code>(listdir<a name="index1723"></a><a name="index1724"></a><a name="index1725"></a><a name="index1726"></a> <tt><i>path</i></tt>)</code> [LISP] <a href = "foot.html#foot12">(Footnote 12)</a> – get a directory listing<br>
</div><div style="padding-left: 2em;">
<i>path</i> – the path of the directory to be listed</div>
<div style="padding-left: 2em;"> returns – list of filenames in the directory<br>
</div>
<br>
<code>get-temp-path<a name="index1727"></a>()</code> [SAL]<br>
<code>(get-temp-path<a name="index1728"></a><a name="index1729"></a>)</code> [LISP] <a href = "foot.html#foot13">(Footnote 13)</a> – get a path where a temporary file can be created. Under Windows, this is based on environment variables. If XLISP is running as a sub-process to Java, the environment may not exist, in which case the default result is the unfortunate choice <code>c:\windows\</code>.<br>
</div><div style="padding-left: 2em;">
returns – the resulting full path as a string<br>
</div>
<br>
<code>get-user<a name="index1730"></a>()</code> [SAL]<br>
<code>(get-user<a name="index1731"></a><a name="index1732"></a>)</code> [LISP] <a href = "foot.html#foot14">(Footnote 14)</a> – get the user ID. In Unix systems (including OS X and Linux), this is the value of the USER environment variable. In Windows, this is currently just "nyquist", which is also returned if the environment variable cannot be accessed. This function is used to avoid the case of two users creating files of the same name in the same temp directory.<br>
</div><div style="padding-left: 2em;">
returns – the string naming the user<br>
</div>
<code>find-in-xlisp-path<a name="index1733"></a>(<i>filename</i>)</code> [SAL]<br>
<code>(find-in-xlisp-path <tt><i>filename</i></tt>)</code> [LISP] <a href = "foot.html#foot15">(Footnote 15)</a> – search the XLISP search path (e.g. <code>XLISPPATH</code> from the environment) for <i>filename</i>. If <i>filename</i> is not found as is, and there is no file extension, append "<code>.lsp</code>" to <i>filename</i> and search again. The current directory is not searched.<br>
</div><div style="padding-left: 2em;">
<i>filename</i> – the name of the file to search for</div>
<div style="padding-left: 2em;"> returns – a full path name to the first occurrence found<br>
</div>
<br>
<code>read-char<a name="index1734"></a>([<i>stream</i>])</code> [SAL]<br>
<code>(read-char<a name="index1735"></a> [<tt><i>stream</i></tt>])</code> [LISP] – read a character from a stream<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the input stream (default is standard input)</div>
<div style="padding-left: 2em;"> returns – the character<br>
</div>
<br>
<code>peek-char<a name="index1736"></a>([<i>flag</i> [, <i>stream</i>]])</code> [SAL]<br>
<code>(peek-char [<tt><i>flag</i></tt> [<tt><i>stream</i></tt>]])</code> [LISP] – peek at the next character<br>
</div><div style="padding-left: 2em;">
<i>flag</i> – flag for skipping white space (default is <code>nil</code>)</div>
<div style="padding-left: 2em;"> <i>stream</i> – the input stream (default is standard input)</div>
<div style="padding-left: 2em;"> returns – the character (integer)<br>
</div>
<br>
<code>write-char<a name="index1737"></a>(<i>ch</i> [, <i>stream</i>])</code> [SAL]<br>
<code>(write-char <tt><i>ch</i></tt> [<tt><i>stream</i></tt>])</code> [LISP] – write a character to a stream<br>
</div><div style="padding-left: 2em;">
<i>ch</i> – the character to write</div>
<div style="padding-left: 2em;"> <i>stream</i> – the output stream (default is standard output)</div>
<div style="padding-left: 2em;"> returns – the character<br>
</div>
<br>
<code>read-int<a name="index1738"></a>([<i>stream</i> [, <i>length</i>]])</code> [SAL]<br>
<code>(read-int [<tt><i>stream</i></tt> [<tt><i>length</i></tt>]])</code> [LISP] – read a binary integer from a stream<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the input stream (default is standard input)</div>
<div style="padding-left: 2em;"> <i>length</i> – the length of the integer in bytes (default is 4)</div>
<div style="padding-left: 2em;"> returns – the integer</div>
<div style="padding-left: 2em;">Note: Integers are assumed to be big-endian (high-order byte first) and <br>
signed, regardless of the platform. To read little-endian format, use a<br>
negative number for the length, e.g. -4 indicates a 4-bytes, low-order<br>
byte first. The file should be opened in binary mode.<br>
</div>
<br>
<code>write-int<a name="index1739"></a>(<i>ch</i> [, <i>stream</i> [, <i>length</i>]])</code> [SAL]<br>
<code>(write-int <tt><i>ch</i></tt> [<tt><i>stream</i></tt> [<tt><i>length</i></tt>]])</code> [LISP] – write a binary integer to a stream<br>
</div><div style="padding-left: 2em;">
<i>ch</i> – the character to write</div>
<div style="padding-left: 2em;"> <i>stream</i> – the output stream (default is standard output)</div>
<div style="padding-left: 2em;"> <i>length</i> – the length of the integer in bytes (default is 4)</div>
<div style="padding-left: 2em;"> returns – the integer</div>
<div style="padding-left: 2em;">Note: Integers are assumed to be big-endian (high-order byte first) and <br>
signed, regardless of the platform. To write in little-endian format, use a<br>
negative number for the length, e.g. -4 indicates a 4-bytes, low-order<br>
byte first. The file should be opened in binary mode.<br>
</div>
<br>
<code>read-float<a name="index1740"></a>([<i>stream</i> [, <i>length</i>]])</code> [SAL]<br>
<code>(read-float [<tt><i>stream</i></tt> [<tt><i>length</i></tt>]])</code> [LISP] – read a binary floating-point number from a stream<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the input stream (default is standard input)</div>
<div style="padding-left: 2em;"> <i>length</i> – the length of the float in bytes (default is 4, legal values are -4, -8, 4, and 8)</div>
<div style="padding-left: 2em;"> returns – the integer</div>
<div style="padding-left: 2em;">Note: Floats are assumed to be big-endian (high-order byte first) and <br>
signed, regardless of the platform. To read little-endian format, use a<br>
negative number for the length, e.g. -4 indicates a 4-bytes, low-order<br>
byte first. The file should be opened in binary mode.<br>
</div>
<br>
<code>write-float<a name="index1741"></a>(<i>ch</i> [, <i>stream</i> [, <i>length</i>]])</code> [SAL]<br>
<code>(write-float <tt><i>ch</i></tt> [<tt><i>stream</i></tt> [<tt><i>length</i></tt>]])</code> [LISP] – write a binary floating-point number to a stream<br>
</div><div style="padding-left: 2em;">
<i>ch</i> – the character to write</div>
<div style="padding-left: 2em;"> <i>stream</i> – the output stream (default is standard output)</div>
<div style="padding-left: 2em;"> <i>length</i> – the length of the float in bytes (default is 4, legal values are -4, -8, 4, and 8)</div>
<div style="padding-left: 2em;"> returns – the integer</div>
<div style="padding-left: 2em;">Note: Floats are assumed to be big-endian (high-order byte first) and <br>
signed, regardless of the platform. To write in little-endian format, use a<br>
negative number for the length, e.g. -4 indicates a 4-bytes, low-order<br>
byte first. The file should be opened in binary mode.<br>
</div>
<br>
<code>read-line<a name="index1742"></a>([<i>stream</i>])</code> [SAL]<br>
<code>(read-line [<tt><i>stream</i></tt>])</code> [LISP] – read a line from a stream<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the input stream (default is standard input)</div>
<div style="padding-left: 2em;"> returns – the string<br>
</div>
<br>
<code>read-byte<a name="index1743"></a>([<i>stream</i>])</code> [SAL]<br>
<code>(read-byte [<tt><i>stream</i></tt>])</code> [LISP] – read a byte from a stream<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the input stream (default is standard input)</div>
<div style="padding-left: 2em;"> returns – the byte (integer)<br>
</div>
<br>
<code>write-byte<a name="index1744"></a>(<i>byte</i> [, <i>stream</i>])</code> [SAL]<br>
<code>(write-byte <tt><i>byte</i></tt> [<tt><i>stream</i></tt>])</code> [LISP] – write a byte to a stream<br>
</div><div style="padding-left: 2em;">
<i>byte</i> – the byte to write (integer)</div>
<div style="padding-left: 2em;"> <i>stream</i> – the output stream (default is standard output)</div>
<div style="padding-left: 2em;"> returns – the byte (integer)<br>
</div>
</div>
<p>
<a name = "261"><h3>String Stream Functions</h3></a><a name="index1745"></a>
These functions operate on unnamed streams. An unnamed output
stream collects characters sent to it when it is used as the
destination of any output function. The functions
<code>get-output-stream-string</code> and <code>get-output-stream-list</code> return a string or a list of characters.
<p>
An unnamed input stream is setup with the
<code>make-string-input-stream</code> function and returns each character of the string when
it is used as the source of any input function.
<p>
<div style="padding-left: 0em;">
<code>make-string-input-stream<a name="index1746"></a>(<i>str</i> [, <i>start</i> [, <i>end</i>]])</code> [SAL]<br>
<code>(make-string-input-stream <tt><i>str</i></tt> [<tt><i>start</i></tt> [<tt><i>end</i></tt>]])</code> [LISP]<br>
</div><div style="padding-left: 2em;">
<i>str</i> – the string</div>
<div style="padding-left: 2em;"> <i>start</i> – the starting offset</div>
<div style="padding-left: 2em;"> <i>end</i> – the ending offset + 1</div>
<div style="padding-left: 2em;"> returns – an unnamed stream that reads from the string<br>
</div>
<br>
<code>make-string-output-stream)<a name="index1747"></a>()</code> [SAL]<br>
<code>(make-string-output-stream)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
returns – an unnamed output stream<br>
</div>
<br>
<code>get-output-stream-string<a name="index1748"></a>(<i>stream</i>)</code> [SAL]<br>
<code>(get-output-stream-string <tt><i>stream</i></tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the output stream</div>
<div style="padding-left: 2em;"> returns – the output so far as a string</div>
<div style="padding-left: 2em;"> Note: the output stream is emptied by this function<br>
</div>
<br>
<code>get-output-stream-list<a name="index1749"></a>(<i>stream</i>)</code> [SAL]<br>
<code>(get-output-stream-list <tt><i>stream</i></tt>)</code> [LISP]<br>
</div><div style="padding-left: 2em;">
<i>stream</i> – the output stream</div>
<div style="padding-left: 2em;"> returns – the output so far as a list</div>
<div style="padding-left: 2em;"> Note: the output stream is emptied by this function<br>
</div>
</div>
<p>
<a name = "262"><h3>System Functions</h3></a><a name="index1750"></a>
Note: the <code>load</code> function first tries to load a file from the current directory. A <code>.lsp</code> extension is added if there is not already an alphanumeric extension following a period. If that fails, XLISP searches the path, which is obtained from the XLISPPATH environment variable in Unix and HKEY_LOCAL_MACHINE\SOFTWARE\CMU\Nyquist\XLISPPATH under Win32. (The Macintosh version has no search path.)
<p>
<p>
<div style="padding-left: 0em;">
<code>get-env<a name="index1751"></a>(<i>name</i>)</code> [SAL]<br>
<code>(get-env<a name="index1752"></a><a name="index1753"></a> <tt><i>name</i></tt>)</code> [LISP] – get from an environment variable<br>
</div><div style="padding-left: 2em;">
<i>name</i> – the name of the environment variable</div>
<div style="padding-left: 2em;"> returns – string value of the environment variable, <code>nil</code> if variable does not exist<br>
</div>
<br>
<code>(load<a name="index1754"></a> <tt><i>fname</i></tt> <tt>&key </tt><tt>:verbose</tt> <tt>:print</tt>)</code> [LISP] – load a source file
</div><div style="padding-left: 2em;">
<i>fname</i> – the filename string or symbol</div>
<div style="padding-left: 2em;"> :verbose – the verbose flag (default is t)</div>
<div style="padding-left: 2em;"> :print – the print flag (default is <code>nil</code>)</div>
<div style="padding-left: 2em;"> returns – the filename<br>
</div>
<br>
<code>save<a name="index1755"></a>(<i>fname</i>)</code> [SAL]<br>
<code>(save <tt><i>fname</i></tt>)</code> [LISP] – save workspace to a file<br>
</div><div style="padding-left: 2em;">
<i>fname</i> – the filename string or symbol</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if workspace was written, <code>nil</code> otherwise<br>
</div>
<br>
<code>restore<a name="index1756"></a>(<i>fname</i>)</code> [SAL]<br>
<code>(restore <tt><i>fname</i></tt>)</code> [LISP] – restore workspace from a file<br>
</div><div style="padding-left: 2em;">
<i>fname</i> – the filename string or symbol</div>
<div style="padding-left: 2em;"> returns – <code>nil</code> on failure, otherwise never returns<br>
</div>
<br>
<code>dribble<a name="index1757"></a>([<i>fname</i>])</code> [SAL]<br>
<code>(dribble [<tt><i>fname</i></tt>])</code> [LISP] – create a file with a transcript of a session<br>
</div><div style="padding-left: 2em;">
<i>fname</i> – file name string or symbol<br>
(if missing, close current transcript)</div>
<div style="padding-left: 2em;"> returns – <code>t</code> if the transcript is opened, <code>nil</code> if it is closed<br>
</div>
<br>
<code>gc<a name="index1758"></a>()</code> [SAL]<br>
<code>(gc)</code> [LISP] – force garbage collection<br>
</div><div style="padding-left: 2em;">
returns – <code>nil</code><br>
</div>
<br>
<code>expand<a name="index1759"></a>(<i>num</i>)</code> [SAL]<br>
<code>(expand <tt><i>num</i></tt>)</code> [LISP] – expand memory by adding segments<br>
</div><div style="padding-left: 2em;">
<i>num</i> – the number of segments to add</div>
<div style="padding-left: 2em;"> returns – the number of segments added<br>
</div>
<br>
<code>alloc<a name="index1760"></a>(<i>num</i>)</code> [SAL]<br>
<code>(alloc <tt><i>num</i></tt>)</code> [LISP] – change number of nodes to allocate in each segment<br>
</div><div style="padding-left: 2em;">
<i>num</i> – the number of nodes to allocate</div>
<div style="padding-left: 2em;"> returns – the old number of nodes to allocate<br>
</div>
<br>
<code>info<a name="index1761"></a>()</code> [SAL]<br>
<code>(info)</code> [LISP] – show information about memory usage.<br>
</div><div style="padding-left: 2em;">
returns – <code>nil</code><br>
</div>
<br>
<code>room<a name="index1762"></a>()</code> [SAL]<br>
<code>(room)</code> [LISP] – show memory allocation statistics<br>
</div><div style="padding-left: 2em;">
returns – <code>nil</code><br>
</div>
<br>
<code>type-of<a name="index1763"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(type-of <tt><i>expr</i></tt>)</code> [LISP] – returns the type of the expression<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the expression to return the type of</div>
<div style="padding-left: 2em;"> returns – <code>nil</code> if the value is <code>nil</code> otherwise one of the symbols:<br>
</div><div style="padding-left: 4em;">
SYMBOL – for symbols</div>
<div style="padding-left: 4em;"> OBJECT – for objects</div>
<div style="padding-left: 4em;"> CONS – for conses</div>
<div style="padding-left: 4em;"> SUBR – for built-in functions</div>
<div style="padding-left: 4em;"> FSUBR – for special forms</div>
<div style="padding-left: 4em;"> CLOSURE – for defined functions</div>
<div style="padding-left: 4em;"> STRING – for strings</div>
<div style="padding-left: 4em;"> FIXNUM – for integers</div>
<div style="padding-left: 4em;"> FLONUM – for floating point numbers</div>
<div style="padding-left: 4em;"> CHARACTER – for characters</div>
<div style="padding-left: 4em;"> FILE-STREAM – for file pointers</div>
<div style="padding-left: 4em;"> UNNAMED-STREAM – for unnamed streams</div>
<div style="padding-left: 4em;"> ARRAY – for arrays<br>
</div>
</div>
<br>
<code>peek<a name="index1764"></a>(<i>addrs</i>)</code> [SAL]<br>
<code>(peek <tt><i>addrs</i></tt>)</code> [LISP] – peek at a location in memory<br>
</div><div style="padding-left: 2em;">
<i>addrs</i> – the address to peek at (integer)</div>
<div style="padding-left: 2em;"> returns – the value at the specified address (integer)<br>
</div>
<br>
<code>poke<a name="index1765"></a>(<i>addrs</i>, <i>value</i>)</code> [SAL]<br>
<code>(poke <tt><i>addrs</i></tt> <tt><i>value</i></tt>)</code> [LISP] – poke a value into memory<br>
</div><div style="padding-left: 2em;">
<i>addrs</i> – the address to poke (integer)</div>
<div style="padding-left: 2em;"> <i>value</i> – the value to poke into the address (integer)</div>
<div style="padding-left: 2em;"> returns – the value<br>
</div>
<br>
<code>bigendianp<a name="index1766"></a>()</code> [SAL]<br>
<code>(bigendianp<a name="index1767"></a><a name="index1768"></a><a name="index1769"></a>)</code> [LISP] – is this a big-endian machine?<br>
</div><div style="padding-left: 2em;">
returns – T if this a big-endian architecture, storing the high-order byte of an integer at the lowest byte address of the integer; otherwise, NIL.<br>
<a href = "foot.html#foot16">(Footnote 16)</a> <br>
</div>
<br>
<code>address-of<a name="index1770"></a>(<i>expr</i>)</code> [SAL]<br>
<code>(address-of <tt><i>expr</i></tt>)</code> [LISP] – get the address of an xlisp node<br>
</div><div style="padding-left: 2em;">
<i>expr</i> – the node</div>
<div style="padding-left: 2em;"> returns – the address of the node (integer)<br>
</div>
<br>
<code>exit<a name="index1771"></a>()</code> [SAL]<br>
<code>(exit)</code> [LISP] –<br>
exit xlisp. (Note: in Audacity plug-ins, <code>exit</code> is<br>
undefined because exiting would terminate Audacity.)<br>
</div><div style="padding-left: 2em;">
returns – never returns<br>
</div>
<br>
<code>setup-console<a name="index1772"></a>()</code> [SAL]<br>
<code>(setup-console<a name="index1773"></a>)</code> [LISP] – set default console attributes<br>
</div><div style="padding-left: 2em;">
returns – NIL</div>
<div style="padding-left: 2em;">Note: Under Windows, Nyquist normally starts up in a medium-sized console window with black text and a white background, with a window title of "Nyquist." This is normally accomplished by calling <code>setup-console</code> in <code>system.lsp</code>. In Nyquist, you can avoid this behavior by setting <code>*setup-console*</code> to NIL in your <code>init.lsp</code> file. If <code>setup-console</code> is not called, Nyquist uses standard input and output as is. This is what you want if you are running Nyquist inside of emacs, for example.<a name="index1774"></a><br>
</div>
<br>
<code>echoenabled<a name="index1775"></a>(<i>flag</i>)</code> [SAL]<br>
<code>(echoenabled<a name="index1776"></a> <tt><i>flag</i></tt>)</code> [LISP] – turn console input echoing on or off<br>
</div><div style="padding-left: 2em;">
<i>flag</i> – T to enable echo, NIL to disable</div>
<div style="padding-left: 2em;"> returns – NIL</div>
<div style="padding-left: 2em;">Note: This function is only implemented under Linux and Mac OS X. If Nyquist I/O is redirected through pipes,<br>
the Windows version does not echo the input, but the Linux and Mac versions do. You can turn off echoing with<br>
this function. Under windows it is defined to do nothing.<br>
</div>
</div>
<p>
<a name = "263"><h3>File I/O Functions</h3></a><a name="index1777"></a>
<p>
<a name = "264"><h4>Input from a File</h4></a><a name="index1778"></a>
<p>
To open a file for input, use the <code>open</code> function with the keyword
argument <code>:direction</code> set to <code>:input</code>. To open a file for output,
use the <code>open</code> function with the keyword argument <code>:direction</code> set
to <code>:output</code>. The <code>open</code> function takes a single required argument which
is the name of the file to be opened. This name can be in the form of a
string or a symbol. The <code>open</code> function returns an object of type
<code>FILE-STREAM</code> if it succeeds in opening the specified file. It returns the
value <code>nil</code> if it fails. In order to manipulate the file, it is
necessary to save the value returned by the <code>open</code> function. This is
usually done by assigning it to a variable with the <code>setq</code> special form or by
binding it using <code>let</code> or <code>let*</code>. Here is an example:
<p><pre>
(setq fp (open "init.lsp" :direction :input))
</pre></p>
Evaluating this expression will result in the file <code>init.lsp</code>
being opened. The file object that will be returned by the <code>open</code>
function will be assigned to the variable <code>fp</code>.
<p>
It is now possible to use the file for input. To read an
expression from the file, just supply the value of the <code>fp</code>
variable as the optional <i>stream</i> argument to <code>read</code>.
<p><pre>
(read fp)
</pre></p>
Evaluating this expression will result in reading the first
expression from the file <code>init.lsp</code>. The expression will be
returned as the result of the <code>read</code> function. More expressions
can be read from the file using further calls to the <code>read</code>
function. When there are no more expressions to read, the <code>read</code>
function will return <code>nil</code> (or whatever value was supplied as the
second argument to <code>read</code>).
<p>
Once you are done reading from the file, you should close it.
To close the file, use the following expression:
<p><pre>
(close fp)
</pre></p>
Evaluating this expression will cause the file to be closed.
<p>
<a name = "265"><h4>Output to a File</h4></a><a name="index1779"></a>
<p>
Writing to a file is pretty much the same as reading from one.
You need to open the file first. This time you should use the
<code>open</code> function to indicate that you will do output to the file.
For example:
<p><pre>
(setq fp (open "test.dat" :direction :output))
</pre></p>
Evaluating this expression will open the file <code>test.dat</code> for
output. If the file already exists, its current contents will
be discarded. If it doesn't already exist, it will be created.
In any case, a <code>FILE-STREAM</code> object will be returned by the <code>OPEN</code>
function. This file object will be assigned to the <code>fp</code>
variable.
<p>
It is now possible to write to this file by supplying the value
of the <code>fp</code> variable as the optional <i>stream</i> parameter in the <code>print</code> function.
<p><pre>
(print "Hello there" fp)
</pre></p>
Evaluating this expression will result in the string "Hello
there" being written to the file <code>test.dat</code>. More data can be
written to the file using the same technique.
<p>
Once you are done writing to the file, you should close it.
Closing an output file is just like closing an input file.
<p><pre>
(close fp)
</pre></p>
Evaluating this expression will close the output file and make
it permanent.
<p>
<a name = "266"><h4>A Slightly More Complicated File Example</h4></a>
<p>
This example shows how to open a file, read each Lisp expression
from the file and print it. It demonstrates the use of files
and the use of the optional <i>stream</i> argument to the <code>read</code>
function.
<p><pre>
(do* ((fp (open "test.dat" :direction :input))
(ex (read fp) (read fp)))
((null ex) nil)
(print ex))
</pre></p>
<hr>
<a href = "part18.html">Previous Section</a> | <a href = "indx.html">Next Section (Index)</a> | <a href = "title.html#toc">Table of Contents</a> | <a href = "title.html">Title Page</a>
</body></html>
|