Page Numbers: Yes X: 306 Y: 1.0" First Page: 43 Margins: Top: 1.0" Bottom: 1.3" Heading: z18344l3000x3e4q(0,65535) STANDARD PROCEDURES 3-LISP REFERENCE MANUAL March 17, 1984l3000d2469y756x3e4q(0,2999)(1,8678)(2,16381)(13,0)\f7 1f1 l3000x2e3k30(0,65535)(1,65535)(2,65535)(13,65535)\44f5b 4.c.3. FUNCTIONS and CLOSURESl6080d2999x3e5j(0,6080)(1,8359)\f5b17f0 5f5 8B l3000x2e3(0,65535)(1,65535)\44f5b (FUNCTION E) (CLOSURE E)l3008x2e2k30(0,7938)(1,8359)\f8b10i1I1B1b9i1I1B True just in case E designates a function or closure, respectively.l4064x2e2j\18f3i1f0I48f3 F-Type: [ OBJECTS ] _ TRUTH-VALUES Properties: Primitive; kernel.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi12f0B13I20i Examples: (FUNCTION (LAMBDA [N] (* N N))) g $TRUE (CLOSURE (LAMBDA [N] (* N N))) g $FALSE (CLOSURE ^(LAMBDA [N] (* N N))) g $TRUE (CLOSURE (CCONS GLOBAL '[X] 'X )) g $TRUE (CLOSURE 3) g $FALSEl6068d4057e2(1,12992)(2,13696)(3,17639)\i10f3I32f4 1f3 38f4 1f3 40f4 1f3 41f4 1f3 19f4 1f3 (CCONS ENVIRONMENT PATTERN BODY COMMENT)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b7i32I1B Designates an otherwise inaccessible simple closure containing designators of the environment designated by ENVIRONMENT, the pattern designated by PATTERN (either an atom or a sequence of atoms), the body designated by BODY, and a comment (string) designated by COMMENT (which is not used by the system but may be extracted with COMMENT, q.v.). Errors if any argument is of the wrong type.l4064x2e2j\108f3i11f0I28f3i7f0I65f3i4f0I39f3i7f0I60f3 7f0 Properties: Primitive; kernel; cons.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\i11I26i F-Type: [ ENVIRONMENTS X STRUCTURES X STRUCTURES X STRINGS ] _ CLOSURES Properties: Primitive; kernel; cons.l6068d4057x2e2\f2 1f0i6I2f3bi15f4BI1f3bi12f4BI1f3bi12f4BI1f3bi11f4BI1f3 1bi8f0BI1i93I26i Examples: (CCONS GLOBAL '[X] 'X "A Test") g '{simple closure: "A Test"} (LAMBDA [N] (* N N)) g '{simple closure} (^(CCONS GLOBAL '[X] '(+ X 1) "") 10) g 11l6068d4057e2(1,12240)(2,12938)\i10f3I32f4 1f3 50f4 1f3 20f4 1f3 36f4 1f3 3f0i (CLOSURE-ENVIRONMENT CLOSURE)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b21i7I1B Designates the environment in the simple closure designated by CLOSURE. Errors if CLOSURE designates a non-simple closure, or another type of object altogether.l4064x2e2j\63f3i7f0I13f3i7f0I71f3 F-Type: [ CLOSURES ] _ ENVIRONMENTS Properties: Primitive; kernel.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi13f4BI1f3 1bi12f0B13I20i Examples: (CLOSURE-ENVIRONMENT (CCONS GLOBAL '[X] 'X "A Test")) g {the global environment} (CLOSURE-ENVIRONMENT +) g {ERROR: Simple closure expected.} (CLOSURE-ENVIRONMENT ^+) g {the global environment} (CLOSURE-ENVIRONMENT ^IF) g {ERROR: Simple closure expected.} (BINDING 'X (CLOSURE-ENVIRONMENT ^(LET [[X 3]] (LAMBDA [N] (* X N))))) g '3z19403l6068d4057e2(1,12480)(2,13280)(3,17639)\i10f3I57f4 1f3 50f4 1f3 1i33I26f4 1f3 52f4 1f3 1i33I91f4 1f3 (PATTERN CLOSURE)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b9i7I1B Designates the structure that is the pattern in the simple closure designated by CLOSURE. Errors if CLOSURE designates a non-simple closure, or another type of object altogether.l4064x2e2j\81f3i7f0I13f3i7f0I71f3 F-Type: [ CLOSURES ] _ STRUCTURES Properties: Primitive; kernel.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi13f4BI1f3 1bi10f0B13I20i Examples: (PATTERN (CCONS GLOBAL '[X] '(* X X) "")) g '[X] (PATTERN ^(LAMBDA SIMPLE [A B] (PCONS B A))) g '[A B] (PATTERN ^NORMALISE) g '[STRUCTURE ENV ESC CONT] (PATTERN +) g {ERROR: Simple closure expected}z19403l6068d4057e2(1,12832)(2,13378)(3,17639)\i10f3I42f4 1f3 63f0 1f4 1f3 28f0 1f4 1f3 39f4 1f3 1i32I (BODY CLOSURE)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b6i7I1B Designates the structure that is the body of the simple closure designated by CLOSURE. Errors if CLOSURE designates a non-simple closure, or another type of object altogether.l4064x2e2j\78f3i7f0I13f3i7f0I71f3 F-Type: [ CLOSURES ] _ STRUCTURES Properties: Primitive; kernel.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi13f4BI1f3 1bi10f0B13I20i Examples: (BODY (CCONS GLOBAL '[X] '(* X X) "")) g '(* X X) (BODY ^(LAMBDA SIMPLE [A B] (PCONS B A))) g '(PCONS B A) (BODY ^REST) g '(TAIL 1 VECTOR) (BODY +) g {ERROR: Closure expected.}l6068d4057e2(1,12992)(2,13696)(3,17639)\i10f3I39f4 1f3 61f0 1f4 1f3 26f0 1f4 1f3 27f4 1f3 1i26I (COMMENT CLOSURE)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b9i7I1B Designates the string that is the comment in the simple closure designated by CLOSURE. The comment field of a closure is normally set only be DEFINE (q.v.), and is used only by the print routines, solely as a hint to the user about the origin of the closure.l4064x2e2j\78f3i7f0I58f3 6f0 F-Type: [ CLOSURES ] _ STRINGS Properties: Primitive.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi13f4BI1f3 1bi7f0B15I12i Examples: (COMMENT (CCONS GLOBAL '[X] '(* X X) "A Test")) g "A Test" (COMMENT ^(LAMBDA [A B] (PCONS B A))) g "" (BEGIN (DEFINE INCREMENT (LAMBDA [N] (+ N 1))) (COMMENT ^INCREMENT)) g "INCREMENT" (COMMENT +) g {ERROR: Closure expected.}z19297l6068d4057e2(1,13824)(2,14464)(3,17639)\i10f3I48f4 1f3 47f0 1f4 1f3 90f4 1f3 25f4 1f3 1i26I (SIMPLE-CLOSURE CLOSURE) (MACRO-CLOSURE CLOSURE) (REFLECTIVE-CLOSURE CLOSURE) (PRIMITIVE-CLOSURE CLOSURE)x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b16i7I17i7I22i7I21i7I1B True just in case the closure designated by CLOSURE is reflective, primitive, macro, or simple, respectively. All of these procedures cause an error if CLOSURE does not designate a closure. Note that the simple, macro, and reflective closures are exhaustive and mutually exclusive; the primitive closures are a subset of the simple closures.l4064x2e2j\44f3i7f0I102f3i7f0I29f3 1f0 153f3 F-Type: [ CLOSURES ] _ TRUTH-VALUES Properties: Kernel; primitive.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi13f4BI1f3 1bi12f0B13I20i Examples: (SIMPLE-CLOSURE ^+) g $TRUE (REFLECTIVE-CLOSURE ^IF) g $TRUE (PRIMITIVE-CLOSURE ^+) g $TRUE (PRIMITIVE-CLOSURE ^NORMALISE) g $FALSE (PRIMITIVE-CLOSURE ^IF) g $FALSE (REFLECTIVE-CLOSURE ^LET) g $FALSE (MACRO-CLOSURE ^LET) g $TRUE (REFLECTIVE-CLOSURE (CCONS GLOBAL '[X] '(* X X))) g $FALSE (REFLECTIVE-CLOSURE (LAMBDA [N] (+ N N))) g {ERROR: Closure expected.}z18944l6068d4057e2(1,13600)(2,14304)(3,15968)\i10f3I20f4 1f3 32f4 1f3 30f4 1f3 38f4 1f3 32f4 1f3 34f4 1f3 29f4 1f3 60f4 1f3 50f4 1f3 1i26I (MACROIFY FUN) (REFLECTIFY FUN)x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b10i3I14i3I1B Designates an otherwise inaccessible macro or reflective closure, respectively, containing a simple closure designating the function designated by FUN  specifically, the simple closure to which FUN normalises. Both of these procedures cross semantic levels; they are the inverses of DE-REFLECT and EXPANDER, q.v. An error is generated if FUN does not normalise to a simple closure. Note that the argument to REFLECTIFY should designate a function of four arguments: a structure, an environment, an escape, and a continuation.l4064x2e2j\147f3i3f0I2f8 1f0 42f3i3f0I87f3 10f0 5f3 8f0 33f3i3f0I68f3 10f0 107f3 F-Type: [ FUNCTIONS ] _ CLOSURES Properties: Primitive, Cons.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi14f4BI1f3 1bi8f0B14I18i Examples: (REFLECTIFY (LAMBDA [S E X C] 'QUIT!)) g '{reflective closure} (= NORMALISE ^(REFLECTIFY ID)) g True, but not computable ... (MACROIFY IF) g {Error: Simple function expected}z19650l6068d4057e2(1,12864)(2,13568)(3,15968)\i10f3I39f4 1f3 36f4 1f3 17f4 1f3 1f0i28f3I15f4 1f3 1i33I (EXPANDER CLOSURE) (DE-REFLECT CLOSURE)x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b10i7I14i7I1B EXPANDER designates a function that will perform the macro-transformation required in normalising a call that uses the closure CLOSURE. DE-REFLECT designates the function to be used in the reflective processor when processing a call using the closure CLOSURE. In both cases, designates the function designated by the closure stored within the macro or reflective closure designated by CLOSURE, respectively. Note that these procedures cross semantic levels; they are the inverses of REFLECTIFY and MACROIFY, q.v.l4064x2e2j\f3 8f0 119f3i7f0 3f3I10f0 105f3i7f0 3I126f3i7f0I14f3i1f0I77f3 10f0 5f3 8f0 6f3 F-Type: [ CLOSURES ] _ FUNCTIONS Properties: Kernel, Primitive, Cons.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi13f4BI1f3 1bi9f0B13I26i Examples: ((EXPANDER ^DELAY) '[(FOO X)]) g '(LAMBDA [] (FOO X)) ((EXPANDER ^LET) '[[[X 1] (+ X 2)]) g '((LAMBDA [X] (+ X 2)) 1)l6068d4057e2(1,12256)(2,13088)(3,17639)\i10f3I31f4 1f3 58f4 1f3 26f0i (DE-REFLECT (CCONS GLOBAL 'Y 'Z)) g {simple closure} (DE-REFLECT ^IF) g {simple IF closure}l6068d4057e2(3,12256)\i1f3I34f4 1f3 35f4 1f3 20f0i (MACRO-CCONS CLOSURE) (REFLECTIVE-CCONS CLOSURE)x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b13i7I20i7I1B Designates an otherwise inaccessible macro or reflective closure, respectively, containing the simple closure designated by CLOSURE. Rarely used; see MACROIFY and REFLECTIFY, which could have been defined as follows:l4064x2e2j\124f3i7f0I20f3 8f0 5f3 10f0 (DEFINE MACROIFY (COMPOSE MACRO-CCONS UP)) (DEFINE REFLECTIFY (COMPOSE REFLECTIVE-CCONS UP))l6068d4057e2(0,6068)(1,12064)(2,12832)(3,12256)\f3 F-Type: [ CLOSURES ] _ CLOSURES Properties: Kernel, Primitive, Cons.l6068d4057x2e2(1,8928)(2,9856)\f2 1f0i6I2f3bi13f4BI1f3 1bi8f0B13I26i Examples: (MACRO-CCONS (CCONS GLOBAL '[X]  (+ ,X 1))) g '{macro closure} (REFLECTIVE-CCONS ^(LAMBDA [S E X C] 'QUIT!)) g '{reflective closure}l6068d4057e2(1,13792)(2,14528)(3,15840)\i10f3I32f7 1f3 12f4 1f3 67f4 1f3 22f0i (EXTRACT-SIMPLE-CLOSURE CLOSURE)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b24i7I1B Designates the simple closure contained within the macro or reflective closure designated by CLOSURE. Errors if CLOSURE designates a simple closure, or another type of object altogether. Rarely used; see instead DE-REFLECT and EXPANDER, which could have been defined as follows:l4064x2e2j\93f3i7f0I13f3i7f0I67f3 2f0 25f3 10f0 5f3 8f0 43f3 (DEFINE DE-REFLECT (COMPOSE DOWN EXTRACT-SIMPLE-CLOSURE)) (DEFINE EXPANDER (COMPOSE DOWN EXTRACT-SIMPLE-CLOSURE))l6068d4057e2(0,6068)(1,12064)(2,12832)(3,12256)\f3 F-Type: [ CLOSURES ] _ STRUCTURES Properties: Primitive; kernel.l6068d4057x2e2(1,8928)(2,9856)\f2 1f0i6I2f3bi13f4BI1f3 1bi10f0B13I20i Examples: (PATTERN (CCONS GLOBAL '[X] '(* X X))) g '[X] (PATTERN ^(LAMBDA SIMPLE [A B] (PCONS B A))) g '[A B] (PATTERN ^NORMALISE) g '[STRUCTURE ENV ESC CONT] (PATTERN +) g {ERROR: Simple closure expected}z19403l6068d4057e2(1,12688)(2,13272)(3,17639)\i10f3I39f4 1f3 63f0 1f4 1f3 28f0 1f4 1f3 39f4 1f3 1i32I l3000x2e3k100(0,65535)(1,65535)(2,65535)(3,65535)\44f5b 4.c.4. ATOMSl6080d2999x3e5j(0,6080)(1,8359)\f5b13B l3000x2e3(0,65535)(1,65535)\44f5b (ATOM E)l7938d2999x2e2k30(0,7938)(1,8359)\f8b6i1I1B True just in case E designates an atom.l4064x2e2j\18f3i1f0I20f3 F-Type: [ OBJECTS ] _ TRUTH-VALUES Properties: Primitive; kernel.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi12f0B13I20i Examples: (ATOM 'Hello) g $TRUE (ATOM '$TRUE) g $FALSEl6068d4057e2(1,9856)(2,10880)\i10f3I14f4 1f3 6f0 1f3 13f0 1f4 1f3 7f0i (ACONS)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b7B Designates a nameless and otherwise inaccessible atom.l4064x2e2j\54f3 F-Type: [ ] _ ATOMS Properties: Primitive; cons.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi4f4BI1f3 1bi5f0B15I18i Examples: (ACONS) g '{atom} (= (ACONS) (ACONS)) g $FALSEl6068d4057e2(1,9856)(2,10880)\i10f3I8f4 1f3 8f0 1f3 19f0 1f4 1f3 7f0i (ATOM-NOTATION ATOM)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b15i4I1B Designates the string that is the notation of the atom designated by ATOM.l4064x2e2j\69f3i4f0I1f3 F-Type: [ ATOMS ] _ STRINGS Properties: Primitive.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi10f4BI1f3 1bi7f0B14I12i Examples: (ATOM-NOTATION 'Curious) g "CURIOUS" (ATOM-NOTATION (ACONS)) g {Error: Unnamed atom encountered}l6068d4057e2(1,10720)(2,11584)\i10f3I25f4 1f3 10f0 1f3 23f0 1f4 1f3 1i33f0 (ATOM-NOTATED STRING)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b14i6I1B Designates the atom whose notation is the string designated by STRING.l4064x2e2j\63f3i6f0I1f3 F-Type: [ STRINGS ] _ ATOMS Properties: Primitive; cons.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi8f0B11I18i Examples: (ATOM-NOTATED "Lambda") g 'LAMBDA (ATOM-NOTATED "") g {Error: ...}l6068d4057e2(1,10720)(2,11584)\i10f3I24f4 1f3 8f0 1f3 17f0 1f4 1f3 1i8f0 3f3 1f0 l3000x2e3k100(0,65535)(1,65535)(2,65535)(3,65535)\44f5b 4.c.5. TYPINGl6080d2999x3e5j(0,6080)(1,8359)\f5b14B l3000x2e3(0,65535)(1,65535)\44f5b (TYPE E)l7938d2999x2e2k30(0,7938)(1,8359)\f8b6i1I1B Designates the atom associated with the type of the object designated by A (chosen from the standard 18, and possibly others if other types are added to the system).l4064x2e2j\73f3i1f0I91f3 F-Type: [ OBJECTS ] _ ATOMS Properties: Primitive; kernel.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi11B1f4I1f3 1bi5f0B71I20i Examples: (TYPE 3) g 'NUMBER (TYPE PRIMARY-STREAM) g 'STREAM (TYPE '3) g 'NUMERAL (TYPE ^PRIMARY-STREAM) g 'STREAMER (TYPE $TRUE) g 'TRUTH-VALUE (TYPE '(= 2 3)) g 'PAIR (TYPE '$FALSE) g 'BOOLEAN (TYPE 'A) g 'ATOM (TYPE #A) g 'CHARACTER (TYPE 'A) g 'ATOM (TYPE '#4) g 'CHARAT (TYPE ''3) g 'HANDLE (TYPE [1 2 3]) g 'SEQUENCE (TYPE '''''''?) g 'HANDLE (TYPE '[1 2 3]) g 'RAIL (TYPE "Hello There") g 'STRING (TYPE +) g 'FUNCTION (TYPE ^"Yes?") g 'STRINGER (TYPE ^+) g 'CLOSURE (TYPE GLOBAL) g 'ENVIRONMENTz21167l6068d4057e2(1,9184)(2,9888)(3,12544)(4,16416)(5,17110)\i10f3I9f4 1f3 31f4 1f3 19f4 1f3 32f4 2f3 24f4 1f3 30f4 1f3 22f4 1f3 20f4 1f3 17f4 1f3 22f4 1f3 18f4 1f3 20f4 1f3 24f4 1f3 27f4 1f3 25f4 1f3 28f4 1f3 18f4 1f3 26f4 1f3 21f4 1f3 24f4 1f3 (ATOM E) (FUNCTION E) (SEQUENCE E) (BOOLEAN E) (HANDLE E) (STREAM E) (CHARACTER E) (NUMBER E) (STREAMER E) (CHARAT E) (NUMERAL E) (STRING E) (CLOSURE E) (PAIR E) (STRINGER E) (ENVIRONMENT E) (RAIL E) (TRUTH-VALUE E)l3008x2e7k30(0,7938)(1,7584)(2,12171)(3,65535)(4,65535)(5,65535)\f8b6i1I12i1I12i1I11i1I10i1I10i1I13i1I10i1I12i1I10i1I11i1I10i1I11i1I8i1I12i1I15i1I8i1I15i1I Each of these type predicates (characteristic functions) are true just of elements of each of the corresponding semantic categories, and false otherwise. Specifically, (ATOME) is true iff E designates an atom, etc.l4064x2e2j(1,8359)(2,65535)\169f3 5f7 1f3i1I1f0 13f3i1f0I25f3 F-Type: [ OBJECTS ] _ TRUTH-VALUES Properties: Kernel (ATOM, PAIR, RAIL, HANDLE only).l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi12f0B18I10f3 4f0 3f3 4f0 2f3 4f0 2f3 6f0 7i Examples: (ATOM 'A) g $TRUE (PAIR '(1ST '[A B])) g $TRUE (FUNCTION +) g $TRUE (CLOSURE '+) g $FALSEl6068d4057e2(1,10583)\i10f3I10f4 1f3 28f4 1f3 20f4 1f3 20f4 1f3 7f0i (VECTOR E)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b8i1I1B True if and only if E designates either a rail or a sequence; false otherwise. l4064x2e2j\20f3i1f0I58f3 F-Type: [ OBJECTS ] _ TRUTH-VALUESl6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi12f0B Examples: (VECTOR [1 2 3]) g $TRUE (VECTOR '[A B]) g $TRUE (VECTOR '(1 2 3)) g $FALSE (VECTOR "String") g $FALSEl6068d4057e2(1,10583)\i10f3I17f4 1f3 23f4 1f3 25f4 1f3 26f4 1f3 7f0i (STRUCTURE E) (EXTERNAL E)l3008x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b11i1I1B1b10i1I1B (STRUCTUREE) is true if and only if E designates an internal structure such as a numeral or a rail; false otherwise. Similarly, (EXTERNALE) is true just in case E designates an external or mathematical abstraction, such as a number or a sequence; false otherwise.l4064x2e2j\f3 10f7 1f3i1I1f0 24f3i1f0I15i8I69f3 9f7 1f3i1I1f0 22f3i1f0I15i8I78f3 F-Type: [ OBJECTS ] _ TRUTH-VALUES Properties: Kernel (EXTERNAL only).l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi12f0BI35i11I10f3 8f0 7i Examples: (EXTERNAL 123) g $TRUE (STRUCTURE (+ 2 2)) g $FALSE (EXTERNAL +) g $TRUE (STRUCTURE '+) g $TRUE (STRUCTURE ^+) g $TRUE (STRUCTURE "String") g $FALSE (STRUCTURE '"String") g $TRUEl6068d4057e2(1,10016)(2,10816)(3,17639)\i10f3I15f4 1f3 27f4 1f3 21f4 1f3 22f4 1f3 22f4 1f3 28f4 1f3 30f4 1f3 6f0i l3000x3e3k100(0,65535)(1,65535)(2,65535)(3,65535)\44f5b 4.c.6. IDENTITYl6080d2999x3e5j(0,6080)(1,8359)\f5b16B l3000x3e3(0,65535)(1,65535)\44f5b (= E1 E2)l7938d2999x2e2k30(0,7938)(1,8359)\f8b3i1o254 1o0 2o254 1o0I1B True if E1 and E2 designate the same object; false otherwise, except that an error will be detected if both E1 and E2 designate functions. When both E1 and E2 designate sequences, corresponding elements are compared (using =) from left to right until it can be established that the two sequences differ, or until an error is detected. Consequently, (=E1E2) may fail to terminate when E1 and E2 designate infinite sequences or otherwise represent infinite computations. Note that although equality is defined over closures, it is too fine-grained to be used for function identity.l4064x2e2j\8f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I86i4I1f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I33f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I65f3 1f0 126f3 2f7 1f3i1f6o254 1f7o0I1f3i1f6o254 1f3o0I1f0 28f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I187f3 F-Type: [ OBJECTS X OBJECTS ] _ TRUTH-VALUES Properties: Primitive; kernel.l16320d4057x2e2(0,6068)(1,10816)(2,11776)(3,13632)\f2 1f0i6I2f3bi10f4BI1f3bi11f4BI1f3 1bi12I2f0Bi11I20i Examples: (= 3 (+ 1 2)) g $TRUE (= 5 '5) g $FALSE (= '5 '5) g $TRUE (= $FALSE $FALSE) g $TRUE (= [10 20] [10 20]) g $TRUE (= '[10 20] '[10 20]) g $FALSE (= ['10 '20] '[10 20]) g $FALSE (= '[10 20] ['10 '20]) g $FALSE (= CAR CDR) g {ERROR: = not defined over functions.} (= CAR 3) g $FALSE (= [+ 2] [+ 3]) g {ERROR: = not defined over functions.} (= [2 +] [3 +]) g $FALSEl6068d4057e2\i10f3I14f4 1f3 6f0 1f3 8f0 1f4 1f3 7f0 1f3 9f0 1f4 1f3 6f0 1f3 17f0 1f4 1f3 6f0 1f3 19f0 1f4 1f3 29f4 1f3 31f4 1f3 31f4 1f3 20f4 1f3 1i38I11f4 1f3 24f4 1f3 1i38I17f4 1f3 7f0i l3000x2e3k100(0,65535)(1,65535)(2,65535)(3,65535)\44f5b 4.c.7. ARITHMETIC OPERATIONS and NUMBERSl6080d2999x3e5j(0,6080)(1,8359)\f5b42B l3000x2e3(0,65535)(1,65535)\44f5b (NUMBER E) (NUMERAL E)l3008x2e2k30(0,7938)(1,8359)\f8b8i1I1B1b9i1I1B True just in case E designates a number or numeral, respectively.l4064x2e2j\18f3i1f0I46f3 F-Type: [ OBJECTS ] _ TRUTH-VALUES Properties: Primitive; kernel.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi12f0B13I20i Examples: (NUMBER 3) g $TRUE (NUMBER (IF $TRUE (+ 2 3) (* 2 3))) g $TRUE (NUMBER (FIRST '[10 20 30])) g $FALSE (NUMERAL '1234567) g $TRUE (NUMERAL (FIRST '[10 20 30])) g $TRUEl6068d4057e2(1,12992)(2,13696)(3,17639)\i10f3I11f4 1f3 43f4 1f3 36f4 1f3 27f4 1f3 37f4 1f3 (+ N1 N2) (* N1 N2) (- N1 N2) (/ N1 N2)l3008x2e2k30(0,6080)(1,8359)(2,65535)(3,65535)\f8b3i1o254 1o0 2o254 1o0I1B1b3i1o254 1o0 2o254 1o0I1B1b3i1o254 1o0 2o254 1o0I1B1b3i1o254 1o0 2o254 1o0I1B Designate, respectively, the sum, product, difference, and quotient of the numbers designated by N1 and N2. (/N1N2) 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).l4064x2e2j(0,7938)\97f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I3f3 2f7 1f3i1f6o254 1f7o0I1f3i1f6o254 1f3o0I1f0 24f3i1f6o254 1f0o0I F-Type: [ NUMBERS X NUMBERS ] _ NUMBERS Properties: Primitive.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi10f4BI1f3bi11f4BI1f3 1bi7BI3f0i11I12i Examples: (* 2 2) g 4 (+ 10 30) g 40 (+ '1 '2) g {ERROR: Number expected.} (- 100 2) g 98 (- 10 20) g -10 (/ 10 3) g 3 (/ -10 3) g -3 (/ 10 -3) g -3 (/ -10 -3) g 3 (/ 100 0) g {ERROR: Division by zero.}l6068d4057e2(1,8896)(2,9472)\i10f3I8f4 1f3 13f4 1f3 14f4 1f3 1i25I11f4 1f3 14f4 2f3 13f4 1f3 13f4 1f3 14f4 1f3 15f4 1f3 13f4 1f3 1i26I (REMAINDER N1 N2)l7938d2999x2e1k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b11i1o254 1o0 2o254 1o0I1B Designates the remainder upon dividing N1 by N2; error if N2 designates zero. The sign of a non-zero remainder is that of the first argument.l4064x2e2j\39f3i1f6o254 1f0o0I4f3i1f6o254 1f0o0I11f3i1f6o254 1f0o0I F-Type: [ NUMBER X NUMBERS ] _ NUMBERSl6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi9f4BI1f3bi11f4BI1f3 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.}l6068d4057e2(1,9525)(2,10583)\i10f3I17f4 1f3 21f4 1f3 22f4 1f3 23f4 1f3 21f4 1f3 1i26f0 (1+ N) (1- N)l3008x2e2jk30(0,7938)(1,8359)(2,65535)(3,65535)\f8b4i1I1B1b4i1I1B Designates the number one greater or one less than the number designated by N, respectively.l4064x2e2j\76f3i1f0I F-Type: [ NUMBERS ] _ NUMBERSl6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi7f0B Examples: (1+ 20) g 21 (MAP 1- [2 3 4]) g [1 2 3]l6068d4057e2\i10f3I8f4 1f3 21f4 1f3 8f0i (< N1 N2) (<= N1 N2) (> N1 N2) (>= N1 N2) (<> N1 N2)l3008x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b4i1o254 1o0 2o254 1o0I1B1b4i1o254 1o0 2o254 1o0I1B1b4i1o254 1o0 2o254 1o0I1B1b4i1o254 1o0 2o254 1o0I1B1b4i1o254 1o0 2o254 1o0I1B True if and only if relationship between the two numbers designated by N1 and N2 is that of being less than, less than or equal (<=), greater than (>), greater than or equal (>=), or not equal (<>).l4064x2e2j\71f3i1f6o254 1f0o0I5f3i1f6o254 1f0o0I49f3 2f0 17f3 1f0 26f3 2f0 17f3 2f0 F-Type: [ NUMBERS X NUMBERS ] _ TRUTH-VALUES Properties: Primitive.l6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi10f4BI1f3bi11f4BI1f3 1bi12BI3f0i11I12i Examples: (< 2 3) g $TRUE (>= 5 4) g $TRUE (<= 99 '1) g {ERROR: Number expected.} (> 100 1000) g $FALSEl6068d4057e2(1,9312)(2,9997)\i10f3I8f4 1f3 16f4 1f3 18f4 1f3 1i25I14f4 1f3 7f0i (ABS N)l7938d2999x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b5i1I1B Designates the absolute value of the number designated by N.l4064x2e2j\58f3i1f0I F-Type: [ NUMBER ] _ NUMBERSl6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi11f4BI1f3 1bi7f0B Examples: (ABS 100) g 100 (ABS -100) g 100 (ABS 0) g 0 (ABS '1) g {ERROR: Number expected.}l6068d4057e2(1,9525)(2,10583)\i10f3I10f4 1f3 16f4 1f3 13f4 1f3 12f4 1f3 1i25f0 (MIN N1 N2 ... Nk) (MAX N1 N2 ... Nk)l3008x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b5i1o254 1o0 2o254 1o0I1f5 3f8 1i1o254 1o0I1B1b5i1o254 1o0 2o254 1o0I1f5 3f8 1i1o254 1o0I1B Designate, respectively, the minimum and maximum of the numbers designated by N1 through Nk (K>1).l4064x2e2j\78f3i1f6o254 1f0o0I9f3i1f6o254 1f0o0I2f3 1f7 1f4 1f7 2f0 2f3 F-Type: [ NUMBERS X {NUMBERS}* ] _ NUMBERSl6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi10f4BI1f3bi14f4BI1f3 1bi7f0B Examples: (MIN 3 1 4) g 1 (MIN 0 1 -7) g -7 (MAX 4) g 4l6068d4057e2\i10f3I12f4 1f3 16f4 1f3 12f4 1f3 2f0i (ODD N) (EVEN N)l3008x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b5i1I1B1b6i1I1B True if N designates an odd or even number, respectively.l4064x2e2j\8f3i1f0I48f3 F-Type: [ NUMBERS ] _ TRUTH-VALUESl6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi12f0B Examples: (ODD 100) g $FALSE (EVEN 100) g $TRUE (ODD -1) g $TRUEl6068d4057e2\i10f3I10f4 1f3 19f4 1f3 16f4 1f3 (ZERO N) (NEGATIVE N) (POSITIVE N) (NON-NEGATIVE N)l3008x2e2k30(0,7938)(1,8359)(2,65535)(3,65535)\f8b6i1I1B1b10i1I1B1b10i1I1B1b14i1I1B True if the number N designates is equal to, less than, greater than, or greater than or equal to zero, respectively.l4064x2e2j\19f3i1f0I97f3 F-Type: [ NUMBERS ] _ TRUTH-VALUESl6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi12f4BI1f3 1bi12f0B Examples: (ZERO 1) g $FALSE (NEGATIVE -1) g $TRUE (POSITIVE 0) g $FALSE (NON-NEGATIVE 0) g $TRUEl6068d4057e2\i10f3I9f4 1f3 22f4 1f3 20f4 1f3 25f4 1f3 6f0i (** N1 N2)l7938d2999x2e2(0,7938)(1,8359)(2,65535)(3,65535)\f8b4i1o254 1o0 2o254 1o0I1B Designates the N2-fold product of the number designated by N1 with itself. N2 must designate a non-negative number.l4064x2e2j\15f3i1f6o254 1f0o0I41f3i2f6o254 1f0o0I15f3i1f6o254 1f0o0I38f3 F-Type: [ NUMBERS X NUMBERS ] _ NUMBERSl6068d4057x2e2(0,6068)(1,8928)(2,9856)(3,12256)\f2 1f0i6I2f3bi10f4BI1f3 1bi10f4BI1f3 1bi7f0B Examples: (** 2 10) g 1024 (** 10 0) g 1 (** -5 3) g -125l6068d4057e2\i10f3I10f4 1f3 16f4 1f3 13f4 1f3 5f0i