Page Numbers: Yes X: 306 Y: 1.0" First Page: 57 Margins: Top: 1.0" Bottom: 1.3" Heading: z18344l3000x2e4qk40(0,65535)\g STANDARD PROCEDURE GUIDE 3-LISP REFERENCE MANUAL January 25, 1983l3000d2469y756x3e4qk40(0,2999)(1,8678)(2,16416)(13,0)\f7g1f1 l3000x3e3k100(0,65535)(1,65535)(2,65535)(13,65535)\bg44f5 9.f. IDENTITYl6080d2999x3e5jk100(0,6080)(1,8359)\f5bg14B l3000x3e3k40(0,65535)(1,65535)\bg44f5 (= E1 E2 ... EK)l7938d2999x2(0,7938)(1,8359)\f8bg3i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f8 1i1f3o254 1f8o0I1f0B When K is two, true if E1 and E2 designate the same structure; false otherwise. However, an error will be detected if both E1 and E2 designate functions. When both E1 and E2 designate sequences, corrseponding elements are (using =) from left to right until it can be established that the two sequences differ, or until an error is detected. Consequently, (= E1 E2) may fail to terminate when E1 and E2 designate infinite sequences (or sequences containing infinite sequences). Note that although equality is defined over closures, it is too fine grained to be used for function identity. When K is greater than 2, EI will not be compared to E1 unless E1 through EI-1 have been determined to all designate the same structure.l4064x2e3j\g5f3 1f0 17f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I87i4I1f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I33f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I57f3 1f0 126f3 3i1f6o254 1f3o0I1i1f6o254 1f3o0I1f0 28f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I194f3 1f0 20f3i1f6o254 1f0o0I25f3i1f6o254 1f0o0I8f3i1f6o254 1f0o0I9f3i1f6o254 3f0o0I58f3 Properties: Primitive; protected; kernel.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I30i F-Type: [ OBJECTS X OBJECTS X {OBJECTS}* ] _ TRUTH-VALUESl6068d4057x2e3(1,10816)(2,11776)(3,13632)\f2g1f0i6I1f3bi10f4BI1f3bi9f4BI1f3bi14f4BI1f3 1bi12f0B Examples: (= 3 (+ 1 2)) g $T (= 5 '5) g $F (= '5 '5) g $T (= $F $F $F $F) g $T (= [10 20] [10 20]) g $T (= '[10 20] '[10 20]) g $F (= '[10 20] ['10 '20]) g $F (= CAR CDR) g {ERROR: = not defined over functions.} (= CAR 3) g $F (= [+ 2] [+ 3]) g {ERROR: = not defined over functions.} (= [2 +] [3 +]) g $F (= + 1 +) g $F (= + + 1) g {ERROR: = not defined over functions.}l6068d4057x2e3\ig10f3I14f4 1f3 3f0 1f3 8f0 1f4 1f3 3f0 1f3 9f0 1f4 1f3 3f0 1f3 15f0 1f4 1f3 3f0 1f3 19f0 1f4 1f3 26f4 1f3 27f4 1f3 16f4 1f3 1i38I11f4 1f3 20f4 1f3 1i38I17f4 1f3 14f4 1f3 14f4 1f3 1i38f0 Semantics: S(E0("=),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i1I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (ISOMORPHIC E1 E2)l7938d2999x2(0,7938)\f8bg12i1f3o254 1f8o0 2f3o254 1f8o0I1f0B True if E1 and E2 designate similar structures; false otherwise. When either E1 or E2 designates an external structure ISOMORPHIC behaves just like =. Otherwise, two internal structures are isomorphic if they are = or have isomorphic corresponding components. ISOMORPHIC may fail to terminate on circular structures. l4064x2e3j\g8f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I61f3i1f6o254 1f0o0I4f3i1f6o254 1f0o0I34f3 10f0 19f3 1f0 65f3 1f0 47f3 10f0 48f3 F-Type: [ OBJECTS X OBJECTS ] _ TRUTH-VALUESl6068d4057x2e3(0,6068)(1,10816)(2,11776)(3,13632)\f2g1f0i6I1f3bi10f4BI1f3bi11f4BI1f3 1bi12f0B Examples: (ISOMORPHIC '5 '5) g $T (ISOMORPHIC '[10 20] '[10 20]) g $T (ISOMORPHIC '[10 20] ['10 '20]) g $F (ISOMORPHIC ^CAR ^CDR) g $F (ISOMORPHIC '(A . B) '(A . B)) g $T (ISOMORPHIC ''[X] ''[X]) g $T (ISOMORPHIC ^(LAMBDA SIMPLE [X] X) ^(LAMBDA SIMPLE [X] X)) g $Tl6068d4057x2e3(1,12347)(2,13053)\ig10f3I18f0 1f4 1f3 3f0 1f3 31f4 1f3 36f4 1f3 27f4 1f3 35f4 1f3 29f4 1f3 75f4 1f3 3f0i Semantics: S(E0("ISOMORPHIC),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i10I11f2 1f0 4i l3000x2e3k100(0,65535)(1,65535)(2,65535)(3,65535)\bg44f5 9.g. ARITHMETIC OPERATIONSl6080d2999x3e5jk100(0,6080)(1,8359)\f5bg28B l3000x2e3k40(0,65535)(1,65535)\bg44f5 (+ N1 N2 ... Nk) (* N1 N2 ... Nk)l3008x2k100(0,6080)(1,8359)\f8bg3i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f7 1f8i1f3o254 1f8o0I1f0B1f8b3i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f7 1f8i1f3o254 1f8o0I1f0B Designate, respectively, the sum and product of the numbers designated by N1 through Nk. (+) designates 0; and (*) designates 1.l4064x2e3j(0,7938)\g74f3i1f6o254 1f0o0I9f3i1f6o254 1f0o0I3f3 3f0 19f3 3f0 Properties: Primitive; protected.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I22i F-Type: [ {NUMBERS}* ] _ NUMBERSl6068d4057x2e3\f2g1f0i6I1f3bi15f4BI1f3 1bi7f0B Examples: (* 2 2 2 2) g 16 (+ 1 3 5) g 9 (+ 3) g 3 (* 3) g 3 (+) g 0 (*) g 1 (+ '1 '2) g {ERROR: Number expected.}l6068d4057x2e3(1,8896)(2,9472)\ig10f3I12f4 1f3 14f4 1f3 9f4 1f3 9f4 1f3 7f4 1f3 7f4 1f3 13f4 1f3 1i25I Semantics: S(E0("+),E,F,C) = l ... S(E0("*),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)\ig10I1f2 1f3 2f6o254 1f3o0 2i1I11f2 1f0 4i1f2I1f3 2f6o254 1f3o0 2i1I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (- N1 N2 ... Nk)l3008x2k100\f8bg3i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f7 1f8i1f3o254 1f8o0I1f0B Designates the difference of the numbers designated by N1 through Nk. k must be at least 1. Specifically, (- N) is equivalent to (- 0 N), and (- N1 N2 ... Nk) is equivalent to (- N1 (+ N2 ... Nk)).l4064x2e3j(0,7938)\g55f3i1f6o254 1f0o0I9f3i1f6o254 1f0o0I3f3i1f0I36f3 3i1I1f0 18f3 5i1I1f0 6f3 3i1f6o254 1f3o0 2f6o254 1f3o0I1f0 3f3 1i1f6o254 1f3o0I1f0 18f3 3i1f6o254 1f3o0I4i1f6o254 1f3o0I1f0 3f3 1i1f6o254 1f3o0I2f0 Properties: Primitive; protected.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I22i F-Type: [ NUMBER X {NUMBERS}* ] _ NUMBERSl6068d4057x2e3\f2g1f0i6I1f3bi10f4BI1f3bi14f4BI1f3 1bi7f0B Examples: (- 100 2) g 98 (- 3) g -3 (- 10 20) g -10 (- 9 1 3 5) g 0 (- 9 (+ 1 3 5)) g 9 (-3) g {ERROR: Not a function.} (- 0 $T) g {ERROR: Number expected.}l6068d4057x2e3(1,8896)(2,9472)\ig10f3I10f4 1f3 10f4 2f3 13f4 2f3 16f4 1f3 19f4 1f3 8f4 1f3 1i24I10f4 1f3 1i25I Semantics: S(E0("-),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)\ig10I1f2 1f3 2f6o254 1f3o0 2i1I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (/ N1 N2)l3008x2k100\f8bg3i1f3o254 1f8o0 2f3o254 1f8o0I1f0B Designates the quotient of the numbers designated by N1 and N2. (/ N1 N2) will cause an error if N2 designates zero. Currently, arithmetic is defined only on integers; ultimately we intend to define full rational (or repeating fraction) arithmetic, with no upper limit on numeral size, and no limit on precision.l4064x2e3j(0,7938)\g53f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I3f3 3i1f6o254 1f0o0I1f3i1f6o254 1f3o0I1f0 24f3i1f6o254 1f0o0I Properties: Primitive; protected.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I22i F-Type: [ NUMBERS X NUMBERS ] _ NUMBERSl6068d4057x2e3\f2g1f0i6I1f3bi10f4BI1f3bi11f4BI1f3 1bi7f0B Examples: (/ 10 3) g 3 (/ -10 3) g -3 (/ 10 -3) g -3 (/ -10 -3) g 3 (/ 100 0) g {ERROR: Division by zero.}l6068d4057x2e3(1,8896)(2,9472)\ig10f3I9f4 1f3 13f4 1f3 14f4 1f3 15f4 1f3 13f4 1f3 1i26I Semantics: S(E0("/),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)\ig10I1f2 1f3 2f6o254 1f3o0 2i1I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (REMAINDER N1 N2)l7938d2999x2(0,7938)\f8bg11i1f3o254 1f8o0 2f3o254 1f8o0I1f0B Designates the remainder upon dividing N1 by N2; error if N2 designates zero.l4064x2e3j\g39f3i1f6o254 1f0o0I4f3i1f6o254 1f0o0I11f3i1f6o254 1f0o0I F-Type: [ NUMBER X NUMBERS ] _ NUMBERSl6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\f2g1f0i6I1f3bi9f4BI1f3bi11f4BI1f3 1bi7f0B Examples: (REMAINDER 10 3) g 1 (REMAINDER 10 -3) g 1 (REMAINDER -10 -3) g -1 (REMAINDER -10 -3) g -1 (REMAINDER 10 0) g {ERROR: Division by zero.}l6068d4057x2e3(1,9525)(2,10583)\ig10f3I17f4 1f3 21f4 1f3 22f4 1f3 23f4 1f3 21f4 1f3 1i26f0 Semantics: S(E0("REMAINDER),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)\ig10I1f2 1f3 2f6o254 1f3o0 2i9I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (1+ N) (1- N)l3008x2jk100(0,7938)\f8bg4i1I1f0B1f8b4i1I1f0B Designates the number one greater than (or one less than) the number designated by N.l4064x2e3j\g83f3i1f0I F-Type: [ NUMBERS ] _ NUMBERSl6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\f2g1f0i6I1f3bi12f4BI1f3 1bi7f0B Examples: (1+ 20) g 21 (MAP 1- [2 3 4]) g [1 2 3]l6068d4057x2e3\ig10f3I8f4 1f3 21f4 1f3 8f0i Semantics: S(E0("1+),E,F,C) = l ... S(E0("1-),E,F,C) = l ...l6068d4057x2e3\ig10I1f2 1f3 2f6o254 1f3o0 2i2I11f2 1f0 4i1f2I1f3 2f6o254 1f3o0 2i2I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (< N1 N2 ... Nk) (<= N1 N2 ... Nk) (> N1 N2 ... Nk) (>= N1 N2 ... Nk)l3008x2k100(0,7938)\f8bg4i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f7 1f8i1f3o254 1f8o0I1f0B1f8b4i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f7 1f8i1f3o254 1f8o0I1f0B1f8b4i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f7 1f8i1f3o254 1f8o0I1f0B1f8b4i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f7 1f8i1f3o254 1f8o0I1f0B True if and only if the number designated by N1 is less than the number designated by N2, the number designated by N2 is less than the number designated by N3, etc. Similarly for the others, except that the relationship is that of being less than or equal (<=), greater than (>), or greater than or equal (>=). In all cases, k must be at least 2.l4064x2e3j\g45f3i1f6o254 1f0o0I39f3i1f6o254 1f0o0I27f3i1f6o254 1f0o0I39f3i1f6o254 1f0o0I100f3 2f0 17f3 1f0 29f3 2f0 18f3i1f0I Properties: Primitive; protected.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I22i F-Type: [ NUMBERS X NUMBERS X {NUMBERS}* ] _ TRUTH-VALUESl6068d4057x2e3\f2g1f0i6I1f3bi10f4BI1f3bi9f4BI1f3bi14f4BI1f3 1bi12f0B Examples: (< 2 3) g $T (>= 5 4 4 2 -7 -1) g $T (<= 99 1 '1) g {ERROR: Number expected.} (> 100 1000) g $Fl6068d4057x2e3(1,9312)(2,9997)\ig10f3I8f4 1f3 23f4 1f3 17f4 1f3 1i25I14f4 1f3 3f0i Semantics: S(E0("<),E,F,C) = l ... S(E0("<=),E,F,C) = l ... S(E0(">),E,F,C) = l ... S(E0(">=),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)\ig10I1f2 1f3 2f6o254 1f3o0 2i1I12f2 1f0 4f2 2f3 2f6o254 1f3o0 2i2I11f2 1f0 4f2 2f3 2f6o254 1f3o0 2i1I12f2 1f0 4f2 2f3 2f6o254 1f3o0 2i2I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (ABS N)l7938d2999x2(0,7938)\f8bg5i1I1f0B Designates the absolute value of the number designated by N.l4064x2e3j\g58f3i1f0I F-Type: [ NUMBER ] _ NUMBERSl6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\f2g1f0i6I1f3bi11f4BI1f3 1bi7f0B Examples: (ABS 100) g 100 (ABS -100) g -100 (ABS 0) g 0 (ABS '1) g {ERROR: Number expected.}l6068d4057x2e3(1,9525)(2,10583)\ig10f3I10f4 1f3 16f4 1f3 14f4 1f3 12f4 1f3 1i25f0 Semantics: S(E0("ABS),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)\ig10I1f2 1f3 2f6o254 1f3o0 2i3I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (MIN N1 N2 ... Nk) (MAX N1 N2 ... Nk)l3008x2k100(0,7938)\f8bg5i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f7 1f8i1f3o254 1f8o0I1f0B1f8b5i1f3o254 1f8o0 2f3o254 1f8o0I1f9 3f7 1f8i1f3o254 1f8o0I1f0B Designate, respectively, the minimum and maximum of the numbers designated by N1 through Nk (K>1).l4064x2e3j\g78f3i1f6o254 1f0o0I9f3i1f6o254 1f0o0I2f3 1f7 1f4 1f7 2f0 2f3 F-Type: [ NUMBERS X {NUMBERS}* ] _ NUMBERSl6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\f2g1f0i6I1f3bi10f4BI1f3bi14f4BI1f3 1bi7f0B Examples: (MIN 3 1 4) g 1 (MIN 0 1 -7) g -7 (MAX 4) g 4l6068d4057x2e3\ig10f3I12f4 1f3 16f4 1f3 12f4 1f3 2f0i Semantics: S(E0("MIN),E,F,C) = l ... S(E0("MAX),E,F,C) = l ...l6068d4057x2e3\ig10I1f2 1f3 2f6o254 1f3o0 2i3I11f2 1f0 4i1f2I1f3 2f6o254 1f3o0 2i3I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (ODD N) (EVEN N)l3008x2k100(0,7938)\f8bg5i1I1f0B1f8b6i1I1f0B True if N designates an odd or even number, respectively.l4064x2e3j\g8f3i1f0I48f3 F-Type: [ NUMBERS ] _ TRUTH-VALUESl6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\f2g1f0i6I1f3bi12f4BI1f3 1bi12f0B Examples: (ODD 100) g $F (EVEN 100) g $T (ODD -1) g $Tl6068d4057x2e3\ig10f3I10f4 1f3 15f4 1f3 13f4 1f3 3f0i Semantics: S(E0("ODD),E,F,C) = l ... S(E0("EVEN),E,F,C) = l ...l6068d4057x2e3\ig10I1f2 1f3 2f6o254 1f3o0 2i3I11f2 1f0 4i1f2I1f3 2f6o254 1f3o0 2i4I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (ZERO N) (NEGATIVE N) (POSITIVE N) (NON-NEGATIVE N)l3008x2k100(0,7938)\f8bg6i1I1f0B1f8b10i1I1f0B1f8b10i1I1f0B1f8b14i1I1f0B True if the number N designates is equal to, less than, greater than, or greater than or equal to zero, respectively..l4064x2e3j\g19f3i1f0I98f3 F-Type: [ NUMBERS ] _ TRUTH-VALUESl6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\f2g1f0i6I1f3bi12f4BI1f3 1bi12f0B Examples: (ZERO 1) g $F (NEGATIVE -1) g $T (POSITIVE 0) g $F (NON-NEGATIVE 0) g $T (POSITIVE -1) g $Fl6068d4057x2e3\ig10f3I9f4 1f3 18f4 1f3 17f4 1f3 21f4 1f3 18f4 1f3 3f0i Semantics: S(E0("ZERO),E,F,C) = l ... S(E0("NEGATIVE),E,F,C) = l ... S(E0("POSITIVE),E,F,C) = l ... S(E0("NON-NEGATIVE),E,F,C) = l ...l6068d4057x2e3\ig10I1f2 1f3 2f6o254 1f3o0 2i4I11f2 1f0 4i1f2I1f3 2f6o254 1f3o0 2i8I11f2 1f0 4i1f2I1f3 2f6o254 1f3o0 2i8I11f2 1f0 4i1f2I1f3 2f6o254 1f3o0 2i12I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (** N1 N2)l7938d2999x2(0,7938)\f8bg4i1f3o254 1f8o0 2f3o254 1f8o0I1f0B Designates the N2-fold product of the number designated by N1 with itself. N2 must designate a non-negative number.l4064x2e3j\g15f3i1f6o254 1f0o0I42f3i2f6o254 1f0o0I15f3i1f6o254 1f0o0I38f3 F-Type: [ NUMBERS X NUMBERS ] _ NUMBERSl6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\f2g1f0i6I1f3bi10f4BI1f3 1bi10f4BI1f3 1bi7f0B Examples: (** 2 10) g 1024 (** 10 0) g 1 (** -5 3) g -125l6068d4057x2e3\ig10f3I10f4 1f3 16f4 1f3 13f4 1f3 5f0i Semantics: S(E0("**),E,F,C) = l ...l6068d4057x2e3\ig10I1f2 1f3 2f6o254 1f3o0 2i2I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (HASH S N)l7938d2999x2(0,7938)\f8bg6i3I1f0B Designates a number in the range from 0 to the number designated by N, based on the identity of the internal structure designated by S. (It would be an understatement to say that the current hashing function is woefully inadequate.)l4064x2e3j\g38f7 1f0 29f3i1f0I64f3bi1f0BI99f3 Properties: Primitive; protected.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I22i F-Type: [ STRUCTURES X NUMBERS ] _ NUMBERSl6068d4057x2e3\f2g1f0i6I1f3bi13f4BI1f3 1bi10f4BI1f3 1bi7f0B Examples: (HASH 'A 0) g 0 (HASH ^LAMBDA (** 2 16)) g {Some large random number (probably).}l6068d4057x2e3(1,10583)(2,11642)\ig10f3I12f4 1f3 28f4 1f3 1f0i Semantics: S(E0("HASH),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)\ig10I1f2 1f3 2f6o254 1f3o0 2i4I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g