Page Numbers: Yes X: 306 Y: 1.0" First Page: 45 Margins: Top: 1.0" Bottom: 1.3" Heading: z18344l3000x3e4qk40(0,65535)\g STANDARD PROCEDURE GUIDE 3-LISP REFERENCE MANUAL January 25, 1983l3000d2469y756x3e4qk40(0,2999)(1,8678)(2,16416)(13,0)\f7g1f1 l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(13,65535)\g (LENGTH VEC)l7938d2999x2(0,7938)\f8bg8i3I1f0B Designates the numeric length of the rail or sequence designated by VEC; returns the numeral for that number providing it is finite (LENGTH of an infinite vector will never return).l4064x2e3j\g68f3i3f0I62f3 6f0 42f3 Properties: Primitive; protected.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I22i F-Type: [ {RAILS U SEQUENCES} ] _ NUMBERSl6068d4057x2e3\f2g1f0i6I1f3bi9f4BI1f3bi14f4BI1f3 1bi7f0B Examples: (LENGTH '[A B C]) g 3 (LENGTH (SCONS)) g 0 (LENGTH "Five") g 4 (LENGTH 3) g {ERROR: Vector expected.}l6068d4057x2e3(1,10880)(2,11648)\ig10f3I18f4 1f3 2f0 1f3 16f0 1f4 1f3 19f4 1f3 2f0 1f3 10f0 1f4 1f3 1i25f0 Semantics: S(E0("LENGTH),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)\ig10I1f2 1f3 2f6o254 1f3o0 2i6I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (NTH N VEC)l7938d2999x2(0,7938)\f8bg5i1I1i3I1f0B Designates the N'th element of the rail or sequence designated by VEC. Vector elements are numbered starting at 1, not 0; therefore N may range from 1 to the length of the designation of VEC. If VEC designates a sequence, then (NTH N VEC) will return the N'th element of the rail to which VEC normalises.l4064x2e3j\g15f3i1f0I50f3i3f0I44f7 1f0 6f7 1f0 12f3i1f0I16f7 1f0 37f3i3f0I1f3 2f0 3f3i3f0I29f3 4i6I1f0 17f3i1f0I33f3i3f0I12f3 Properties: Primitive; protected; kernel.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I30i F-Types: [ NUMBERS X RAILS ] _ STRUCTURES [ NUMBERS X SEQUENCES ] _ OBJECTSl6068d4057x2e3\f2g1f0i7I1f3bi10f4BI1f3bi9f4BI1f3 1bi10I1i10f4BI1f3bi13f4BI1f3 1bi7f0B Examples: (NTH 1 [(+ 5 5) 20 30]) g 10 (NTH 2 ['10 '20 '30]) g '20 (NTH 3 '[10 20 30]) g '30 (NTH 2 [10]) g {ERROR: Index too large.} (NTH '2 [10 20 30]) g {ERROR: Number expected.} (NTH 1 10) g {ERROR: Vector expected.}l6068d4057x2e3(1,10464)(2,11648)\ig10f3I24f4 1f3 3f0 1f3 21f0 1f4 1f3 4f0 1f3 19f0 1f4 1f3 4f0 1f3 12f0 1f4 1f3 1i25f0I1f3 19f0 1f4 1f3 1i25f0I1f3 10f0 1f4 1f3 1i25f0 Semantics: S(E0("NTH),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 (TAIL N VEC)l7938d2999x2(0,7938)\f8bg6i1I1i3I1f0B Designates the N'th tail of the rail or sequence designated by VEC (where N may range from 0 to the length of VEC). In general, the I'th tail of a vector of length K is that vector consisting of the (I+1)th through Kth element; thus the zeroeth tail of A is identically A. If (TAIL N VEC) designates a sequence, it will return the N'th tail of the rail to which VEC normalises.l4064x2e3j\g15f3i1f0I47f3i3f0I8f3i1f0I35f3i3f0I20f7 1f0 31f7 1f0 35f7 3f0 12f7 1f0 37f3i1f0I16f3i1f0I6f3 6i5I2f0 42f3i1f0I30f3i3f0I12f3 Properties: Primitive; protected; kernel.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I30i F-Types: [ NUMBERS X RAILS ] _ RAILS [ NUMBERS X SEQUENCES ] _ SEQUENCESl6068d4057x2e3\f2g1f0i7I1f3bi9B1f4I1f3i1b7B1f4I1f3 1bi5f0BI1f3bi9B1f4I1f3i1b11B1f4I1f3 1bi9f0B Examples: (TAIL 2 [10 20 30 40]) g [30 40] (TAIL 1 (CDR '(RCONS 'A 'B 'C))) g '['B 'C] (LET [[X '[A B]]] (= X (TAIL 0 X))) g $T (LETSEQ [[X [2 3]] [Y (PREP 1 X)]] (= ^X ^(TAIL 1 Y))) g $T (TAIL 1 [1]) g [] (TAIL 4 "Kangaroo") g "aroo" (TAIL 3 [1 2]) g {ERROR: Index too large.} (TAIL $F [1 2]) g {ERROR: Number expected.} (TAIL 1 #C) g {ERROR: Vector expected.}l6068d4057x2e3(1,12672)(2,13760)(3,16384)\ig10f3I23f4 1f3 8f0 1f3 32f0 1f4 1f3 9f0 1f3 35f0 1f4 1f3 72f4 1f3 3f0 1f3 12f0 1f4 1f3 3f0 1f3 19f0 1f4 1f3 7f0 1f3 14f0 1f4 1f3 1i25f0I1f3 15f0 1f4 1f3 1i25f0I1f3 11f0 1f4 1f3 1i25f0 Semantics: S(E0("TAIL),E,F,C) = l ...l6068d4057x2e3k20(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i4I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (EMPTY VEC)l7938d2999x2(0,7938)\f8bg7i3I1f0B True just in case VEC designates an empty rail or sequence; false in case VEC designates a non-empty rail or sequence; undefined otherwise. Note that (EMPTY VEC) will return $F even if VEC designates an infinite vector (in contrast with LENGTH).l4064x2e3j\g18f3i3f0I53f3i3f0I74f3 7i3I1f0 13f3 2f0 9f3i3f0I49f3 6f0 2f3 Properties: Primitive; protected; kernel.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I30i F-Type: [ {RAILS U SEQUENCES} ] _ TRUTH-VALUESl6068d4057x2e3\f2g1f0i6I1f3bi9f4BI1f3bi14f4BI1f3 1bi12f0B Examples: (EMPTY []) g $T (EMPTY '[A B C]) g $F (EMPTY (SCONS)) g $T (EMPTY (RCONS)) g $T (LET [[X (RCONS '1)]] (BLOCK (REPLACE (TAIL 1 X) X) (EMPTY X))) g $F (EMPTY '(A . B)) g {ERROR: Vector expected.}l6068d4057x2e3(1,10880)(2,11648)\ig10f3I10f0 1f4 1f3 21f4 1f3 3f0 1f3 15f0 1f4 1f3 3f0 1f3 15f0 1f4 1f3 81f4 1f3 3f0 1f3 16f0 1f4 1f3 1i25f0 Semantics: S(E0("EMPTY),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)\ig10I1f2 1f3 2f6o254 1f3o0 2i5I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (UNIT VEC) (DOUBLE VEC)l3008x2(0,7938)\f8bg6i3I1f0B1f8b8i3I1f3B True just in case the vector designated by VEC is of length 1 or 2, respectively. Note that each of these forms will return $F even if VEC designates an infinite vector (i.e., they are defined in terms of EMPTY, not LENGTH).l4064x2e3j\g43f3i3f0I79f3 2f0 9f3i3f0I67f3 5f0 6f3 6f0 2f3 Properties: Protected; kernel.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I19i F-Type: [ {RAILS U SEQUENCES} ] _ TRUTH-VALUESl6068d4057x2e3\f2g1f0i6I1f3bi9f4BI1f3bi13B1f4I1f3 1bi12f0B Examples: (UNIT '[A]) g $T (DOUBLE (REST [10 20 30])) g $T (DOUBLE "Two" g $F (UNIT 1) g {ERROR: Vector expected.}l6068d4057x2e3(1,10976)(2,11776)(3,16384)\ig10f3I12f4 1f3 31f4 1f3 18f4 1f3 12f0 1f4 1f3 1i25I Semantics: S(E0("UNIT),E,F,C) = l ... S(E0("DOUBLE),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i4I11f2 1f0 4i1f2I1f3 2f6o254 1f3o0 2i6I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (FOOT VEC)l7938d2999x2(0,7938)\f8bg6i3I1f0B Designates the empty vector that is the last tail of the vector designated by VEC. If VEC designates a sequence; (FOOT VEC) will return the last tail of the rail to which VEC normalises. FOOT is primarily useful in the (destructive) extending of vectors (see the definition of CONCATENATE in section 8.e, for example). l4064x2e3j\g78f3i3f0I6f3i3f0I24f3 10f0 48f3i3f0I14f3 4f0 86f3 11f0 31f3 Properties: Nothing special.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I17i F-Types: [ RAILS ] _ RAILS [ SEQUENCES ] _ SEQUENCESl6068d4057x2e3(1,12672)(2,13760)(3,16384)\f2g1f0i7I1f3bi9B1f4I1f3 1bi20f4BI1f3bi10f0B Examples: (FOOT [1 2 3]) g [] (= (FOOT [1 2 3]) []) g $T (= (FOOT '[1 2 3]) '[]) g $F (LET [[X (SCONS 10 20)]] (BLOCK (REPLACE (FOOT ^X) '[30 40]) X)) g [10 20 30 40]l6068d4057x2e3(1,10976)(2,11776)\ig10f3I15f4 1f3 26f4 1f3 3f0 1f3 23f0 1f4 1f3 3f0 1f3 78f4 1f3 Semantics: S(E0("FOOT),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i4I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (REST VEC)l7938d2999x2(0,7938)\f8bg6i3I1f0B Designates the first tail of the vector designated by VEC. In case (REST VEC) designates a sequence, it returns the first tail of the vector to which VEC normalises. REST plays the role in 3-LISP that CDR plays in standard LISPs when used on lists signifying enumerations.l4064x2e3j\g54f3i3f0I11f3 6i3I1f0 73f3i3f0I12f3 6f0 19f7 6f0 6f3 3f0 19f7 4f0 45f3 Properties: Protected; kernel.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I19i F-Types: [ RAILS ] _ RAILS [ SEQUENCES ] _ SEQUENCESl6068d4057x2e3\f2g1f0i7I1f3bi9B1f4I1f3 1bi5f0B1f3b13B1f4I1f3 1bi9f0B Examples: (REST [1 2 3]) g [2 3]l6068d4057x2e3(1,9312)(2,10144)(3,16384)\ig10f3I15f4 1f3 Semantics: S(E0("REST),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i4I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (1ST VEC) (2ND VEC) (3RD VEC) (4TH VEC) (5TH VEC) (6TH VEC)l3008x2(0,7938)\f8bg5i3I7i3I7i3I7i3I7i3I7i3I1f3B These forms designate, respectively, the first, second, third, fourth, fifth, and sixth elements of the vector designated by VEC. In case VEC designates a sequence, each returns the Kth element of the rail to which VEC normalises (1<K<6). Defined to be (NTH 1 VEC), (NTH 2 VEC), etc.l4064x2e3qj\g125f3i3f0I11f3i3f0I41f7 1f0 32f3i3f0I13f7 2f4 1f7 3f4 1f7 1f0 18f3 7i3I1f0 2f3 7i3I1f0 6f3 Properties: Protected; kernel (1ST and 2ND only).l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I20f3 3f0 5f3 3f0 7i F-Type: [ SEQUENCES ] _ OBJECTS [ RAILS ] _ STRUCTURESl6068d4057x2e3\f2g1f0i6I1f3bi13B1f4I1f3 1bi17B1f4I1f3 1bi10f0B Examples: (3RD [10 20 30 40]) g 30 (1ST (PREP 'A '[B C])) g 'A (2ND [1]) g {ERROR: Index too large.}l6068d4057x2e3(1,10144)(2,10976)(3,16384)\ig10f3I20f4 1f3 27f4 1f3 14f4 1f3 1i25I Semantics: S(E0("1ST),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i3I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (MEMBER E VEC)l7938d2999x2(0,7938)\f8bg8i1I1i3I1f0B True (designates Truth) just in case the object designated by E is an element of the vector designated by VEC. If (MEMBER E VEC) is true, it is guaranteed to return; if not, it will terminate only if the vector designated by VEC is finite. Note: since MEMBER is defined in terms of =, it can't be used over sequences of functions.l4064x2e3j\g62f3i1f0I43f3i3f0I6f3 8i5I1f0 97f3i3f0I25f3 6f0 24f3 1f0 47f3 Properties: Protected; kernel.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I19i F-Type: [ OBJECTS X {RAILS U SEQUENCES} ] _ TRUTH-VALUESl6068d4057x2e3\f2g1f0i6I1f3bi10f4BI1f3 1bi6BI1f4 1f3 1bi12B1f4I1f3 1bi12f0B Examples: (MEMBER 1 [2 3 4]) g $F (MEMBER 3 [1 1 2 (+ 1 2)]) g $T (MEMBER '2 '[1 2 3]) g $T (MEMBER 2 '[1 2 3]) g $F (MEMBER 2 ['1 '2 '3]) g $F (MEMBER '[] '[[A] [] [B]]) g $F (MEMBER [] [[1] [] [2]]) g $T (MEMBER 1 2) g {ERROR: Vector expected.} (MEMBER * [+ - * /]) g {ERROR: = not defined over functions.}l6068d4057x2e3(1,10784)(2,11584)(3,16384)\ig10f3I19f4 1f3 31f4 1f3 25f4 1f3 24f4 1f3 26f4 1f3 31f4 1f3 29f4 1f3 17f4 1f3 1i25I22f4 1f3 1i38I Semantics: S(E0("MEMBER),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i6I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (VECTOR-CONSTRUCTOR TEMPLATE)l7938d2999x2(0,7938)\f8bg20i8I1f0B Designates the RCONS or SCONS function, depending on whether TEMPLATE designates an internal structure or external object, respectively. Returns the primitive RCONS or SCONS closure, as appropriate. VECTOR-CONSTRUCTOR is primarily useful in the terminating clause of a recursive defintion defined over general vectors (see the definition of MAP in section 8.e, for example).l4064x2e3j\g15f3 5f0 4f3 5f0 32f3i8f0I91f3 5f0 4f3 5f0 27f3 18f0 124f3 3f0 30f3 Properties: Protected; kernel.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I19i F-Type: [ OBJECTS ] _ FUNCTIONSl6068d4057x2e3\f2g1f0i6I1f3bi9BI1bi1B1f4I1f3 1bi9f0B Examples: (VECTOR-CONSTRUCTOR '[]) g {Simple RCONS closure} ((VECTOR-CONSTRUCTOR '[])) g '[] (VECTOR-CONSTRUCTOR 100) g {Simple SCONS closure} ((VECTOR-CONSTRUCTOR 100)) g [] (VECTOR-CONSTRUCTOR ^^1) g '[]l6068d4057x2e3(1,10784)(2,11584)(3,16384)\ig10f3I25f4 1f3 51f4 1f3 30f4 1f3 51f4 1f3 29f4 1f3 Semantics: S(E0("VECTOR-CONSTRUCTOR),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i18I11f2 1f0 4i l6080d2999x2jk100(0,6080)(1,8359)(2,65535)(3,65535)\g (MAP FUN V1 V2 ... Vk)l7938d2999x2(0,7938)\f8bg5i3I1i1f6o254 1f8o0BI1bi1f6o254 1f8o0BI1f9b3f8 1i1f6o254 1f8o0I1f0B Designates the vector obtained by applying the function designated by FUN (of arity k) to the elements of the vectors designated by V1 through Vk. K should be >0; the vectors V1 through Vk should be of equal length. In the case where the Vi designate sequences, returns an otherwise completely inaccessible rail (whose length is the length of each of the Vi) designating this sequence of values.l4064x2e3j\g70f3i3f0I11f3i1f0I47f3i1f6o254 1f0o0I9f3i1f6o254 1f0o0I3f3i1f0I11f4 1f7 2f0 14f3i1f6o254 1f0o0I9f3i1f6o254 1f0o0I51f3i1f6o254 1f0o0I115f3i1f7o254 1f0o0I38f3 Properties: Protected; kernel; cons.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I25i F-Type: [ FUNCTIONS X {SEQUENCES}* ] _ SEQUENCES [ FUNCTIONS X {RAILS}* ] _ RAILSl6068d4057x2e3\f2g1f0i6I1f3bi12f4BI1f3bi16f4BI1f3 1bi22f4BI1f3bi12f4BI1f3 1bi5f0B Examples: (MAP 1+ [2 3 4]) g [3 4 5] (MAP * [1 2 3] [1 2 3]) g [1 4 9] (MAP EF [$T $F] [1 2] [3 4]) g [1 4] (MAP CAR []) g [] (MAP 1+ [1 2 3] [4 5 6]) g {ERROR: Too many arguments.} (MAP 1 [1 2 3]) g {ERROR: Not a function.} (MAP 1+ 100) g {ERROR: Vector expected.}l6068d4057x2e3(1,11328)(2,12096)\ig10f3I17f4 1f3 33f4 1f3 38f4 1f3 20f4 1f3 29f4 1f3 1i28I17f4 1f3 1i24I14f4 1f3 1i25f0 Semantics: S(E0("MAP),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 (COPY-VECTOR VEC)l7938d2999x2(0,7938)\f8bg13i3I1f0B If VEC designates a rail, (COPY-VECTOR VEC) designates an otherwise completely inaccessible rail whose elements are the elements of the rail designated by VEC. If VEC designates a sequence, (COPY-VECTOR VEC) designates the same sequence as VEC, but returns an otherwise completely inaccessible designator (rail) of it. Note that when VEC designates a sequence, (SCONS . VEC) could be used to achieve the same effect.l4064x2e9j\g3f3i3f0I20f3 13i3I1f0 112f3i3f0I6f3i3f0I24f3 13i3I1f0 33f3i3f0I92f3i3f0I25f3 5f0 3f3i3f0I43f3 Properties: Cons.l6068d4057x2e3(0,6068)(1,8928)(2,9856)(3,12256)\ig11I6i F-Types: [ RAILS ] _ RAILS [ SEQUENCES ] _ SEQUENCESl6068d4057x2e3\f2g1f0i7I1f3bi7BI1bi1B1f4I1f3 1bi5BI1bi11BI1bi1B1f4I1f3 1bi9f0B Examples: (COPY-VECTOR '[A B C]) g '[A B C] (COPY-VECTOR []) g [] (LET [[X '[$T]]] (= X (COPY-VECTOR X))) g $F (LET [[Y [1 2 3]]] [(= Y (COPY-VECTOR Y)) (= ^Y ^(COPY-VECTOR Y))]) g [$T $F]l6068d4057x2e3(1,13024)(2,13760)(3,16384)\ig10f3I23f4 1f3 27f4 1f3 44f4 1f3 81f4 1f3 Semantics: S(E0("COPY),E,F,C) = l ...l6068d4057x2e3(1,8928)(2,9856)(3,12256)\ig10I1f2 1f3 2f6o254 1f3o0 2i4I11f2 1f0 4i