# embeddings_queue

created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61137664t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "tion we implemented in the analyzing evaluator of section 4.1.7 . But there are further opportunities to gain ef ficiency in compiled code. As the interpreter runs, it follows a process that must be applicable to any expression in the language. In contrast, a given segment of compiled code is meant to execute some particular expression. This can make a big dif ference, for example in the use of the stack to save registers. When the interpreter evaluates an expression, it must be prepared for any contingency . Before evaluating a subexpression, the interpreter saves all registers that will be needed later , because the subexpression might require an arbitrary evaluation. A compiler , on the other hand, can exploit the structure of the particular expression it is processing to generate code that avoids unnecessary stack operations. As a case in point, consider the combination (f 84 96) . Before the interpreter evaluates the operator of the combination, it prepares for this evaluation by saving the registers con"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61138688t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "taining the operands and the environment, whose values will be needed later . The interpreter then evaluates the operator to obtain the result in val, restores the saved registers, and finally moves the result from val to proc . However , in the particular expression we are dealing with, the operator is the symbol f, whose evaluation is accomplished by the machine operation lookup-variable-value , which does not alter any registers. The compiler that we implement in this section will take advantage of this fact and generate code that evaluates the operator using the instruction (assign proc (op lookup-variable-value) (const f) (reg env))   This code not only avoids the unnecessary saves and restores but also assigns the value of the lookup directly to proc , whereas the interpreter would obtain theresult in val and then move this to proc . A compiler can also optimize access to the environment. Having analyzed the code, the compiler can in many cases know in which frame a particular variable will be located a"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61139712n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "nd access that frame directly , rather than performing the lookup- variable-value  search. We will discuss how to implement such variable access in section 5.5.6 . Until then, however , we will focus on the kind of register and stack optimizations described above. There are many other optimizations that can be performed by a compiler , such as coding primitive operations \u201cin line\u201d instead of using a general apply  mechanism (see exercise 5.38); but we will not emphasize these here. Our main goal in this section is to illustrate the compilation process in a simplified (but still interesting) context. 5.5.1  Structur e of the Compiler In section 4.1.7  we modified our original metacircular interpreter to separate analysis from execution. We analyzed each expression to produce an execution procedure that took an environment as ar gument and performed the required operations. In our compiler , we will do essentially the same analysis. Instead of producing execution procedures, however , we will generate sequences"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61140736
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " of instructions to be run by our register machine. The procedure compile  is the top-level dispatch in the compiler . It corresponds to the eval  procedure of section 4.1.1 , the analyze  procedure of section 4.1.7 , and the eval-dispatch  entry point of the explicit-control-evaluator in section 5.4.1 . The compiler , like the interpreters, uses the expression-syntax procedures defined in section 4.1.2 .35 Compile  performs a case analysis on the syntactic type of the expression to be compiled. For each type of expression, it dispatches to a specialized code generator : (define (compile exp target linkage)     (cond ((self-evaluating? exp)            (compile-self-evaluating exp target linkage))           ((quoted? exp) (compile-quoted exp target linkage))           ((variable? exp)            (compile-variable exp target linkage))           ((assignment? exp)            (compile-assignment exp target linkage))           ((definition? exp)            (compile-definition exp target linkage))          ((if? ex"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61141760p
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "p) (compile-if exp target linkage))           ((lambda? exp) (compile-lambda exp target linkage))           ((begin? exp)            (compile-sequence (begin-actions exp)                              target                              linkage))           ((cond? exp) (compile (cond->if exp) target linkage))           ((application? exp)            (compile-application exp target linkage))           (else            (error \"Unknown expression type -- COMPILE\" exp))))   Targets and linkages Compile  and the code generators that it calls take two ar guments in addition to the expression to compile. There is a target, which specifies the register in which the compiled code is to return the value of the expression. There is also a linkage descriptor , which describes how the code resulting from the compilation of the expression should proceed when it has finished its execution. The linkage descriptor can require that the code do one of the following three things: continue at the next instruction in sequence (this"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61142784
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " is specified by the linkage descriptor next ), return from the procedure being compiled (this is specified by the linkage descriptor return ), or jump to a named entry point (this is specified by using the designated label as the linkage descriptor). For example, compiling the expression 5 (which is self-evaluating) with a tar get of the val register and a linkage of next  should produce the instruction (assign val (const 5))   Compiling the same expression with a linkage of return  should produce the instructions (assign val (const 5))   (goto (reg continue))  In the first case, execution will continue with the next instruction in the sequence. In the second case, we will return from a procedure call. In both cases, the value of the expression will be placed into the tar get val register . Instruction sequences and stack usage Each code generator returns an instruction sequence  containing the object code it has generated for the expression. Code generation for a compound expression is accomplished by combi"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61143808n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ning the output from simpler code generators for component expressions, just as evaluation of a compound expression is accomplished by evaluating the component expressions. The simplest method for combining instruction sequences is a procedure called append-instruction-sequences . It takes as ar guments any number of instruction sequences that are to be executed sequentially; it appends them and returns the combined sequence. That is, if < seq1> and < seq2> are sequences of instructions, then evaluating (append-instruction-sequences < seq1> <seq2>)  produces the sequence <seq1>  <seq2>  Whenever registers might need to be saved, the compiler's code generators use preserving , which is a more subtle method for combining instruction sequences. Preserving  takes three ar guments: a set of registers and two instruction sequences that are to be executed sequentially . It appends the sequences in such a way that the contents of each register in the set is preserved over the execution of the first sequence, if this "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61144832i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "is needed for the execution of the second sequence. That is, if the first sequence modifies the register and the second sequence actually needs the register's original contents, then preserving  wraps a save  and a restore  of the register around the first sequence before appending the sequences. Otherwise, preserving  simply returns the appended instruction sequences. Thus, for example, (preserving (list < reg1> <reg2>) <seq1> <seq2>) produces one of the following four sequences of instructions, depending on how <seq1> and < seq2> use < reg1> and < reg2>: By using preserving  to combine instruction sequences the compiler avoids unnecessary stack operations. This also isolates the details of whether or not to generate save  and restore  instructions within the preserving  procedure, separating them from the concerns that arise in writing each of the individual code generators. In fact no save  or restore  instructions are explicitly produced by the code generators. In principle, we could represent an instruct"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61145856i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ion sequence simply as a list of instructions. Append-instruction-sequences  could then combine instruction sequences by performing an ordinary list append . However , preserving  would then be a complex operation, because it would have to analyze each instruction sequence to determine how the sequence uses its registers. Preserving  would be inefficient as well as complex, because it would have to analyze each of its instruction sequence ar guments, even though these sequences might themselves have been constructed by calls to preserving , in which case their parts would have already been analyzed. To avoid such repetitious analysis we will associate with each instruction sequence some information about its register use. When we construct a basic instruction sequence we will provide this information explicitly , and the procedures that combine instruction sequences will derive register -use information for the combined sequence from the information associated with the component sequences. An instruction sequ"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61146880e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ence will contain three pieces of information: the set of registers that must be initialized before the instructions in the sequence are executed (these registers are said to be needed  by the sequence), the set of registers whose values are modified by the instructions in the sequence, and the actual instructions (also called statements ) in the sequence.We will represent an instruction sequence as a list of its three parts. The constructor for instruction sequences is thus (define (make-instruction-sequence needs modifies statements)     (list needs modifies statements))   For example, the two-instruction sequence that looks up the value of the variable x in the current environment, assigns the result to val, and then returns, requires registers env and continue  to have been initialized, and modifies register val. This sequence would therefore be constructed as (make-instruction-sequence '(env continue) '(val)    '((assign val              (op lookup-variable-value) (const x) (reg env))      (goto (reg con"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61147904t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "tinue))))   We sometimes need to construct an instruction sequence with no statements: (define (empty-instruction-sequence)     (make-instruction-sequence '() '() '()))   The procedures for combining instruction sequences are shown in section 5.5.4 . Exer cise 5.31.   In evaluating a procedure application, the explicit-control evaluator always saves and restores the env register around the evaluation of the operator , saves and restores env around the evaluation of each operand (except the final one), saves and restores argl  around the evaluation of each operand, and saves and restores proc  around the evaluation of the operand sequence. For each of the following combinations, say which of these save  and restore operations are superfluous and thus could be eliminated by the compiler's preserving  mechanism: (f 'x 'y)     ((f) 'x 'y)     (f (g 'x) y)     (f (g 'x) 'y)  Exer cise 5.32.   Using the preserving  mechanism, the compiler will avoid saving and restoring env around the evaluation of the operator of "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61148928a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "a combination in the case where the operator is a symbol. We could also build such optimizations into the evaluator . Indeed, the explicit-control evaluator of section 5.4 already performs a similar optimization, by treating combinations with no operands as a special case. a. Extend the explicit-control evaluator to recognize as a separate class of expressions combinations whose operator is a symbol, and to take advantage of this fact in evaluating such expressions. b. Alyssa P . Hacker suggests that by extending the evaluator to recognize more and more special cases we could incorporate all the compiler's optimizations, and that this would eliminate the advantage of compilation altogether . What do you think of this idea? 5.5.2  Compiling Expr essions In this section and the next we implement the code generators to which the compile  procedure dispatches. Compiling linkage code In general, the output of each code generator will end with instructions \u2013 generated by the procedure compile-linkage  \u2013 that implem"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61149952e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ent the required linkage. If the linkage is return  then we must generate the instruction (goto (reg continue)) . This needs the continue  register and does not modify any registers. If the linkage is next , then we needn't include any additional instructions. Otherwise, the linkage is a label, and we generate a goto  to that label, an instruction that does not need or modify any registers.36 (define (compile-linkage linkage)     (cond ((eq? linkage 'return)            (make-instruction-sequence '(continue) '()             '((goto (reg continue)))))           ((eq? linkage 'next)            (empty-instruction-sequence))           (else            (make-instruction-sequence '() '()             `((goto (label ,linkage)))))))  The linkage code is appended to an instruction sequence by preserving  the continue  register , since a return  linkage will require the continue  register: If the given instruction sequence modifies continue  and the linkage code needs it, continue  will be saved and restored. (define (en"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61150976d
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "d-with-linkage linkage instruction-sequence)     (preserving '(continue)      instruction-sequence      (compile-linkage linkage)))   Compiling simple expr essions The code generators for self-evaluating expressions, quotations, and variables construct instruction sequences that assign the required value to the tar get register and then proceed as specified by the linkage descriptor . (define (compile-self-evaluating exp target linkage)     (end-with-linkage linkage      (make-instruction-sequence '() (list target)       `((assign ,target (const ,exp))))))   (define (compile-quoted exp target linkage)     (end-with-linkage linkage      (make-instruction-sequence '() (list target)       `((assign ,target (const ,(text-of-quotation exp)))))))   (define (compile-variable exp target linkage)     (end-with-linkage linkage      (make-instruction-sequence '(env) (list target)       `((assign ,target                 (op lookup-variable-value)                 (const ,exp)                 (reg env))))))   All these ass"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61152000i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ignment instructions modify the tar get register , and the one that looks up a variable needs the env register . Assignments and definitions are handled much as they are in the interpreter . We recursively generate code that computes the value to be assigned to the variable, and append to it a two-instruction sequence that actually sets or defines the variable and assigns the value of the whole expression (the symbol ok) to the target register . The recursive compilation has tar get val and linkage next  so thatthe code will put its result into val and continue with the code that is appended after it. The appending is done preserving env, since the environment is needed for setting or defining the variable and the code for the variable value could be the compilation of a complex expression that might modify the registers in arbitrary ways. (define (compile-assignment exp target linkage)     (let ((var (assignment-variable exp))           (get-value-code            (compile (assignment-value exp) 'val 'next)))"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61153024
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "       (end-with-linkage linkage        (preserving '(env)         get-value-code         (make-instruction-sequence '(env val) (list target)          `((perform (op set-variable-value!)                     (const ,var)                     (reg val)                     (reg env))            (assign ,target (const ok))))))))   (define (compile-definition exp target linkage)     (let ((var (definition-variable exp))           (get-value-code            (compile (definition-value exp) 'val 'next)))       (end-with-linkage linkage        (preserving '(env)         get-value-code         (make-instruction-sequence '(env val) (list target)          `((perform (op define-variable!)                     (const ,var)                     (reg val)                     (reg env))            (assign ,target (const ok))))))))   The appended two-instruction sequence requires env and val and modifies the target. Note that although we preserve env for this sequence, we do not preserve val, because the get-value-code  is design"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61154048e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ed to explicitly place its result in val for use by this sequence. (In fact, if we did preserve val, we would have a bug, because this would cause the previous contents of val to be restored right after the get-value-code  is run.)Compiling conditional expr essions The code for an if expression compiled with a given tar get and linkage has the form  <compilation of predicate, target val, linkage next>   (test (op false?) (reg val))    (branch (label false-branch))   true-branch    <compilation of consequent with given target and given linkage or  after-if >  false-branch    <compilation of alternative with given target and linkage >  after-if   To generate this code, we compile the predicate, consequent, and alternative, and combine the resulting code with instructions to test the predicate result and with newly generated labels to mark the true and false branches and the end of the conditional.37 In this arrangement of code, we must branch around the true branch if the test is false. The only slight complica"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61155072t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "tion is in how the linkage for the true branch should be handled. If the linkage for the conditional is return  or a label, then the true and false branches will both use this same linkage. If the linkage is next , the true branch ends with a jump around the code for the false branch to the label at the end of the conditional. (define (compile-if exp target linkage)     (let ((t-branch (make-label 'true-branch))           (f-branch (make-label 'false-branch))                              (after-if (make-label 'after-if)))       (let ((consequent-linkage              (if (eq? linkage 'next) after-if linkage)))         (let ((p-code (compile (if-predicate exp) 'val 'next))               (c-code                (compile                 (if-consequent exp) target consequent-linkage))               (a-code                (compile (if-alternative exp) target linkage)))           (preserving '(env continue)            p-code            (append-instruction-sequences            (make-instruction-sequence '(val) '()    "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61156096
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "          `((test (op false?) (reg val))                (branch (label ,f-branch))))             (parallel-instruction-sequences              (append-instruction-sequences t-branch c-code)              (append-instruction-sequences f-branch a-code))             after-if))))))   Env is preserved around the predicate code because it could be needed by the true and false branches, and continue  is preserved because it could be needed by the linkage code in those branches. The code for the true and false branches (which are not executed sequentially) is appended using a special combiner parallel- instruction-sequences  described in section 5.5.4 . Note that cond  is a derived expression, so all that the compiler needs to do handle it is to apply the cond->if  transformer (from section 4.1.2 ) and compile the resulting if expression. Compiling sequences The compilation of sequences (from procedure bodies or explicit begin expressions) parallels their evaluation. Each expression of the sequence is compiled \u2013 the la"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61157120s
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "st expression with the linkage specified for the sequence, and the other expressions with linkage next  (to execute the rest of the sequence). The instruction sequences for the individual expressions are appended to form a single instruction sequence, such that env (needed for the rest of the sequence) and continue  (possibly needed for the linkage at the end of the sequence) are preserved. (define (compile-sequence seq target linkage)     (if (last-exp? seq)         (compile (first-exp seq) target linkage)         (preserving '(env continue)          (compile (first-exp seq) target 'next)          (compile-sequence (rest-exps seq) target linkage))))   Compiling lambda  expr essions Lambda  expressions construct procedures. The object code for a lambda expression must have the form<construct procedure object and assign it to target register >  <linkage>  When we compile the lambda  expression, we also generate the code for the procedure body . Although the body won't be executed at the time of procedure const"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61158144r
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ruction, it is convenient to insert it into the object code right after the code for the lambda . If the linkage for the lambda  expression is a label or return , this is fine. But if the linkage is next , we will need to skip around the code for the procedure body by using a linkage that jumps to a label that is inserted after the body . The object code thus has the form  <construct procedure object and assign it to target register >   <code for given linkage >or (goto (label after-lambda))    <compilation of procedure body >  after-lambda   Compile-lambda  generates the code for constructing the procedure object followed by the code for the procedure body . The procedure object will be constructed at run time by combining the current environment (the environment at the point of definition) with the entry point to the compiled procedure body (a newly generated label).38 (define (compile-lambda exp target linkage)     (let ((proc-entry (make-label 'entry))           (after-lambda (make-label 'after-lambda))) "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61159168
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "      (let ((lambda-linkage              (if (eq? linkage 'next) after-lambda linkage)))         (append-instruction-sequences          (tack-on-instruction-sequence           (end-with-linkage lambda-linkage            (make-instruction-sequence '(env) (list target)             `((assign ,target                       (op make-compiled-procedure)                       (label ,proc-entry)                       (reg env)))))           (compile-lambda-body exp proc-entry))          after-lambda))))   Compile-lambda  uses the special combiner tack-on-instruction-sequence (section 5.5.4 ) rather than append-instruction-sequences  to append theprocedure body to the lambda  expression code, because the body is not part of the sequence of instructions that will be executed when the combined sequence is entered; rather , it is in the sequence only because that was a convenient place to put it. Compile-lambda-body  constructs the code for the body of the procedure. This code begins with a label for the entry point. Nex"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61160192t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "t come instructions that will cause the run-time evaluation environment to switch to the correct environment for evaluating the procedure body \u2013 namely , the definition environment of the procedure, extended to include the bindings of the formal parameters to the arguments with which the procedure is called. After this comes the code for the sequence of expressions that makes up the procedure body . The sequence is compiled with linkage return  and tar get val so that it will end by returning from the procedure with the procedure result in val. (define (compile-lambda-body exp proc-entry)     (let ((formals (lambda-parameters exp)))       (append-instruction-sequences        (make-instruction-sequence '(env proc argl) '(env)         `(,proc-entry           (assign env (op compiled-procedure-env) (reg proc))           (assign env                   (op extend-environment)                   (const ,formals)                   (reg argl)                   (reg env))))        (compile-sequence (lambda-body exp) 'va"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61161216l
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "l 'return))))   5.5.3  Compiling Combinations The essence of the compilation process is the compilation of procedure applications. The code for a combination compiled with a given tar get and linkage has the form <compilation of operator, target proc, linkage next>  <evaluate operands and construct argument list in argl>  <compilation of procedure call with given target and linkage >  The registers env, proc , and argl  may have to be saved and restored during evaluation of the operator and operands. Note that this is the only place in thecompiler where a tar get other than val is specified. The required code is generated by compile-application . This recursively compiles the operator , to produce code that puts the procedure to be applied into proc , and compiles the operands, to produce code that evaluates the individual operands of the application. The instruction sequences for the operands are combined (by construct-arglist ) with code that constructs the list of arguments in argl , and the resulting ar g"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61162240u
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ument-list code is combined with the procedure code and the code that performs the procedure call (produced by compile-procedure-call ). In appending the code sequences, the env register must be preserved around the evaluation of the operator (since evaluating the operator might modify env, which will be needed to evaluate the operands), and the proc  register must be preserved around the construction of the ar gument list (since evaluating the operands might modify proc , which will be needed for the actual procedure application). Continue  must also be preserved throughout, since it is needed for the linkage in the procedure call. (define (compile-application exp target linkage)     (let ((proc-code (compile (operator exp) 'proc 'next))           (operand-codes            (map (lambda (operand) (compile operand 'val 'next))                 (operands exp))))       (preserving '(env continue)        proc-code        (preserving '(proc continue)         (construct-arglist operand-codes)         (compile-proced"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61163264u
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ure-call target linkage)))))   The code to construct the ar gument list will evaluate each operand into val and then cons  that value onto the ar gument list being accumulated in argl . Since we cons  the ar guments onto argl  in sequence, we must start with the last ar gument and end with the first, so that the ar guments will appear in order from first to last in the resulting list. Rather than waste an instruction by initializing argl  to the empty list to set up for this sequence of evaluations, we make the first code sequence construct the initial argl . The general form of the ar gument-list construction is thus as follows: <compilation of last operand, targeted to val>  (assign argl (op list) (reg val))   <compilation of next operand, targeted to val> (assign argl (op cons) (reg val) (reg argl))   ...<compilation of first operand, targeted to val>  (assign argl (op cons) (reg val) (reg argl))   Argl  must be preserved around each operand evaluation except the first (so that arguments accumulated so far"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61164288
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " won't be lost), and env must be preserved around each operand evaluation except the last (for use by subsequent operand evaluations). Compiling this ar gument code is a bit tricky , because of the special treatment of the first operand to be evaluated and the need to preserve argl  and env in different places. The construct-arglist  procedure takes as ar guments the code that evaluates the individual operands. If there are no operands at all, it simply emits the instruction (assign argl (const ()))   Otherwise, construct-arglist  creates code that initializes argl  with the last argument, and appends code that evaluates the rest of the ar guments and adjoins them to argl  in succession. In order to process the ar guments from last to first, we must reverse the list of operand code sequences from the order supplied by compile-application . (define (construct-arglist operand-codes)     (let ((operand-codes (reverse operand-codes)))       (if (null? operand-codes)           (make-instruction-sequence '() '(argl"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61165312)
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": ")            '((assign argl (const ()))))           (let ((code-to-get-last-arg                  (append-instruction-sequences                   (car operand-codes)                   (make-instruction-sequence '(val) '(argl)                    '((assign argl (op list) (reg val)))))))             (if (null? (cdr operand-codes))                 code-to-get-last-arg                 (preserving '(env)                  code-to-get-last-arg                  (code-to-get-rest-args                   (cdr operand-codes))))))))   (define (code-to-get-rest-args operand-codes)    (let ((code-for-next-arg            (preserving '(argl)             (car operand-codes)             (make-instruction-sequence '(val argl) '(argl)              '((assign argl                 (op cons) (reg val) (reg argl)))))))       (if (null? (cdr operand-codes))           code-for-next-arg           (preserving '(env)            code-for-next-arg            (code-to-get-rest-args (cdr operand-codes))))))   Applying pr ocedur es After evaluati"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61166336n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ng the elements of a combination, the compiled code must apply the procedure in proc  to the ar guments in argl . The code performs essentially the same dispatch as the apply  procedure in the metacircular evaluator of section 4.1.1  or the apply-dispatch  entry point in the explicit-control evaluator of section 5.4.1 . It checks whether the procedure to be applied is a primitive procedure or a compiled procedure. For a primitive procedure, it uses apply- primitive-procedure ; we will see shortly how it handles compiled procedures. The procedure-application code has the following form:  (test (op primitive-procedure?) (reg proc))    (branch (label primitive-branch))   compiled-branch    <code to apply compiled procedure with given target and appropriat e linkage >  primitive-branch    (assign < target>           (op apply-primitive-procedure)            (reg proc)            (reg argl))    <linkage>  after-call   Observe that the compiled branch must skip around the primitive branch. Therefore, if the linkage"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61167360
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " for the original procedure call was next , the compound branch must use a linkage that jumps to a label that is inserted after the primitive branch. (This is similar to the linkage used for the true branch in compile-if .)(define (compile-procedure-call target linkage)     (let ((primitive-branch (make-label 'primitive-branch))           (compiled-branch (make-label 'compiled-branch))           (after-call (make-label 'after-call)))       (let ((compiled-linkage              (if (eq? linkage 'next) after-call linkage)))         (append-instruction-sequences          (make-instruction-sequence '(proc) '()           `((test (op primitive-procedure?) (reg proc))             (branch (label ,primitive-branch))))          (parallel-instruction-sequences           (append-instruction-sequences            compiled-branch            (compile-proc-appl target compiled-linkage))           (append-instruction-sequences            primitive-branch            (end-with-linkage linkage             (make-instruction-sequenc"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61168384e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "e '(proc argl)                                        (list target)              `((assign ,target                        (op apply-primitive-procedure)                        (reg proc)                        (reg argl)))))))          after-call))))   The primitive and compound branches, like the true and false branches in compile-if , are appended using parallel-instruction-sequences  rather than the ordinary append-instruction-sequences , because they will not be executed sequentially . Applying compiled pr ocedur es The code that handles procedure application is the most subtle part of the compiler , even though the instruction sequences it generates are very short. A compiled procedure (as constructed by compile-lambda ) has an entry point, which is a label that designates where the code for the procedure starts. The code at this entry point computes a result in val and returns by executing the instruction (goto (reg continue)) . Thus, we might expect the code for a compiled-procedure application (to be "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61169408g
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "generated by compile-proc-appl ) with a given tar get and linkage to look like this if the linkage is a label (assign continue (label proc-return))    (assign val (op compiled-procedure-entry) (reg proc))    (goto (reg val))   proc-return    (assign < target> (reg val))   ; included if target is not val   (goto (label < linkage>))   ; linkage code   or like this if the linkage is return .  (save continue)    (assign continue (label proc-return))    (assign val (op compiled-procedure-entry) (reg proc))    (goto (reg val))   proc-return    (assign < target> (reg val))   ; included if target is not val   (restore continue)    (goto (reg continue))   ; linkage code   This code sets up continue  so that the procedure will return to a label proc- return  and jumps to the procedure's entry point. The code at proc-return transfers the procedure's result from val to the tar get register (if necessary) and then jumps to the location specified by the linkage. (The linkage is always return  or a label, because compile-pr"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61170432o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ocedure-call  replaces a next  linkage for the compound-procedure branch by an after-call  label.) In fact, if the tar get is not val, that is exactly the code our compiler will generate.39 Usually , however , the tar get is val (the only time the compiler specifies a dif ferent register is when tar geting the evaluation of an operator to proc ), so the procedure result is put directly into the tar get register and there is no need to return to a special location that copies it. Instead, we simplify the code by setting up continue  so that the procedure will \u201creturn\u201d directly to the place specified by the caller's linkage: <set up continue  for linkage >  (assign val (op compiled-procedure-entry) (reg proc))   (goto (reg val))   If the linkage is a label, we set up continue  so that the procedure will return to that label. (That is, the (goto (reg continue))  the procedure ends with becomes equivalent to the (goto (label < linkage>)) at proc-return  above.)(assign continue (label < linkage>))  (assign val (op"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61171456
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " compiled-procedure-entry) (reg proc))   (goto (reg val))   If the linkage is return , we don't need to set up continue  at all: It already holds the desired location. (That is, the (goto (reg continue))  the procedure ends with goes directly to the place where the (goto (reg continue))  at proc- return  would have gone.) (assign val (op compiled-procedure-entry) (reg proc))   (goto (reg val))   With this implementation of the return  linkage, the compiler generates tail- recursive code. Calling a procedure as the final step in a procedure body does a direct transfer , without saving any information on the stack. Suppose instead that we had handled the case of a procedure call with a linkage of return  and a tar get of val as shown above for a non- val target. This would destroy tail recursion. Our system would still give the same value for any expression. But each time we called a procedure, we would save continue  and return after the call to undo the (useless) save. These extra saves would accumulate durin"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61172480g
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "g a nest of procedure calls.40 Compile-proc-appl  generates the above procedure-application code by considering four cases, depending on whether the tar get for the call is val and whether the linkage is return . Observe that the instruction sequences are declared to modify all the registers, since executing the procedure body can change the registers in arbitrary ways.41 Also note that the code sequence for the case with tar get val and linkage return  is declared to need continue : Even though continue  is not explicitly used in the two-instruction sequence, we must be sure that continue  will have the correct value when we enter the compiled procedure. (define (compile-proc-appl target linkage)     (cond ((and (eq? target 'val) (not (eq? linkage 'return)))            (make-instruction-sequence '(proc) all-regs              `((assign continue (label ,linkage))                (assign val (op compiled-procedure-entry)                            (reg proc))                (goto (reg val)))))          ((and (no"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61173504t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "t (eq? target 'val))                 (not (eq? linkage 'return)))            (let ((proc-return (make-label 'proc-return)))              (make-instruction-sequence '(proc) all-regs               `((assign continue (label ,proc-return))                 (assign val (op compiled-procedure-entry)                             (reg proc))                 (goto (reg val))                 ,proc-return                 (assign ,target (reg val))                 (goto (label ,linkage))))))           ((and (eq? target 'val) (eq? linkage 'return))            (make-instruction-sequence '(proc continue) all-regs             '((assign val (op compiled-procedure-entry)                           (reg proc))               (goto (reg val)))))           ((and (not (eq? target 'val)) (eq? linkage 'return))            (error \"return linkage, target not val -- COMPILE\"                   target))))   5.5.4  Combining Instruction Sequences This section describes the details on how instruction sequences are represented and combined. Rec"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61174528a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "all from section 5.5.1  that an instruction sequence is represented as a list of the registers needed, the registers modified, and the actual instructions. We will also consider a label (symbol) to be a degenerate case of an instruction sequence, which doesn't need or modify any registers. So to determine the registers needed and modified by instruction sequences we use the selectors (define (registers-needed s)     (if (symbol? s) '() (car s)))   (define (registers-modified s)     (if (symbol? s) '() (cadr s)))   (define (statements s)     (if (symbol? s) (list s) (caddr s)))   and to determine whether a given sequence needs or modifies a given register we use the predicates(define (needs-register? seq reg)     (memq reg (registers-needed seq)))   (define (modifies-register? seq reg)     (memq reg (registers-modified seq)))   In terms of these predicates and selectors, we can implement the various instruction sequence combiners used throughout the compiler . The basic combiner is append-instruction-sequences"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61175552
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " . This takes as ar guments an arbitrary number of instruction sequences that are to be executed sequentially and returns an instruction sequence whose statements are the statements of all the sequences appended together . The subtle point is to determine the registers that are needed and modified by the resulting sequence. It modifies those registers that are modified by any of the sequences; it needs those registers that must be initialized before the first sequence can be run (the registers needed by the first sequence), together with those registers needed by any of the other sequences that are not initialized (modified) by sequences preceding it. The sequences are appended two at a time by append-2-sequences . This takes two instruction sequences seq1  and seq2  and returns the instruction sequence whose statements are the statements of seq1  followed by the statements of seq2 , whose modified registers are those registers that are modified by either seq1  or seq2 , and whose needed registers are the reg"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61176576i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "isters needed by seq1  together with those registers needed by seq2  that are not modified by seq1 . (In terms of set operations, the new set of needed registers is the union of the set of registers needed by seq1  with the set dif ference of the registers needed by seq2  and the registers modified by seq1 .) Thus, append-instruction-sequences  is implemented as follows: (define (append-instruction-sequences . seqs)     (define (append-2-sequences seq1 seq2)       (make-instruction-sequence        (list-union (registers-needed seq1)                    (list-difference (registers-needed seq2)                                     (registers-modified seq1)))        (list-union (registers-modified seq1)                    (registers-modified seq2))        (append (statements seq1) (statements seq2))))     (define (append-seq-list seqs)       (if (null? seqs)          (empty-instruction-sequence)           (append-2-sequences (car seqs)                               (append-seq-list (cdr seqs)))))     (append-seq-l"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61177600i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ist seqs))   This procedure uses some simple operations for manipulating sets represented as lists, similar to the (unordered) set representation described in section 2.3.3 : (define (list-union s1 s2)     (cond ((null? s1) s2)           ((memq (car s1) s2) (list-union (cdr s1) s2))           (else (cons (car s1) (list-union (cdr s1) s2)))))   (define (list-difference s1 s2)     (cond ((null? s1) '())           ((memq (car s1) s2) (list-difference (cdr s1) s2))           (else (cons (car s1)                       (list-difference (cdr s1) s2)))))   Preserving , the second major instruction sequence combiner , takes a list of registers regs  and two instruction sequences seq1  and seq2  that are to be executed sequentially . It returns an instruction sequence whose statements are the statements of seq1  followed by the statements of seq2 , with appropriate save and restore  instructions around seq1  to protect the registers in regs  that are modified by seq1  but needed by seq2 . To accomplish this, preserving"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61178624
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "  first creates a sequence that has the required save s followed by the statements of seq1 followed by the required restore s. This sequence needs the registers being saved and restored in addition to the registers needed by seq1 , and modifies the registers modified by seq1  except for the ones being saved and restored. This augmented sequence and seq2  are then appended in the usual way . The following procedure implements this strategy recursively , walking down the list of registers to be preserved:42 (define (preserving regs seq1 seq2)     (if (null? regs)         (append-instruction-sequences seq1 seq2)         (let ((first-reg (car regs)))           (if (and (needs-register? seq2 first-reg)                    (modifies-register? seq1 first-reg))               (preserving (cdr regs)                (make-instruction-sequence                (list-union (list first-reg)                             (registers-needed seq1))                 (list-difference (registers-modified seq1)                           "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61179648
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "       (list first-reg))                 (append `((save ,first-reg))                         (statements seq1)                         `((restore ,first-reg))))                seq2)               (preserving (cdr regs) seq1 seq2)))))   Another sequence combiner , tack-on-instruction-sequence , is used by compile-lambda  to append a procedure body to another sequence. Because the procedure body is not \u201cin line\u201d to be executed as part of the combined sequence, its register use has no impact on the register use of the sequence in which it is embedded. We thus ignore the procedure body's sets of needed and modified registers when we tack it onto the other sequence. (define (tack-on-instruction-sequence seq body-seq)     (make-instruction-sequence      (registers-needed seq)      (registers-modified seq)      (append (statements seq) (statements body-seq))))   Compile-if  and compile-procedure-call  use a special combiner called parallel-instruction-sequences  to append the two alternative branches that follow a "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61180672t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "test. The two branches will never be executed sequentially; for any particular evaluation of the test, one branch or the other will be entered. Because of this, the registers needed by the second branch are still needed by the combined sequence, even if these are modified by the first branch. (define (parallel-instruction-sequences seq1 seq2)     (make-instruction-sequence      (list-union (registers-needed seq1)                  (registers-needed seq2))      (list-union (registers-modified seq1)                  (registers-modified seq2))      (append (statements seq1) (statements seq2))))   5.5.5  An Example of Compiled CodeNow that we have seen all the elements of the compiler , let us examine an example of compiled code to see how things fit together . We will compile the definition of a recursive factorial  procedure by calling compile : (compile    '(define (factorial n)       (if (= n 1)           1           (* (factorial (- n 1)) n)))    'val   'next)  We have specified that the value of the define  "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61181696e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "expression should be placed in the val register . We don't care what the compiled code does after executing the define , so our choice of next  as the linkage descriptor is arbitrary . Compile  determines that the expression is a definition, so it calls compile- definition  to compile code to compute the value to be assigned (tar geted to val), followed by code to install the definition, followed by code to put the value of the define  (which is the symbol ok) into the tar get register , followed finally by the linkage code. Env is preserved around the computation of the value, because it is needed in order to install the definition. Because the linkage is next , there is no linkage code in this case. The skeleton of the compiled code is thus   <save env if modified by code to compute value >    <compilation of definition value, target val, linkage next>    <restore env if saved above >    (perform (op define-variable!)              (const factorial)              (reg val)              (reg env))     (assign "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61182720v
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "val (const ok))   The expression that is to be compiled to produce the value for the variable factorial  is a lambda  expression whose value is the procedure that computes factorials. Compile  handles this by calling compile-lambda , which compiles the procedure body , labels it as a new entry point, and generates the instruction that will combine the procedure body at the new entry point with the run-time environment and assign the result to val. The sequence then skips around the compiled procedure code, which is inserted at this point. The procedure codeitself begins by extending the procedure's definition environment by a frame that binds the formal parameter n to the procedure ar gument. Then comes the actual procedure body . Since this code for the value of the variable doesn't modify the env register , the optional save  and restore  shown above aren't generated. (The procedure code at entry2  isn't executed at this point, so its use of env is irrelevant.) Therefore, the skeleton for the compiled code "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61183744b
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "becomes   (assign val (op make-compiled-procedure)                 (label entry2)                 (reg env))     (goto (label after-lambda1))   entry2    (assign env (op compiled-procedure-env) (reg proc))     (assign env (op extend-environment)                 (const (n))                 (reg argl)                 (reg env))     <compilation of procedure body >  after-lambda1     (perform (op define-variable!)              (const factorial)              (reg val)              (reg env))     (assign val (const ok))   A procedure body is always compiled (by compile-lambda-body ) as a sequence with tar get val and linkage return . The sequence in this case consists of a single if expression: (if (= n 1)       1      (* (factorial (- n 1)) n))   Compile-if  generates code that first computes the predicate (tar geted to val), then checks the result and branches around the true branch if the predicate is false. Env and continue  are preserved around the predicate code, since they may be needed for the rest of the "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61184768i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "if expression. Since the if expression is the final expression (and only expression) in the sequence making up the procedure body , its tar get is val and its linkage is return , so the true and false branches are both compiled with tar get val and linkage return . (That is, the value of theconditional, which is the value computed by either of its branches, is the value of the procedure.)   <save continue , env if modified by predicate and needed by branch es>    <compilation of predicate, target val, linkage next>    <restore continue , env if saved above >    (test (op false?) (reg val))     (branch (label false-branch4))   true-branch5     <compilation of true branch, target val, linkage return>  false-branch4     <compilation of false branch, target val, linkage return>  after-if3   The predicate (= n 1)  is a procedure call. This looks up the operator (the symbol =) and places this value in proc . It then assembles the ar guments 1 and the value of n into argl . Then it tests whether proc  contains a pri"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61185792m
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "mitive or a compound procedure, and dispatches to a primitive branch or a compound branch accordingly . Both branches resume at the after-call  label. The requirements to preserve registers around the evaluation of the operator and operands don't result in any saving of registers, because in this case those evaluations don't modify the registers in question.   (assign proc             (op lookup-variable-value) (const =) (reg env))     (assign val (const 1))     (assign argl (op list) (reg val))     (assign val (op lookup-variable-value) (const n) (reg env))     (assign argl (op cons) (reg val) (reg argl))     (test (op primitive-procedure?) (reg proc))     (branch (label primitive-branch17))   compiled-branch16     (assign continue (label after-call15))     (assign val (op compiled-procedure-entry) (reg proc))     (goto (reg val))   primitive-branch17     (assign val (op apply-primitive-procedure)                 (reg proc)                (reg argl))   after-call15   The true branch, which is the constant 1,"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61186816
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " compiles (with tar get val and linkage return ) to   (assign val (const 1))     (goto (reg continue))   The code for the false branch is another a procedure call, where the procedure is the value of the symbol *, and the ar guments are n and the result of another procedure call (a call to factorial ). Each of these calls sets up proc  and argl and its own primitive and compound branches. Figure 5.17 shows the complete compilation of the definition of the factorial  procedure. Notice that the possible save  and restore  of continue  and env around the predicate, shown above, are in fact generated, because these registers are modified by the procedure call in the predicate and needed for the procedure call and the return linkage in the branches. Exer cise 5.33.   Consider the following definition of a factorial procedure, which is slightly dif ferent from the one given above: (define (factorial-alt n)     (if (= n 1)         1        (* n (factorial-alt (- n 1)))))   Compile this procedure and compare the resu"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61187840l
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "lting code with that produced for factorial . Explain any dif ferences you find. Does either program execute more efficiently than the other? Exer cise 5.34.   Compile the iterative factorial procedure (define (factorial n)     (define (iter product counter)       (if (> counter n)           product           (iter (* counter product)                 (+ counter 1))))     (iter 1 1))  Annotate the resulting code, showing the essential dif ference between the code for iterative and recursive versions of factorial  that makes one process build up stack space and the other run in constant stack space. ;; construct the procedure and skip over code for the procedure body     (assign val             (op make-compiled-procedure) (label entry2) (reg env))     (goto (label after-lambda1))     entry2     ; calls to factorial  will enter here     (assign env (op compiled-procedure-env) (reg proc))     (assign env             (op extend-environment) (const (n)) (reg argl) (reg env))   ;; begin actual procedure body     (s"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61188864a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ave continue)     (save env)     ;; compute (= n 1)    (assign proc (op lookup-variable-value) (const =) (reg env))     (assign val (const 1))     (assign argl (op list) (reg val))     (assign val (op lookup-variable-value) (const n) (reg env))     (assign argl (op cons) (reg val) (reg argl))     (test (op primitive-procedure?) (reg proc))     (branch (label primitive-branch17))   compiled-branch16     (assign continue (label after-call15))     (assign val (op compiled-procedure-entry) (reg proc))     (goto (reg val))   primitive-branch17     (assign val (op apply-primitive-procedure) (reg proc) (reg argl))     after-call15   ; val now contains result of (= n 1)    (restore env)     (restore continue)     (test (op false?) (reg val))     (branch (label false-branch4))  Figur e 5.17:   Compilation of the definition of the factorial  procedure (continued on next page).true-branch5  ; return 1     (assign val (const 1))     (goto (reg continue))     false-branch4   ;; compute and return (* (factorial (- n 1)) n)"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61189888
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "     (assign proc (op lookup-variable-value) (const *) (reg env))     (save continue)     (save proc)   ; save * procedure     (assign val (op lookup-variable-value) (const n) (reg env))     (assign argl (op list) (reg val))     (save argl)   ; save partial argument list for *    ;; compute (factorial (- n 1)) , which is the other argument for *    (assign proc             (op lookup-variable-value) (const factorial) (reg env))     (save proc)  ; save factorial  procedure   ;; compute (- n 1), which is the argument for factorial     (assign proc (op lookup-variable-value) (const -) (reg env))     (assign val (const 1))     (assign argl (op list) (reg val))     (assign val (op lookup-variable-value) (const n) (reg env))     (assign argl (op cons) (reg val) (reg argl))     (test (op primitive-procedure?) (reg proc))     (branch (label primitive-branch8))   compiled-branch7     (assign continue (label after-call6))     (assign val (op compiled-procedure-entry) (reg proc))     (goto (reg val))   primitive-branch8"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61190912
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "     (assign val (op apply-primitive-procedure) (reg proc) (reg argl))     after-call6   ; val now contains result of (- n 1)    (assign argl (op list) (reg val))     (restore proc) ; restore factorial   ;; apply factorial  Figur e 5.17:   (continued)  (test (op primitive-procedure?) (reg proc))     (branch (label primitive-branch11))   compiled-branch10     (assign continue (label after-call9))     (assign val (op compiled-procedure-entry) (reg proc))     (goto (reg val))   primitive-branch11     (assign val (op apply-primitive-procedure) (reg proc) (reg argl))     after-call9      ; val now contains result of (factorial (- n 1))     (restore argl) ; restore partial argument list for *    (assign argl (op cons) (reg val) (reg argl))     (restore proc) ; restore *    (restore continue)   ;; apply * and return its value     (test (op primitive-procedure?) (reg proc))     (branch (label primitive-branch14))   compiled-branch13   ;; note that a compound procedure here is called tail-recursively     (assign val ("}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61191936o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "op compiled-procedure-entry) (reg proc))     (goto (reg val))   primitive-branch14     (assign val (op apply-primitive-procedure) (reg proc) (reg argl))     (goto (reg continue))   after-call12   after-if3   after-lambda1   ;; assign the procedure to the variable factorial     (perform      (op define-variable!) (const factorial) (reg val) (reg env))     (assign val (const ok))   Exer cise 5.35.   What expression was compiled to produce the code shown in figure 5.18? Figur e 5.18:   An example of compiler output (continued on next page). See exercise 5.35.  (assign val (op make-compiled-procedure) (label entry16)                                              (reg env))     (goto (label after-lambda15))   entry16    (assign env (op compiled-procedure-env) (reg proc))     (assign env             (op extend-environment) (const (x)) (reg argl) (reg env))     (assign proc (op lookup-variable-value) (const +) (reg env))     (save continue)     (save proc)     (save env)     (assign proc (op lookup-variable-value) (c"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61192960o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "onst g) (reg env))     (save proc)     (assign proc (op lookup-variable-value) (const +) (reg env))     (assign val (const 2))     (assign argl (op list) (reg val))     (assign val (op lookup-variable-value) (const x) (reg env))     (assign argl (op cons) (reg val) (reg argl))     (test (op primitive-procedure?) (reg proc))     (branch (label primitive-branch19))   compiled-branch18     (assign continue (label after-call17))     (assign val (op compiled-procedure-entry) (reg proc))     (goto (reg val))   primitive-branch19     (assign val (op apply-primitive-procedure) (reg proc) (reg argl))   after-call17     (assign argl (op list) (reg val))     (restore proc)     (test (op primitive-procedure?) (reg proc))     (branch (label primitive-branch22))   compiled-branch21     (assign continue (label after-call20))     (assign val (op compiled-procedure-entry) (reg proc))     (goto (reg val))   primitive-branch22     (assign val (op apply-primitive-procedure) (reg proc) (reg argl))   Figur e 5.18:   (continued)aft"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61193984e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "er-call20     (assign argl (op list) (reg val))     (restore env)     (assign val (op lookup-variable-value) (const x) (reg env))     (assign argl (op cons) (reg val) (reg argl))     (restore proc)     (restore continue)     (test (op primitive-procedure?) (reg proc))     (branch (label primitive-branch25))   compiled-branch24     (assign val (op compiled-procedure-entry) (reg proc))     (goto (reg val))   primitive-branch25     (assign val (op apply-primitive-procedure) (reg proc) (reg argl))     (goto (reg continue))   after-call23   after-lambda15     (perform (op define-variable!) (const f) (reg val) (reg env))     (assign val (const ok))   Exer cise 5.36.   What order of evaluation does our compiler produce for operands of a combination? Is it left-to-right, right-to-left, or some other order? Where in the compiler is this order determined? Modify the compiler so that it produces some other order of evaluation. (See the discussion of order of evaluation for the explicit-control evaluator in section 5.4.1"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61195008
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " .) How does changing the order of operand evaluation af fect the ef ficiency of the code that constructs the ar gument list? Exer cise 5.37.   One way to understand the compiler's preserving  mechanism for optimizing stack usage is to see what extra operations would be generated if we did not use this idea. Modify preserving  so that it always generates the save and restore  operations. Compile some simple expressions and identify the unnecessary stack operations that are generated. Compare the code to that generated with the preserving  mechanism intact. Exer cise 5.38.   Our compiler is clever about avoiding unnecessary stack operations, but it is not clever at all when it comes to compiling calls to the primitive procedures of the language in terms of the primitive operationssupplied by the machine. For example, consider how much code is compiled to compute (+ a 1) : The code sets up an ar gument list in argl , puts the primitive addition procedure (which it finds by looking up the symbol + in the environ"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61196032m
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ment) into proc , and tests whether the procedure is primitive or compound. The compiler always generates code to perform the test, as well as code for primitive and compound branches (only one of which will be executed). We have not shown the part of the controller that implements primitives, but we presume that these instructions make use of primitive arithmetic operations in the machine's data paths. Consider how much less code would be generated if the compiler could open-code  primitives \u2013 that is, if it could generate code to directly use these primitive machine operations. The expression (+ a 1)  might be compiled into something as simple as 43 (assign val (op lookup-variable-value) (const a) (reg env))   (assign val (op +) (reg val) (const 1))   In this exercise we will extend our compiler to support open coding of selected primitives. Special-purpose code will be generated for calls to these primitive procedures instead of the general procedure-application code. In order to support this, we will augm"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61197056e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ent our machine with special ar gument registers arg1  and arg2 . The primitive arithmetic operations of the machine will take their inputs from arg1  and arg2 . The results may be put into val, arg1 , or arg2 . The compiler must be able to recognize the application of an open-coded primitive in the source program. We will augment the dispatch in the compile procedure to recognize the names of these primitives in addition to the reserved words (the special forms) it currently recognizes.44 For each special form our compiler has a code generator . In this exercise we will construct a family of code generators for the open-coded primitives. a.  The open-coded primitives, unlike the special forms, all need their operands evaluated. Write a code generator spread-arguments  for use by all the open- coding code generators. Spread-arguments  should take an operand list and compile the given operands tar geted to successive ar gument registers. Note that an operand may contain a call to an open-coded primitive, so ar"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61198080
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " gument registers will have to be preserved during operand evaluation. b.  For each of the primitive procedures =, *, -, and +, write a code generator that takes a combination with that operator , together with a tar get and a linkage descriptor , and produces code to spread the ar guments into the registers and thenperform the operation tar geted to the given tar get with the given linkage. You need only handle expressions with two operands. Make compile  dispatch to these code generators. c.  Try your new compiler on the factorial  example. Compare the resulting code with the result produced without open coding. d.  Extend your code generators for + and * so that they can handle expressions with arbitrary numbers of operands. An expression with more than two operands will have to be compiled into a sequence of operations, each with only two inputs. 5.5.6  Lexical Addr essing One of the most common optimizations performed by compilers is the optimization of variable lookup. Our compiler , as we have implemen"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61199104t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ted it so far , generates code that uses the lookup-variable-value  operation of the evaluator machine. This searches for a variable by comparing it with each variable that is currently bound, working frame by frame outward through the run-time environment. This search can be expensive if the frames are deeply nested or if there are many variables. For example, consider the problem of looking up the value of x while evaluating the expression (* x y z)  in an application of the procedure that is returned by (let ((x 3) (y 4))     (lambda (a b c d e)       (let ((y (* a b x))             (z (+ c d x)))         (* x y z))))   Since a let expression is just syntactic sugar for a lambda  combination, this expression is equivalent to ((lambda (x y)      (lambda (a b c d e)        ((lambda (y z) (* x y z))         (* a b x)         (+ c d x))))    3   4) Each time lookup-variable-value  searches for x, it must determine that the symbol x is not eq? to y or z (in the first frame), nor to a, b, c, d, or e (in the seco"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61200128n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "nd frame). We will assume, for the moment, that our programs do not use define  \u2013 that variables are bound only with lambda . Because our language is lexically scoped, the run-time environment for any expression will have a structure that parallels the lexical structure of the program in which the expression appears.45 Thus, the compiler can know , when it analyzes the above expression, that each time the procedure is applied the variable x in (* x y z) will be found two frames out from the current frame and will be the first variable in that frame. We can exploit this fact by inventing a new kind of variable-lookup operation, lexical-address-lookup , that takes as ar guments an environment and a lexical address that consists of two numbers: a frame number , which specifies how many frames to pass over , and a displacement number , which specifies how many variables to pass over in that frame. Lexical-address-lookup  will produce the value of the variable stored at that lexical address relative to the current"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61201152
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " environment. If we add the lexical-address-lookup  operation to our machine, we can make the compiler generate code that references variables using this operation, rather than lookup-variable-value . Similarly , our compiled code can use a new lexical-address-set!  operation instead of set-variable- value! . In order to generate such code, the compiler must be able to determine the lexical address of a variable it is about to compile a reference to. The lexical address of a variable in a program depends on where one is in the code. For example, in the following program, the address of x in expression < e1> is (2,0) \u2013 two frames back and the first variable in the frame. At that point y is at address (0,0) and c is at address (1,2). In expression < e2>, x is at (1,0), y is at (1,1), and c is at (0,2). ((lambda (x y)      (lambda (a b c d e)        ((lambda (y z) < e1>)        <e2>        (+ c d x))))    3   4)  One way for the compiler to produce code that uses lexical addressing is to maintain a data structur"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61202176e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "e called a compile-time envir onment . This keeps track ofwhich variables will be at which positions in which frames in the run-time environment when a particular variable-access operation is executed. The compile-time environment is a list of frames, each containing a list of variables. (There will of course be no values bound to the variables, since values are not computed at compile time.) The compile-time environment becomes an additional ar gument to compile  and is passed along to each code generator . The top-level call to compile  uses an empty compile-time environment. When a lambda  body is compiled, compile-lambda-body  extends the compile-time environment by a frame containing the procedure's parameters, so that the sequence making up the body is compiled with that extended environment. At each point in the compilation, compile-variable  and compile-assignment  use the compile-time environment in order to generate the appropriate lexical addresses. Exercises 5.39 through 5.43 describe how to compl"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61203200e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ete this sketch of the lexical- addressing strategy in order to incorporate lexical lookup into the compiler . Exercise 5.44 describes another use for the compile-time environment. Exer cise 5.39.   Write a procedure lexical-address-lookup  that implements the new lookup operation. It should take two ar guments \u2013 a lexical address and a run-time environment \u2013 and return the value of the variable stored at the specified lexical address. Lexical-address-lookup  should signal an error if the value of the variable is the symbol *unassigned* .46 Also write a procedure lexical-address-set!  that implements the operation that changes the value of the variable at a specified lexical address. Exer cise 5.40.   Modify the compiler to maintain the compile-time environment as described above. That is, add a compile-time-environment ar gument to compile  and the various code generators, and extend it in compile-lambda-body . Exer cise 5.41.   Write a procedure find-variable  that takes as ar guments a variable and a compi"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61204224l
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "le-time environment and returns the lexical address of the variable with respect to that environment. For example, in the program fragment that is shown above, the compile-time environment during the compilation of expression < e1> is ((y z) (a b c d e) (x y)) . Find-variable  should produce (find-variable 'c '((y z) (a b c d e) (x y)))   (1 2)   (find-variable 'x '((y z) (a b c d e) (x y)))   (2 0)    (find-variable 'w '((y z) (a b c d e) (x y)))   not-found   Exer cise 5.42.   Using find-variable  from exercise 5.41, rewrite compile- variable  and compile-assignment  to output lexical-address instructions. In cases where find-variable  returns not-found  (that is, where the variable is not in the compile-time environment), you should have the code generators use the evaluator operations, as before, to search for the binding. (The only place a variable that is not found at compile time can be is in the global environment, which is part of the run-time environment but is not part of the compile-time environme"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61205248n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "nt.47 Thus, if you wish, you may have the evaluator operations look directly in the global environment, which can be obtained with the operation (op get-global-environment) , instead of having them search the whole run- time environment found in env.) Test the modified compiler on a few simple cases, such as the nested lambda  combination at the beginning of this section. Exer cise 5.43.   We argued in section 4.1.6  that internal definitions for block structure should not be considered \u201creal\u201d define s. Rather , a procedure body should be interpreted as if the internal variables being defined were installed as ordinary lambda  variables initialized to their correct values using set! . Section 4.1.6  and exercise 4.16 showed how to modify the metacircular interpreter to accomplish this by scanning out internal definitions. Modify the compiler to perform the same transformation before it compiles a procedure body . Exer cise 5.44.   In this section we have focused on the use of the compile-time environment to p"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61206272r
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "roduce lexical addresses. But there are other uses for compile- time environments. For instance, in exercise 5.38 we increased the ef ficiency of compiled code by open-coding primitive procedures. Our implementation treated the names of open-coded procedures as reserved words. If a program were to rebind such a name, the mechanism described in exercise 5.38 would still open- code it as a primitive, ignoring the new binding. For example, consider the procedure (lambda (+ * a b x y)     (+ (* a x) (* b y)))  which computes a linear combination of x and y. We might call it with ar guments +matrix , *matrix , and four matrices, but the open-coding compiler would still open-code the + and the * in (+ (* a x) (* b y))  as primitive + and *. Modify the open-coding compiler to consult the compile-time environment in order to compile the correct code for expressions involving the names of primitive procedures. (The code will work correctly as long as the program does not define  or set!  these names.) 5.5.7  Interfaci"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61207296n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ng Compiled Code to the Evaluator We have not yet explained how to load compiled code into the evaluator machine or how to run it. We will assume that the explicit-control-evaluator machine has been defined as in section 5.4.4 , with the additional operations specified in footnote 38. We will implement a procedure compile-and-go  that compiles a Scheme expression, loads the resulting object code into the evaluator machine, and causes the machine to run the code in the evaluator global environment, print the result, and enter the evaluator's driver loop. We will also modify the evaluator so that interpreted expressions can call compiled procedures as well as interpreted ones. We can then put a compiled procedure into the machine and use the evaluator to call it: (compile-and-go    '(define (factorial n)       (if (= n 1)           1           (* (factorial (- n 1)) n))))    ;;; EC-Eval value:   ok   ;;; EC-Eval input:   (factorial 5)   ;;; EC-Eval value:   120  To allow the evaluator to handle compiled procedu"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61208320r
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "res (for example, to evaluate the call to factorial  above), we need to change the code at apply-dispatch (section 5.4.1 ) so that it recognizes compiled procedures (as distinct from compound or primitive procedures) and transfers control directly to the entry point of the compiled code:48apply-dispatch     (test (op primitive-procedure?) (reg proc))     (branch (label primitive-apply))     (test (op compound-procedure?) (reg proc))      (branch (label compound-apply))     (test (op compiled-procedure?) (reg proc))      (branch (label compiled-apply))     (goto (label unknown-procedure-type))   compiled-apply     (restore continue)     (assign val (op compiled-procedure-entry) (reg proc))     (goto (reg val))   Note the restore of continue  at compiled-apply . Recall that the evaluator was arranged so that at apply-dispatch , the continuation would be at the top of the stack. The compiled code entry point, on the other hand, expects the continuation to be in continue , so continue  must be restored before the"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61209344
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " compiled code is executed. To enable us to run some compiled code when we start the evaluator machine, we add a branch  instruction at the beginning of the evaluator machine, which causes the machine to go to a new entry point if the flag  register is set.49   (branch (label external-entry))      ; branches if flag is set  read-eval-print-loop     (perform (op initialize-stack))     ... External-entry  assumes that the machine is started with val containing the location of an instruction sequence that puts a result into val and ends with (goto (reg continue)) . Starting at this entry point jumps to the location designated by val, but first assigns continue  so that execution will return to print-result , which prints the value in val and then goes to the beginning of the evaluator's read-eval-print loop.50 external-entry     (perform (op initialize-stack))     (assign env (op get-global-environment))     (assign continue (label print-result))     (goto (reg val))  Now we can use the following procedure to co"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61210368m
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "mpile a procedure definition, execute the compiled code, and run the read-eval-print loop so we can try the procedure. Because we want the compiled code to return to the location in continue  with its result in val, we compile the expression with a tar get of val and a linkage of return . In order to transform the object code produced by the compiler into executable instructions for the evaluator register machine, we use the procedure assemble  from the register -machine simulator (section 5.2.2 ). We then initialize the val register to point to the list of instructions, set the flag  so that the evaluator will go to external-entry , and start the evaluator . (define (compile-and-go expression)     (let ((instructions            (assemble (statements                       (compile expression 'val 'return))                      eceval)))       (set! the-global-environment (setup-environment))       (set-register-contents! eceval 'val instructions)       (set-register-contents! eceval 'flag true)       (start e"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61211392c
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ceval)))   If we have set up stack monitoring, as at the end of section 5.4.4 , we can examine the stack usage of compiled code: (compile-and-go    '(define (factorial n)       (if (= n 1)           1           (* (factorial (- n 1)) n))))     (total-pushes = 0 maximum-depth = 0)    ;;; EC-Eval value:   ok   ;;; EC-Eval input:   (factorial 5)   (total-pushes = 31 maximum-depth = 14)   ;;; EC-Eval value:   120  Compare this example with the evaluation of (factorial 5)  using the interpreted version of the same procedure, shown at the end of section 5.4.4 . Theinterpreted version required 144 pushes and a maximum stack depth of 28. This illustrates the optimization that results from our compilation strategy . Interpr etation and compilation With the programs in this section, we can now experiment with the alternative execution strategies of interpretation and compilation.51 An interpreter raises the machine to the level of the user program; a compiler lowers the user program to the level of the machine language"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61212416.
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": ". We can regard the Scheme language (or any programming language) as a coherent family of abstractions erected on the machine language. Interpreters are good for interactive program development and debugging because the steps of program execution are or ganized in terms of these abstractions, and are therefore more intelligible to the programmer . Compiled code can execute faster , because the steps of program execution are organized in terms of the machine language, and the compiler is free to make optimizations that cut across the higher -level abstractions.52 The alternatives of interpretation and compilation also lead to different strategies for porting languages to new computers. Suppose that we wish to implement Lisp for a new machine. One strategy is to begin with the explicit-control evaluator of section 5.4 and translate its instructions to instructions for the new machine. A dif ferent strategy is to begin with the compiler and change the code generators so that they generate code for the new machin"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61213440e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "e. The second strategy allows us to run any Lisp program on the new machine by first compiling it with the compiler running on our original Lisp system, and linking it with a compiled version of the run-time library .53 Better yet, we can compile the compiler itself, and run this on the new machine to compile other Lisp programs.54 Or we can compile one of the interpreters of section 4.1 to produce an interpreter that runs on the new machine. Exer cise 5.45.   By comparing the stack operations used by compiled code to the stack operations used by the evaluator for the same computation, we can determine the extent to which the compiler optimizes use of the stack, both in speed (reducing the total number of stack operations) and in space (reducing the maximum stack depth). Comparing this optimized stack use to the performance of a special-purpose machine for the same computation gives some indication of the quality of the compiler . a. Exercise 5.27 asked you to determine, as a function of n, the number of push"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61214464e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "es and the maximum stack depth needed by the evaluator to compute n! using therecursive factorial procedure given above. Exercise 5.14 asked you to do the same measurements for the special-purpose factorial machine shown in figure 5.11. Now perform the same analysis using the compiled factorial procedure. Take the ratio of the number of pushes in the compiled version to the number of pushes in the interpreted version, and do the same for the maximum stack depth. Since the number of operations and the stack depth used to compute n! are linear in n, these ratios should approach constants as n becomes lar ge. What are these constants? Similarly , find the ratios of the stack usage in the special-purpose machine to the usage in the interpreted version. Compare the ratios for special-purpose versus interpreted code to the ratios for compiled versus interpreted code. You should find that the special-purpose machine does much better than the compiled code, since the hand-tailored controller code should be much bette"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61215488r
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "r than what is produced by our rudimentary general-purpose compiler . b. Can you suggest improvements to the compiler that would help it generate code that would come closer in performance to the hand-tailored version? Exer cise 5.46.   Carry out an analysis like the one in exercise 5.45 to determine the ef fectiveness of compiling the tree-recursive Fibonacci procedure (define (fib n)     (if (< n 2)         n        (+ (fib (- n 1)) (fib (- n 2)))))   compared to the ef fectiveness of using the special-purpose Fibonacci machine of figure 5.12. (For measurement of the interpreted performance, see exercise 5.29.) For Fibonacci, the time resource used is not linear in n; hence the ratios of stack operations will not approach a limiting value that is independent of n. Exer cise 5.47.   This section described how to modify the explicit-control evaluator so that interpreted code can call compiled procedures. Show how to modify the compiler so that compiled procedures can call not only primitive procedures and com"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61216512p
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "piled procedures, but interpreted procedures as well. This requires modifying compile-procedure-call  to handle the case of compound (interpreted) procedures. Be sure to handle all the same target  and linkage combinations as in compile-proc-appl . To do the actual procedure application,the code needs to jump to the evaluator's compound-apply  entry point. This label cannot be directly referenced in object code (since the assembler requires that all labels referenced by the code it is assembling be defined there), so we will add a register called compapp  to the evaluator machine to hold this entry point, and add an instruction to initialize it:   (assign compapp (label compound-apply))     (branch (label external-entry))      ; branches if flag is set  read-eval-print-loop     ... To test your code, start by defining a procedure f that calls a procedure g. Use compile-and-go  to compile the definition of f and start the evaluator . Now , typing at the evaluator , define g and try to call f. Exer cise 5.48.  "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61217536
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " The compile-and-go  interface implemented in this section is awkward, since the compiler can be called only once (when the evaluator machine is started). Augment the compiler -interpreter interface by providing a compile-and-run  primitive that can be called from within the explicit-control evaluator as follows: ;;; EC-Eval input:   (compile-and-run    '(define (factorial n)       (if (= n 1)           1           (* (factorial (- n 1)) n))))   ;;; EC-Eval value:   ok  ;;; EC-Eval input:   (factorial 5)   ;;; EC-Eval value:   120  Exer cise 5.49.   As an alternative to using the explicit-control evaluator's read- eval-print loop, design a register machine that performs a read-compile-execute- print loop. That is, the machine should run a loop that reads an expression, compiles it, assembles and executes the resulting code, and prints the result. This is easy to run in our simulated setup, since we can arrange to call the procedures compile  and assemble  as \u201cregister -machine operations.\u201dExer cise 5.50.   Us"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61218560e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "e the compiler to compile the metacircular evaluator of section 4.1 and run this program using the register -machine simulator . (To compile more than one definition at a time, you can package the definitions in a begin .) The resulting interpreter will run very slowly because of the multiple levels of interpretation, but getting all the details to work is an instructive exercise. Exer cise 5.51.   Develop a rudimentary implementation of Scheme in C (or some other low-level language of your choice) by translating the explicit-control evaluator of section 5.4 into C. In order to run this code you will need to also provide appropriate storage-allocation routines and other run-time support. Exer cise 5.52.   As a counterpoint to exercise 5.51, modify the compiler so that it compiles Scheme procedures into sequences of C instructions. Compile the metacircular evaluator of section 4.1 to produce a Scheme interpreter written in C. 33 This is a theoretical statement. We are not claiming that the evaluator's data pat"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61219584h
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "hs are a particularly convenient or ef ficient set of data paths for a general-purpose computer . For example, they are not very good for implementing high-performance floating-point calculations or calculations that intensively manipulate bit vectors. 34 Actually , the machine that runs compiled code can be simpler than the interpreter machine, because we won't use the exp and unev  registers. The interpreter used these to hold pieces of unevaluated expressions. With the compiler , however , these expressions get built into the compiled code that the register machine will run. For the same reason, we don't need the machine operations that deal with expression syntax. But compiled code will use a few additional machine operations (to represent compiled procedure objects) that didn't appear in the explicit-control evaluator machine. 35 Notice, however , that our compiler is a Scheme program, and the syntax procedures that it uses to manipulate expressions are the actual Scheme procedures used with the metacirc"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61220608u
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ular evaluator . For the explicit-control evaluator , in contrast, we assumed that equivalent syntax operations were available as operations for the register machine. (Of course, when we simulated the register machine in Scheme, we used the actual Scheme procedures in our register machine simulation.) 36 This procedure uses a feature of Lisp called backquote  (or quasiquote ) that is handy for constructing lists. Preceding a list with a backquote symbol is much like quoting it, except that anything in the list that is flagged with a comma is evaluated. For example, if the value of linkage  is the symbol branch25 , then the expression `((goto (label ,linkage)))  evaluates to the list ((goto (label branch25))) . Similarly , if the value of x is the list (a b c), then `(1 2 ,(car x))  evaluates to the list (1 2 a) . 37 We can't just use the labels true-branch , false-branch , and after-if  as shown above, because there might be more than one if in the program. The compiler uses the procedure make-label  to gener"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61221632a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ate labels. Make-label  takes a symbol as ar gument and returns a new symbol that begins with the given symbol. Forexample, successive calls to (make-label 'a)  would return a1, a2, and so on. Make-label  can be implemented similarly to the generation of unique variable names in the query language, as follows: (define label-counter 0)     (define (new-label-number)     (set! label-counter (+ 1 label-counter))     label-counter)     (define (make-label name)     (string->symbol       (string-append (symbol->string name)                      (number->string (new-label-number)))))   38 We need machine operations to implement a data structure for representing compiled procedures, analogous to the structure for compound procedures described in section 4.1.3 : (define (make-compiled-procedure entry env)     (list 'compiled-procedure entry env))     (define (compiled-procedure? proc)     (tagged-list? proc 'compiled-procedure))     (define (compiled-procedure-entry c-proc) (cadr c-proc))     (define (compiled-proced"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61222656u
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ure-env c-proc) (caddr c-proc))   39 Actually , we signal an error when the tar get is not val and the linkage is return , since the only place we request return  linkages is in compiling procedures, and our convention is that procedures return their values in val. 40 Making a compiler generate tail-recursive code might seem like a straightforward idea. But most compilers for common languages, including C and Pascal, do not do this, and therefore these languages cannot represent iterative processes in terms of procedure call alone. The dif ficulty with tail recursion in these languages is that their implementations use the stack to store procedure ar guments and local variables as well as return addresses. The Scheme implementations described in this book store ar guments and variables in memory to be garbage-collected. The reason for using the stack for variables and ar guments is that it avoids the need for garbage collection in languages that would not otherwise require it, and is generally believed to be "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61223680m
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "more ef ficient. Sophisticated Lisp compilers can, in fact, use the stack for arguments without destroying tail recursion. (See Hanson 1990 for a description.) There is also some debate about whether stack allocation is actually more ef ficient than garbage collection in the first place, but the details seem to hinge on fine points of computer architecture. (See Appel 1987 and Miller and Rozas 1994 for opposing views on this issue.) 41 The variable all-regs  is bound to the list of names of all the registers: (define all-regs '(env proc val argl continue))   42 Note that preserving  calls append  with three arguments. Though the definition of append  shown in this book accepts only two ar guments, Scheme standardly provides an append  procedure that takes an arbitrary number of ar guments. 43 We have used the same symbol + here to denote both the source-language procedure and the machine operation. In general there will not be a one-to-one correspondence between primitives of the sourcelanguage and primitives"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61224704
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " of the machine. 44 Making the primitives into reserved words is in general a bad idea, since a user cannot then rebind these names to dif ferent procedures. Moreover , if we add reserved words to a compiler that is in use, existing programs that define procedures with these names will stop working. See exercise 5.44 for ideas on how to avoid this problem. 45 This is not true if we allow internal definitions, unless we scan them out. See exercise 5.43. 46 This is the modification to variable lookup required if we implement the scanning method to eliminate internal definitions (exercise 5.43). We will need to eliminate these definitions in order for lexical addressing to work. 47 Lexical addresses cannot be used to access variables in the global environment, because these names can be defined and redefined interactively at any time. With internal definitions scanned out, as in exercise 5.43, the only definitions the compiler sees are those at top level, which act on the global environment. Compilation of a def"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61225728i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "inition does not cause the defined name to be entered in the compile-time environment. 48 Of course, compiled procedures as well as interpreted procedures are compound (nonprimitive). For compatibility with the terminology used in the explicit-control evaluator , in this section we will use \u201ccompound\u201d to mean interpreted (as opposed to compiled). 49 Now that the evaluator machine starts with a branch , we must always initialize the flag  register before starting the evaluator machine. To start the machine at its ordinary read-eval-print loop, we could use (define (start-eceval)     (set! the-global-environment (setup-environment))     (set-register-contents! eceval 'flag false)     (start eceval))   50 Since a compiled procedure is an object that the system may try to print, we also modify the system print operation user-print  (from section 4.1.4 ) so that it will not attempt to print the components of a compiled procedure: (define (user-print object)     (cond ((compound-procedure? object)            (displ"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61226752a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ay (list 'compound-procedure                           (procedure-parameters object)                           (procedure-body object)                           '<procedure-env>)))           ((compiled-procedure? object)            (display '<compiled-procedure>))           (else (display object))))   51 We can do even better by extending the compiler to allow compiled code to call interpreted procedures. See exercise 5.47. 52 Independent of the strategy of execution, we incur significant overhead if we insist that errors encountered in execution of a user program be detected and signaled, rather than being allowed to kill the system or produce wrong answers. For example, an out-of-bounds array reference can be detected by checking the validity of the reference before performing it. The overhead of checking, however , can be many times the cost of the array reference itself, and a programmer should weigh speed against safety in determining whether such a check is desirable. A good compiler should be able to p"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61227776r
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "roduce code with such checks,should avoid redundant checks, and should allow programmers to control the extent and type of error checking in the compiled code. Compilers for popular languages, such as C and C++, put hardly any error -checking operations into running code, so as to make things run as fast as possible. As a result, it falls to programmers to explicitly provide error checking. Unfortunately , people often neglect to do this, even in critical applications where speed is not a constraint. Their programs lead fast and dangerous lives. For example, the notorious \u201cWorm\u201d that paralyzed the Internet in 1988 exploited the UNIXTM operating system's failure to check whether the input buffer has overflowed in the finger daemon. (See Spaf ford 1989.) 53 Of course, with either the interpretation or the compilation strategy we must also implement for the new machine storage allocation, input and output, and all the various operations that we took as \u201cprimitive\u201d in our discussion of the evaluator and compiler "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61228800.
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": ". One strategy for minimizing work here is to write as many of these operations as possible in Lisp and then compile them for the new machine. Ultimately , everything reduces to a small kernel (such as garbage collection and the mechanism for applying actual machine primitives) that is hand-coded for the new machine. 54 This strategy leads to amusing tests of correctness of the compiler , such as checking whether the compilation of a program on the new machine, using the compiled compiler , is identical with the compilation of the program on the original Lisp system. Tracking down the source of dif ferences is fun but often frustrating, because the results are extremely sensitive to minuscule details.  References Abelson, Harold, Andrew Berlin, Jacob Katzenelson, William McAllister , Guillermo Rozas, Gerald Jay Sussman, and Jack W isdom. 1992. The Supercomputer T oolkit: A general framework for special-purpose computing. International Journal of High-Speed Electr onics  3(3):337-361. Allen, John. 1978. Anatom"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61229824y
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "y of Lisp.  New Y ork: McGraw-Hill. ANSI X3.226-1994. American National Standar d for Information Systems \u2013 Programming Language \u2013 Common Lisp. Appel, Andrew W . 1987. Garbage collection can be faster than stack allocation. Information Pr ocessing Letters  25(4):275-279. Backus, John. 1978. Can programming be liberated from the von Neumann style? Communications of the ACM  21(8):613-641. Baker , Henry G., Jr . 1978. List processing in real time on a serial computer . Communications of the ACM  21(4):280-293. Batali, John, Neil Mayle, Howard Shrobe, Gerald Jay Sussman, and Daniel Weise. 1982. The Scheme-81 architecture \u2013 System and chip. In Proceedings of the MIT Confer ence on Advanced Resear ch in VLSI,  edited by Paul Penfield, Jr . Dedham, MA: Artech House. Borning, Alan. 1977. ThingLab \u2013 An object-oriented system for building simulations using constraints. In Proceedings of the 5th International Joint Confer ence on Artificial Intelligence. Borodin, Alan, and Ian Munro. 1975. The Computational Complexity "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61230848o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "of Algebraic and Numeric Pr oblems.  New Y ork: American Elsevier . Chaitin, Gregory J. 1975. Randomness and mathematical proof. Scientific American  232(5):47-52.Church, Alonzo. 1941. The Calculi of Lambda-Conversion.  Princeton, N.J.: Princeton University Press. Clark, Keith L. 1978. Negation as failure. In Logic and Data Bases.  New York: Plenum Press, pp. 293-322. Clinger , William. 1982. Nondeterministic call by need is neither lazy nor by name. In Proceedings of the ACM Symposium on Lisp and Functional Programming,  pp. 226-234. Clinger , William, and Jonathan Rees. 1991. Macros that work. In Proceedings of the 1991 ACM Confer ence on Principles of Pr ogramming Languages,  pp. 155-162. Colmerauer A., H. Kanoui, R. Pasero, and P . Roussel. 1973. Un syst\u00e8me de communication homme-machine en fran\u00e7ais. Technical report, Groupe Intelligence Artificielle, Universit\u00e9 d'Aix Marseille, Luminy . Cormen, Thomas, Charles Leiserson, and Ronald Rivest. 1990. Introduction to Algorithms.  Cambridge, MA: MIT Press. Darl"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61231872i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ington, John, Peter Henderson, and David T urner . 1982. Functional Programming and Its Applications.  New Y ork: Cambridge University Press. Dijkstra, Edsger W . 1968a. The structure of the \u201cTHE\u201d multiprogramming system. Communications of the ACM  11(5):341-346. Dijkstra, Edsger W . 1968b. Cooperating sequential processes. In Programming Languages , edited by F . Genuys. New Y ork: Academic Press, pp. 43-1 12. Dinesman, Howard P . 1968. Superior Mathematical Puzzles . New York: Simon and Schuster . deKleer , Johan, Jon Doyle, Guy Steele, and Gerald J. Sussman. 1977. AMORD: Explicit control of reasoning. In Proceedings of the ACM Symposium on Artificial Intelligence and Pr ogramming Languages,  pp. 116-125.Doyle, Jon. 1979. A truth maintenance system. Artificial Intelligence 12:231-272. Feigenbaum, Edward, and Howard Shrobe. 1993. The Japanese National Fifth Generation Project: Introduction, survey , and evaluation. In Futur e Generation Computer Systems,  vol. 9, pp. 105-1 17. Feeley , Marc. 1986. Deux appro"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61232896c
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ches \u00e0 l'implantation du language Scheme. Masters thesis, Universit\u00e9 de Montr\u00e9al. Feeley , Marc and Guy Lapalme. 1987. Using closures for code generation. Journal of Computer Languages  12(1):47-66. Feller , William. 1957. An Intr oduction to Pr obability Theory and Its Applications,  volume 1. New Y ork: John W iley & Sons. Fenichel, R., and J. Y ochelson. 1969. A Lisp garbage collector for virtual memory computer systems. Communications of the ACM  12(1 1):61 1-612. Floyd, Robert. 1967. Nondeterministic algorithms. JACM,  14(4):636-644. Forbus, Kenneth D., and Johan deKleer . 1993. Building Pr oblem Solvers. Cambridge, MA: MIT Press. Friedman, Daniel P ., and David S. W ise. 1976. CONS should not evaluate its ar guments. In Automata, Languages, and Pr ogramming: Thir d International Colloquium,  edited by S. Michaelson and R. Milner , pp. 257- 284. Friedman, Daniel P ., Mitchell W and, and Christopher T . Haynes. 1992. Essentials of Pr ogramming Languages.  Cambridge, MA: MIT Press/McGraw-Hill. Gabriel, Ric"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61233920h
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "hard P . 1988. The Why of Y. Lisp Pointers  2(2):15-25. Goldber g, Adele, and David Robson. 1983. Smalltalk-80: The Language and Its Implementation.  Reading, MA: Addison-W esley .Gordon, Michael, Robin Milner , and Christopher W adsworth. 1979. Edinbur gh LCF . Lecture Notes in Computer Science, volume 78. New York: Springer -Verlag. Gray , Jim, and Andreas Reuter . 1993. Transaction Pr ocessing: Concepts and Models.  San Mateo, CA: Mor gan-Kaufman. Green, Cordell. 1969. Application of theorem proving to problem solving. In Proceedings of the International Joint Confer ence on Artificial Intelligence,  pp. 219-240. Green, Cordell, and Bertram Raphael. 1968. The use of theorem-proving techniques in question-answering systems. In Proceedings of the ACM National Confer ence,  pp. 169-181. Griss, Martin L. 1981. Portable Standard Lisp, a brief overview . Utah Symbolic Computation Group Operating Note 58, University of Utah. Guttag, John V . 1977. Abstract data types and the development of data structures. Commun"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61234944i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ications of the ACM  20(6):397-404. Hamming, Richard W . 1980. Coding and Information Theory . Englewood Cliffs, N.J.: Prentice-Hall. Hanson, Christopher P . 1990. Efficient stack allocation for tail-recursive languages. In Proceedings of ACM Confer ence on Lisp and Functional Programming,  pp. 106-1 18. Hanson, Christopher P . 1991. A syntactic closures macro facility . Lisp Pointers,  4(3). Hardy , Godfrey H. 1921. Srinivasa Ramanujan. Proceedings of the London Mathematical Society  XIX(2). Hardy , Godfrey H., and E. M. W right. 1960. An Intr oduction to the Theory of Numbers.  4th edition. New Y ork: Oxford University Press. Havender , J. 1968. A voiding deadlocks in multi-tasking systems. IBM Systems Journal  7(2):74-84.Hearn, Anthony C. 1969. Standard Lisp. Technical report AIM-90, Artificial Intelligence Project, Stanford University . Henderson, Peter . 1980. Functional Pr ogramming: Application and Implementation.  Englewood Clif fs, N.J.: Prentice-Hall. Henderson. Peter . 1982. Functional Geometry . I"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61235968n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "n Confer ence Recor d of the 1982 ACM Symposium on Lisp and Functional Pr ogramming,  pp. 179-187. Hewitt, Carl E. 1969. PLANNER: A language for proving theorems in robots. In Proceedings of the International Joint Confer ence on Artificial Intelligence,  pp. 295-301. Hewitt, Carl E. 1977. Viewing control structures as patterns of passing messages. Journal of Artificial Intelligence  8(3):323-364. Hoare, C. A. R. 1972. Proof of correctness of data representations. Acta Informatica  1(1). Hodges, Andrew . 1983. Alan T uring: The Enigma.  New Y ork: Simon and Schuster . Hofstadter , Douglas R. 1979. G\u00f6del, Escher , Bach: An Eternal Golden Braid.  New Y ork: Basic Books. Hughes, R. J. M. 1990. Why functional programming matters. In Resear ch Topics in Functional Pr ogramming , edited by David T urner . Reading, MA: Addison-W esley , pp. 17-42. IEEE Std 1 178-1990. 1990. IEEE Standar d for the Scheme Pr ogramming Language. Ingerman, Peter , Edgar Irons, Kirk Sattley , and W allace Feurzeig; assisted by M. Lind, H"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61236992e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "erbert Kanner , and Robert Floyd. 1960. THUNKS: A way of compiling procedure statements, with some comments on procedure declarations. Unpublished manuscript. (Also, private communication from Wallace Feurzeig.)Kaldewaij, Anne. 1990. Programming: The Derivation of Algorithms.  New York: Prentice-Hall. Kohlbecker , Eugene Edmund, Jr . 1986. Syntactic extensions in the programming language Lisp. Ph.D. thesis, Indiana University . Konopasek, Milos, and Sundaresan Jayaraman. 1984. The TK!Solver Book: A Guide to Pr oblem-Solving in Science, Engineering, Business, and Education.  Berkeley , CA: Osborne/McGraw-Hill. Knuth, Donald E. 1973. Fundamental Algorithms.  Volume 1 of The Art of Computer Pr ogramming.  2nd edition. Reading, MA: Addison-W esley . Knuth, Donald E. 1981. Seminumerical Algorithms.  Volume 2 of The Art of Computer Pr ogramming.  2nd edition. Reading, MA: Addison-W esley . Kowalski, Robert. 1973. Predicate logic as a programming language. Technical report 70, Department of Computational Logic, Scho"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61238016o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ol of Artificial Intelligence, University of Edinbur gh. Kowalski, Robert. 1979. Logic for Pr oblem Solving.  New Y ork: North- Holland. Lamport, Leslie. 1978. Time, clocks, and the ordering of events in a distributed system. Communications of the ACM  21(7):558-565. Lampson, Butler , J. J. Horning, R. London, J. G. Mitchell, and G. K. Popek. 1981. Report on the programming language Euclid. Technical report, Computer Systems Research Group, University of T oronto. Landin, Peter . 1965. A correspondence between Algol 60 and Church's lambda notation: Part I. Communications of the ACM  8(2):89-101. Lieberman, Henry , and Carl E. Hewitt. 1983. A real-time garbage collector based on the lifetimes of objects. Communications of the ACM  26(6):419- 429. Liskov , Barbara H., and Stephen N. Zilles. 1975. Specification techniques for data abstractions. IEEE T ransactions on Softwar e Engineering  1(1):7-19. McAllester , David Allen. 1978. A three-valued truth-maintenance system. Memo 473, MIT Artificial Intelligence Lab"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61239040o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "oratory . McAllester , David Allen. 1980. An outlook on truth maintenance. Memo 551, MIT Artificial Intelligence Laboratory . McCarthy , John. 1960. Recursive functions of symbolic expressions and their computation by machine. Communications of the ACM  3(4):184-195. McCarthy , John. 1967. A basis for a mathematical theory of computation. In Computer Pr ograming and Formal Systems , edited by P . Braf fort and D. Hirschber g. North-Holland. McCarthy , John. 1978. The history of Lisp. In Proceedings of the ACM SIGPLAN Confer ence on the History of Pr ogramming Languages. McCarthy , John, P . W. Abrahams, D. J. Edwards, T . P. Hart, and M. I. Levin. 1965. Lisp 1.5 Pr ogrammer's Manual.  2nd edition. Cambridge, MA: MIT Press. McDermott, Drew , and Gerald Jay Sussman. 1972. Conniver reference manual. Memo 259, MIT Artificial Intelligence Laboratory . Miller , Gary L. 1976. Riemann's Hypothesis and tests for primality . Journal of Computer and System Sciences  13(3):300-317. Miller , James S., and Guillermo J. Roz"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61240064a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "as. 1994. Garbage collection is fast, but a stack is faster . Memo 1462, MIT Artificial Intelligence Laboratory . Moon, David. 1978. MacLisp reference manual, V ersion 0. Technical report, MIT Laboratory for Computer Science. Moon, David, and Daniel W einreb. 1981. Lisp machine manual. Technical report, MIT Artificial Intelligence Laboratory . Morris, J. H., Eric Schmidt, and Philip W adler . 1980. Experience with an applicative string processing language. In Proceedings of the 7th AnnualACM SIGACT/SIGPLAN Symposium on the Principles of Pr ogramming Languages. Phillips, Hubert. 1934. The Sphinx Pr oblem Book . London: Faber and Faber . Pitman, Kent. 1983. The revised MacLisp Manual (Saturday evening edition). Technical report 295, MIT Laboratory for Computer Science. Rabin, Michael O. 1980. Probabilistic algorithm for testing primality . Journal of Number Theory  12:128-138. Raymond, Eric. 1993. The New Hacker's Dictionary . 2nd edition. Cambridge, MA: MIT Press. Raynal, Michel. 1986. Algorithms for Mutual Ex"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61241088c
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "clusion.  Cambridge, MA: MIT Press. Rees, Jonathan A., and Norman I. Adams IV . 1982. T: A dialect of Lisp or , lambda: The ultimate software tool. In Confer ence Recor d of the 1982 ACM Symposium on Lisp and Functional Pr ogramming,  pp. 1 14-122. Rees, Jonathan, and W illiam Clinger (eds). 1991. The revised4 report on the algorithmic language Scheme. Lisp Pointers,  4(3). Rivest, Ronald, Adi Shamir , and Leonard Adleman. 1977. A method for obtaining digital signatures and public-key cryptosystems. T echnical memo LCS/TM82, MIT Laboratory for Computer Science. Robinson, J. A. 1965. A machine-oriented logic based on the resolution principle. Journal of the ACM  12(1):23. Robinson, J. A. 1983. Logic programming \u2013 Past, present, and future. New Generation Computing  1:107-124. Spafford, Eugene H. 1989. The Internet W orm: Crisis and aftermath. Communications of the ACM  32(6):678-688.Steele, Guy Lewis, Jr . 1977. Debunking the \u201cexpensive procedure call\u201d myth. In Proceedings of the National Confer ence of the AC"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61242112M
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "M,  pp. 153-62. Steele, Guy Lewis, Jr . 1982. An overview of Common Lisp. In Proceedings of the ACM Symposium on Lisp and Functional Pr ogramming,  pp. 98-107. Steele, Guy Lewis, Jr . 1990. Common Lisp: The Language.  2nd edition. Digital Press. Steele, Guy Lewis, Jr ., and Gerald Jay Sussman. 1975. Scheme: An interpreter for the extended lambda calculus. Memo 349, MIT  Artificial Intelligence Laboratory . Steele, Guy Lewis, Jr ., Donald R. W oods, Raphael A. Finkel, Mark R. Crispin, Richard M. Stallman, and Geof frey S. Goodfellow . 1983. The Hacker's Dictionary . New Y ork: Harper & Row . Stoy, Joseph E. 1977. Denotational Semantics.  Cambridge, MA: MIT Press. Sussman, Gerald Jay , and Richard M. Stallman. 1975. Heuristic techniques in computer -aided circuit analysis. IEEE T ransactions on Cir cuits and Systems  CAS-22(1 1):857-865. Sussman, Gerald Jay , and Guy Lewis Steele Jr . 1980. Constraints \u2013 A language for expressing almost-hierachical descriptions. AI Journal  14:1- 39. Sussman, Gerald Jay , and J"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61243136a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ack W isdom. 1992. Chaotic evolution of the solar system. Science  257:256-262. Sussman, Gerald Jay , Terry W inograd, and Eugene Charniak. 1971. Microplanner reference manual. Memo 203A, MIT Artificial Intelligence Laboratory . Sutherland, Ivan E. 1963. SKETCHP AD: A man-machine graphical communication system. Technical report 296, MIT Lincoln Laboratory . Teitelman, W arren. 1974. Interlisp reference manual. Technical report, Xerox Palo Alto Research Center .Thatcher , James W ., Eric G. W agner , and Jesse B. W right. 1978. Data type specification: Parameterization and the power of specification techniques. In Confer ence Recor d of the T enth Annual ACM Symposium on Theory of Computing , pp. 1 19-132. Turner , David. 1981. The future of applicative languages. In Proceedings of the 3r d Eur opean Confer ence on Informatics, Lecture Notes in Computer Science, volume 123. New Y ork: Springer - Verlag, pp. 334-348. Wand, Mitchell. 1980. Continuation-based program transformation strategies. Journal of the ACM "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61244160
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " 27(1):164-180. Waters, Richard C. 1979. A method for analyzing loop programs. IEEE Transactions on Softwar e Engineering  5(3):237-247. Winograd, T erry. 1971. Procedures as a representation for data in a computer program for understanding natural language. Technical report AI TR-17, MIT Artificial Intelligence Laboratory . Winston, Patrick. 1992. Artificial Intelligence . 3rd edition. Reading, MA: Addison-W esley . Zabih, Ramin, David McAllester , and David Chapman. 1987. Non- deterministic Lisp with dependency-directed backtracking. AAAI-87 , pp. 59-64. Zippel, Richard. 1979. Probabilistic algorithms for sparse polynomials. Ph.D. dissertation, Department of Electrical Engineering and Computer Science, MIT . Zippel, Richard. 1993. Effective Polynomial Computation.  Boston, MA: Kluwer Academic Publishers.  List of Exercises 1.1  1.2  1.3  1.4  1.5  1.6  1.7  1.8  1.9  1.10  1.11  1.12  1.13  1.14  1.15  1.16  1.17  1.18  1.19  1.20  1.21  1.22  1.23  1.24  1.25  1.26  1.27  1.28  1.29  1.30  1.31  1.32 1.33 "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61245184
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " 1.34  1.35  1.36  1.37  1.38  1.39  1.40  1.41  1.42  1.43  1.44  1.45  1.46  2.1  2.2  2.3  2.4  2.5  2.6  2.7  2.8  2.9  2.10  2.11  2.12  2.13  2.14  2.15  2.16  2.17  2.18  2.19  2.20  2.21  2.22  2.23 2.24  2.25  2.26  2.27  2.28  2.29  2.30  2.31  2.32  2.33  2.34  2.35  2.36  2.37  2.38  2.39  2.40  2.41  2.42  2.43  2.44  2.45  2.46  2.47  2.48  2.49  2.50  2.51  2.52  2.53  2.54  2.55  2.56  2.57  2.58  2.59  2.60 2.61  2.62  2.63  2.64  2.65  2.66  2.67  2.68  2.69  2.70  2.71  2.72  2.73  2.74  2.75  2.76  2.77  2.78  2.79  2.80  2.81  2.82  2.83  2.84  2.85  2.86  2.87  2.88  2.89  2.90  2.91  2.92  2.93  2.94  2.95  2.96  2.97 3.1  3.2  3.3  3.4  3.5  3.6  3.7  3.8  3.9  3.10  3.11  3.12  3.13  3.14  3.15  3.16  3.17  3.18  3.19  3.20  3.21  3.22  3.23  3.24  3.25  3.26  3.27  3.28  3.29  3.30  3.31  3.32  3.33  3.34  3.35  3.36  3.37 3.38  3.39  3.40  3.41  3.42  3.43  3.44  3.45  3.46  3.47  3.48  3.49  3.50  3.51  3.52  3.53  3.54  3.55  3.56  3.57  3.58  3.59  3.60  3.61  3.62  3.63  3.64  3"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61246208.
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": ".65  3.66  3.67  3.68  3.69  3.70  3.71  3.72  3.73  3.74 3.75  3.76  3.77  3.78  3.79  3.80  3.81  3.82  4.1  4.2  4.3  4.4  4.5  4.6  4.7  4.8  4.9  4.10  4.11  4.12  4.13  4.14  4.15  4.16  4.17  4.18  4.19  4.20  4.21  4.22  4.23  4.24  4.25  4.26  4.27  4.28  4.29 4.30  4.31  4.32  4.33  4.34  4.35  4.36  4.37  4.38  4.39  4.40  4.41  4.42  4.43  4.44  4.45  4.46  4.47  4.48  4.49  4.50  4.51  4.52  4.53  4.54  4.55  4.56  4.57  4.58  4.59  4.60  4.61  4.62  4.63  4.64  4.65  4.66 4.67  4.68  4.69  4.70  4.71  4.72  4.73  4.74  4.75  4.76  4.77  4.78  4.79  5.1  5.2  5.3  5.4  5.5  5.6  5.7  5.8  5.9  5.10  5.11  5.12  5.13  5.14  5.15  5.16  5.17  5.18  5.19  5.20  5.21  5.22  5.23  5.24 5.25  5.26  5.27  5.28  5.29  5.30  5.31  5.32  5.33  5.34  5.35  5.36  5.37  5.38  5.39  5.40  5.41  5.42  5.43  5.44  5.45  5.46  5.47  5.48  5.49  5.50  5.51  5.52   Index Any inaccuracies in this index may be explained by the fact that it has been prepared with the help of a computer . Donald E. Knuth, Fundamental A"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61247232l
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "lgorithms  (Volume 1 of The Art of Computer Pr ogramming )   ! in names   \" (double quote)   \u03bb calculus, see lambda calculus   \u27fc notation for mathematical function   \u03c0 , see pi   \u03a3 (sigma) notation   \u03b8, see theta   ' (single quote)       read  and, [2]  * (primitive multiplication procedure)   + (primitive addition procedure)   , (comma, used with backquote)   - (primitive subtraction procedure)       as negation   / (primitive division procedure)   < (primitive numeric comparison predicate) = (primitive numeric equality predicate)   =number?   =zero?  (generic)       for polynomials   > (primitive numeric comparison predicate) >=, [2]  ? , in predicate names   #f  #t ` (backquote)   ;, see semicolon   Abelson, Harold   abs, [2], [3]  absolute value   abstract data , see also  data abstraction   abstract models for data   abstract syntax       in metacircular evaluator       in query interpreter   abstraction, see also  means of abstraction; data abstraction; higher -order procedures       common pattern and "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61248256
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "      metalinguistic       procedural       in register -machine design       of search in nondeterministic programming   abstraction barriers , [2], [3]      in complex-number system       in generic arithmetic system   accelerated-sequence   accumulate , [2]      same as fold-right   accumulate-n   accumulator , [2]  \u00c1ch\u00e1rya, Bh\u00e1scara   Ackermann's function   acquire a mutex   actions, in register machine   actual-value   Ada      recursive procedures   Adams, Norman I., IV   add (generic)       used for polynomial coef ficients , [2] add-action! , [2]  add-binding-to-frame!   add-complex   add-complex-to-schemenum   add-interval   add-lists   add-poly   add-rat   add-rule-or-assertion!   add-streams   add-terms   add-to-agenda! , [2]  add-vect   addend   adder       full      half      ripple-carry   adder  (primitive constraint)   additivity , [2], [3], [4]  address   address arithmetic   Adelman, Leonard   adjoin-arg   adjoin-set       binary-tree representation       ordered-list representation       un"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61249280o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ordered-list representation       for weighted sets   adjoin-term , [2]  advance-pc   after-delay , [2]  agenda, see digital-circuit simulation   A'h-mose   algebra, symbolic, see symbolic algebra   algebraic expression       differentiating      representing       simplifying   algebraic specification for data   Algol       block structure       call-by-name ar gument passing , [2]      thunks , [2]      weakness in handling compound objects   algorithm       optimal       probabilistic , [2]  aliasing   all-regs  (compiler)   Allen, John   alternative of if  always-true   amb  amb evaluator , see nondeterministic evaluator   ambeval   an-element-of   an-integer-starting-from   analog computer   analyze        metacircular       nondeterministic   analyze-...        metacircular , [2]      nondeterministic   analyze-amb   analyzing evaluator       as basis for nondeterministic evaluator       let  and (query language)       evaluation of , [2], [3]  and (special form)       evaluation of       why a special "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61250304f
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "form      with no subexpressions   and-gate       and-gate   angle        data-directed       polar representation       rectangular representation       with tagged data   angle-polar   angle-rectangular   announce-output   APL   Appel, Andrew W .  append , [2], [3]      as accumulation       append!  vs.      with arbitrary number of ar guments       as register machine       \u201cwhat is\u201d (rules) vs. \u201chow to\u201d (procedure)   append!       as register machine   append-instruction-sequences , [2]  append-to-form  (rules)   application?   applicative-order evaluation       in Lisp       normal order vs. , [2], [3]  apply  (lazy)   apply  (metacircular)       primitive apply  vs.  apply  (primitive procedure)   apply-dispatch       modified for compiled code   apply-generic       with coercion , [2]      with coercion by raising       with coercion of multiple ar guments      with coercion to simplify       with message passing       with tower of types   apply-primitive-procedure , [2], [3]  apply-rules   arbiter  "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61251328
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " arctangent   argl  register   argument passing, see call-by-name ar gument passing; call-by-need argument passing   argument(s)       arbitrary number of , [2]      delayed   Aristotle's De caelo  (Buridan's commentary on)   arithmetic       address arithmetic       generic , see also  generic arithmetic operations       on complex numbers       on intervals       on polynomials, see polynomial arithmetic       on power series , [2]      on rational numbers       primitive procedures for   articles   ASCII code   assemble , [2]  assembler , [2]  assert!  (query interpreter)   assertion       implicit   assign  (in register machine)       simulating       storing label in register   assign-reg-name   assign-value-exp   assignment , see also  set!        benefits of      bugs associated with , [2]      costs of   assignment operator , see also  set!    assignment-value   assignment-variable   assignment?   assoc   atan  (primitive procedure)   atomic operations supported in hardware   atomic requirement for te"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61252352s
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "st-and-set!   attach-tag       using Scheme data types   augend   automagically   automatic search , see also  search       history of   automatic storage allocation   average   average damping   average-damp   averager  (constraint)   B-tree   backquote   backtracking , see also  nondeterministic computing   Backus, John   Baker , Henry G., Jr .  balanced binary tree , see also  binary tree   balanced mobile   bank account , [2]      exchanging balances       joint, [2]      joint, modeled with streams       joint, with concurrent access       password-protected       serialized      stream model       transferring money   barrier synchronization   Barth, John   Basic       restrictions on compound data       weakness in handling compound objects   Batali, John Dean   begin  (special form)       implicit in consequent of cond  and in procedure body   begin-actions   begin?   below , [2]  Bertrand's Hypothesis beside , [2]  bignum   binary numbers, addition of, see adder   binary search   binary tree       ba"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61253376l
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "lanced       converting a list to a       converting to a list       for Huf fman encoding       represented with lists       sets represented as       table structured as   bind  binding       deep   binomial coef ficients   black box   block structure , [2]      in environment model       in query language   blocked process   body of a procedure   Bolt Beranek and Newman Inc.  Borning, Alan   Borodin, Alan   bound variable   box-and-pointer notation       end-of-list marker   branch  (in register machine)       simulating   branch of a tree   branch-dest   breakpoint   broken heart   bug      capturing a free variable       order of assignments       side ef fect with aliasing   bureaucracy   Buridan, Jean   busy-waiting   C       compiling Scheme into       error handling , [2]      recursive procedures       restrictions on compound data       Scheme interpreter written in , [2]  ca...r  cache-coherence protocols   cadr   calculator , fixed points with   call-by-name ar gument passing , [2]  call-by-need "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61254400a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ar gument passing , [2]      memoization and   call-each   cancer of the semicolon   canonical form, for polynomials   capturing a free variable  car (primitive procedure)       axiom for       implemented with vectors       as list operation       origin of the name       procedural implementation of , [2], [3], [4], [5]  Carmichael numbers , [2]  case analysis       data-directed programming vs.       general , see also  cond        with two cases ( if)  cd...r  cdr (primitive procedure)       axiom for       implemented with vectors       as list operation       origin of the name       procedural implementation of , [2], [3], [4], [5]  cdr down a list   cell, in serializer implementation   celsius-fahrenheit-converter       expression-oriented   center   Ces\u00e0ro, Ernesto   cesaro-stream   cesaro-test   Chaitin, Gregory   Chandah-sutra   change and sameness       meaning of       shared data and   changing money , see counting change   chaos in the Solar System   Chapman, David   character strings       pri"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61255424m
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "mitive procedures for , [2]      quotation of  character , ASCII encoding   Charniak, Eugene   Chebyshev , Pafnutii L'vovich   chess, eight-queens puzzle , [2]  chip implementation of Scheme , [2]  chronological backtracking   Chu Shih-chieh   Church numerals   Church, Alonzo , [2]  Church-T uring thesis   circuit       digital, see digital-circuit simulation       modeled with streams , [2]  Clark, Keith L.   clause, of a cond       additional syntax   Clinger , William , [2]  closed world assumption   closure       in abstract algebra       closure property of cons       closure property of picture-language operations , [2]      lack of in many languages   coal, bituminous   code       ASCII       fixed-length       Huf fman, see Huffman code       Morse       prefix       variable-length   code generator       arguments of       value of   coeff , [2]  coercion       in algebraic manipulation      in polynomial arithmetic       procedure       table   Colmerauer , Alain   combination       combination as o"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61256448p
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "perator of       compound expression as operator of       evaluation of       lambda  expression as operator of       as operator of combination       as a tree   combination, means of , see also  closure   comma, used with backquote   comments in programs   Common Lisp       treatment of nil  compacting garbage collector   compilation, see compiler   compile   compile-and-go , [2]  compile-and-run   compile-application   compile-assignment   compile-definition   compile-if   compile-lambda   compile-linkage   compile-proc-appl   compile-procedure-call   compile-quoted   compile-self-evaluating   compile-sequence   compile-time environment , [2], [3]      open coding and   compile-variable   compiled-apply   compiled-procedure-entry  compiled-procedure-env   compiled-procedure?   compiler       interpreter vs. , [2]      tail recursion, stack allocation, and garbage-collection   compiler for Scheme , see also  code generator; compile-time environment; instruction sequence; linkage descriptor; tar get register"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61257472
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "       analyzing evaluator vs. , [2]      assignments       code generators, see compile-...        combinations       conditionals       definitions       efficiency       example compilation       explicit-control evaluator vs. , [2], [3]      expression-syntax procedures       interfacing to evaluator       label generation       lambda  expressions       lexical addressing       linkage code       machine-operation use       monitoring performance (stack use) of compiled code , [2], [3]      open coding of primitives , [2]      order of operand evaluation       procedure applications       quotations       register use , [2], [3]      running compiled code       scanning out internal definitions , [2]      self-evaluating expressions       sequences of expressions       stack usage , [2], [3]      structure of       tail-recursive code generated by       variables  complex  package   complex numbers       polar representation       rectangular representation       rectangular vs. polar form       represen"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61258496t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ted as tagged data   complex->complex   complex-number arithmetic       interfaced to generic arithmetic system       structure of system   composition of functions   compound data, need for   compound expression , see also  combination; special form       as operator of combination   compound procedure , see also  procedure       used like primitive procedure   compound query       processing , [2], [3], [4], [5]  compound-apply   compound-procedure?   computability , [2]  computational process , see also  process   computer science , [2]      mathematics vs. , [2]  concrete data representation   concurrency       correctness of concurrent programs       deadlock       functional programming and       mechanisms for controlling   cond  (special form)       additional clause syntax       clause       evaluation of       if vs.      implicit begin  in consequent   cond->if  cond-actions   cond-clauses   cond-else-clause?   cond-predicate   cond?   conditional expression       cond       if  congruent modulo n "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61259520
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " conjoin   connect , [2]  connector(s), in constraint system       operations on       representing   Conniver   cons  (primitive procedure)       axiom for       closure property of       implemented with mutators       implemented with vectors       as list operation       meaning of the name       procedural implementation of , [2], [3], [4], [5], [6]  cons  up a list   cons-stream  (special form) , [2]      lazy evaluation and       why a special form   consciousness, expansion of   consequent       of cond  clause       of if  const  (in register machine)       simulating       syntax of   constant  (primitive constraint)   constant, specifying in register machine   constant-exp  constant-exp-value   constraint network   constraint(s)       primitive       propagation of   construct-arglist   constructor       as abstraction barrier   contents       using Scheme data types   continuation       in nondeterministic evaluator , [2], see also  failure continuation; success continuation       in register -mac"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61260544h
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "hine simulator   continue  register       in explicit-control evaluator       recursion and   continued fraction       e as      golden ratio as       tangent as   control structure   controller for register machine       controller diagram   conventional interface       sequence as   Cormen, Thomas H.   corner-split   correctness of a program   cos (primitive procedure)   cosine       fixed point of       power series for   cosmic radiation   count-change   count-leaves , [2]      as accumulation      as register machine   count-pairs   counting change , [2]  credit-card accounts, international   Cressey , David   cross-type operations   cryptography   cube , [2], [3]  cube root       as fixed point       by Newton's method   cube-root   current time, for simulation agenda   current-time , [2]  cycle in list       detecting   Darlington, John   data, [2]      abstract , see also  data abstraction       abstract models for       algebraic specification for       compound       concrete representation of      "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61261568
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " hierarchical , [2]      list-structured       meaning of       mutable, see mutable data objects       numerical       procedural representation of       as program       shared       symbolic       tagged , [2]  data abstraction , [2], [3], [4], [5], see also  metacircular evaluator       for queue  data base       data-directed programming and       indexing , [2]      Insatiable Enterprises personnel       logic programming and       Microshaft personnel       as set of records   data paths for register machine       data-path diagram   data types       in Lisp       in strongly typed languages   data-directed programming , [2]      case analysis vs.       in metacircular evaluator       in query interpreter   data-directed recursion   deadlock       avoidance       recovery   debug   decimal point in numbers   declarative vs. imperative knowledge , [2]      logic programming and , [2]      nondeterministic computing and   decode   decomposition of program into parts   deep binding   deep-reverse   deferr"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61262592e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ed operations   define  (special form)       with dotted-tail notation       environment model of       lambda  vs.      for procedures , [2]      syntactic sugar       value of      why a special form   define  (special form)       internal, see internal definition   define-variable! , [2]  definite integral       estimated with Monte Carlo simulation , [2]  definition, see define ; internal definition   definition-value   definition-variable   definition?   deKleer , Johan , [2]  delay  (special form)       explicit       explicit vs. automatic       implementation using lambda       lazy evaluation and       memoized , [2]      why a special form   delay , in digital circuit   delay-it   delayed ar gument delayed evaluation , [2]      assignment and       explicit vs. automatic       in lazy evaluator       normal-order evaluation and       printing and       streams and   delayed object   delete-queue! , [2]  denom , [2]      axiom for       reducing to lowest terms   dense polynomial   dependency-directe"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61263616d
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "d backtracking   deposit  , with external serializer   deposit  message for bank account  depth-first search   deque   deriv  (numerical)   deriv  (symbolic)       data-directed   derivative of a function   derived expressions in evaluator       adding to explicit-control evaluator   design, stratified   differential equation , see also  solve        second-order , [2]  differentiation       numerical       rules for , [2]      symbolic , [2]  diffusion, simulation of   digital signal   digital-circuit simulation       agenda       agenda implementation       primitive function boxes       representing wires       sample simulation   Dijkstra, Edsger W ybe  Dinesman, Howard P .  Diophantus's Arithmetic , Fermat's copy of   disjoin   dispatching       comparing dif ferent styles       on type , see also  data-directed programming   display  (primitive procedure) , [2]  display-line   display-stream   distinct?   div (generic)   div-complex   div-interval      division by zero   div-poly   div-rat   div-series "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61264640
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "  div-terms   divides?   divisible?   division of integers   dog, perfectly rational, behavior of   DOS/W indows   dot-product   dotted-tail notation       for procedure parameters , [2]      in query pattern , [2]      in query-language rule       read  and  Doyle, Jon   draw-line   driver loop       in explicit-control evaluator       in lazy evaluator       in metacircular evaluator       in nondeterministic evaluator , [2]      in query interpreter , [2]  driver-loop        for lazy evaluator       for metacircular evaluator       for nondeterministic evaluator   e       as continued fraction       as solution to dif ferential equation   ex, power series for   Earth, measuring circumference of   edge1-frame   edge2-frame  efficiency , see also  order of growth, see also  order of growth       of compilation       of data-base access       of evaluation       of Lisp       of query processing       of tree-recursive process   EIEIO   eight-queens puzzle , [2]  electrical circuits, modeled with streams , [2"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61265664]
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "]  element-of-set?       binary-tree representation       ordered-list representation       unordered-list representation   else  (special symbol in cond )  embedded language, language design using   empty list       denoted as '()      recognizing with null?   empty stream   empty-agenda? , [2]  empty-arglist   empty-instruction-sequence   empty-queue? , [2]  empty-termlist? , [2]  encapsulated name   enclosing environment   enclosing-environment   encode   end-of-list marker   end-segment , [2]  end-with-linkage   engineering vs. mathematics   entry   enumerate-interval   enumerate-tree   enumerator  env register   environment , [2]      compile-time, see compile-time environment       as context for evaluation       enclosing       global, see global environment       lexical scoping and       in query interpreter       renaming vs.   environment model of evaluation , [2]     environment structure       internal definitions       local state       message passing       metacircular evaluator and       proc"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61266688e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "edure-application example       rules for evaluation       tail recursion and   eq? (primitive procedure)       for arbitrary objects       as equality of pointers , [2]      implementation for symbols       numerical equality and   equ?  (generic predicate)   equal-rat?   equal?   equality       in generic arithmetic system       of lists       of numbers , [2], [3]      referential transparency and       of symbols   equation, solving, see half-interval method; Newton's method; solve    Eratosthenes   error  (primitive procedure)   error handling       in compiled code      in explicit-control evaluator , [2]  Escher , Maurits Cornelis   estimate-integral   estimate-pi , [2]  Euclid's Algorithm , [2], see also  greatest common divisor       order of growth       for polynomials   Euclid's Elements   Euclid's proof of infinite number of primes   Euclidean ring   Euler , Leonhard       proof of Fermat's Little Theorem       series accelerator   euler-transform   ev-application   ev-assignment   ev-begin   ev-"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61267712d
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "definition   ev-if   ev-lambda   ev-quoted   ev-self-eval   ev-sequence        with tail recursion       without tail recursion   ev-variable   eval  (lazy)   eval  (metacircular) , [2]      analyzing version       data-directed       primitive eval  vs.  eval  (primitive procedure)       MIT Scheme       used in query interpreter   eval-assignment   eval-definition   eval-dispatch  eval-if  (lazy)   eval-if  (metacircular)   eval-sequence   evaluation       applicative-order , see applicative-order evaluation       delayed, see delayed evaluation       environment model of, see environment model of evaluation       models of       normal-order , see normal-order evaluation       of a combination       of and      of cond       of if      of or      of primitive expressions       of special forms       order of subexpression evaluation, see order of evaluation       substitution model of, see substitution model of procedure application   evaluator , see also  interpreter       as abstract machine       metaci"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61268736r
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "rcular       as universal machine   evaluators, see metacircular evaluator; analyzing evaluator; lazy evaluator; nondeterministic evaluator; query interpreter; explicit-control evaluator   even-fibs , [2]  even?   evening star , see Venus   event-driven simulation   evlis tail recursion   exact integer   exchange   exclamation point in names   execute   execute-application        metacircular       nondeterministic   execution procedure      in analyzing evaluator       in nondeterministic evaluator , [2], [3]      in register -machine simulator , [2]  exp register   expand-clauses   explicit-control evaluator for Scheme       assignments       combinations       compound procedures       conditionals       controller       data paths       definitions       derived expressions       driver loop       error handling , [2]      expressions with no subexpressions to evaluate       as machine-language program       machine model       modified for compiled code       monitoring performance (stack use)       norm"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61269760a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "al-order evaluation       operand evaluation       operations       optimizations (additional)       primitive procedures       procedure application       registers       running       sequences of expressions       special forms (additional) , [2]      stack usage       tail recursion , [2], [3]      as universal machine   expmod , [2], [3]  exponential growth       of tree-recursive Fibonacci-number computation  exponentiation       modulo n  expression, see also  compound expression; primitive expression       algebraic, see algebraic expressions       self-evaluating       symbolic , see also  symbol(s)   expression-oriented vs. imperative programming style   expt        linear iterative version       linear recursive version       register machine for   extend-environment , [2]  extend-if-consistent   extend-if-possible   external-entry   extract-labels , [2]   #f  factorial , see also  factorial        infinite stream       with letrec       without letrec  or define   factorial        as an abstract m"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61270784a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "achine       compilation of , [2]      environment structure in evaluating       linear iterative version       linear recursive version       register machine for (iterative) , [2]      register machine for (recursive) , [2]      stack usage, compiled       stack usage, interpreted , [2]      stack usage, register machine     with assignment       with higher -order procedures   failure continuation (nondeterministic evaluator) , [2]     constructed by amb      constructed by assignment       constructed by driver loop   failure, in nondeterministic computation       bug vs.       searching and   false   false   false?   fast-expt   fast-prime?   feedback loop, modeled with streams   Feeley , Marc   Feigenbaum, Edward   Fenichel, Robert   Fermat, Pierre de   Fermat test for primality       variant of   Fermat's Little Theorem       alternate form       proof   fermat-test   fetch-assertions   fetch-rules   fib       linear iterative version       logarithmic version       register machine for (tree-recursive"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61271808)
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": ") , [2]      stack usage, compiled       stack usage, interpreted       tree-recursive version , [2]      with memoization       with named let  Fibonacci numbers , see also  fib       Euclid's GCD algorithm and       infinite stream of, see fibs    fibs  (infinite stream)      implicit definition   FIFO buf fer  filter , [2]  filter   filtered-accumulate   find-assertions   find-divisor   first-agenda-item , [2]  first-class elements in language   first-exp   first-frame   first-operand   first-segment   first-term , [2]  fixed point       computing with calculator       of cosine       cube root as       fourth root as       golden ratio as       as iterative improvement       in Newton's method       nth root as       square root as , [2], [3]      of transformed function       unification and   fixed-length code   fixed-point       as iterative improvement   fixed-point-of-transform   flag  register   flatmap   flatten-stream   flip-horiz , [2]  flip-vert , [2]  flipped-pairs , [2], [3]  Floyd, Robert  fo"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61272832l
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ld-left   fold-right   for-each , [2]  for-each-except   Forbus, Kenneth D.   force , [2]      forcing a thunk vs.   force a thunk   force-it       memoized version   forget-value! , [2]  formal parameters       names of       scope of   formatting input expressions   Fortran , [2]      inventor of       restrictions on compound data   forwarding address   fourth root, as fixed point   fraction, see rational number(s)   frame (environment model)       as repository of local state       global   frame (picture language) , [2]      coordinate map   frame (query interpreter) , see also  pattern matching; unification       representation   frame-coord-map   frame-values   frame-variables   framed-stack discipline   Franz Lisp   free  register , [2]  free list   free variable       capturing      in internal definition   Friedman, Daniel P ., [2]  fringe       as a tree enumeration   front-ptr   front-queue , [2]  full-adder       full-adder   function (mathematical)        \u27fc notation for       Ackermann's       c"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61273856o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "omposition of       derivative of       fixed point of       procedure vs.       rational       repeated application of       smoothing of   function box, in digital circuit   functional programming , [2]      concurrency and       functional programming languages       time and   Gabriel, Richard P .  garbage collection       memoization and       mutation and       tail recursion and   garbage collector       compacting       mark-sweep       stop-and-copy   GCD, see greatest common divisor   gcd      register machine for , [2]gcd-terms   general-purpose computer , as universal machine   generate-huffman-tree   generating sentences   generic arithmetic operations       structure of system   generic operation   generic procedure , [2]      generic selector , [2] Genesis   get, [2]  get-contents   get-global-environment   get-register   get-register-contents , [2]  get-signal , [2]  get-value , [2]  glitch   global environment , [2]      in metacircular evaluator   global frame   Goguen, Joseph   golden ratio"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61274880
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "       as continued fraction       as fixed point   Gordon, Michael   goto  (in register machine)       label as destination       simulating   goto-dest   grammar   graphics, see picture language   Gray , Jim   greatest common divisor , see also  gcd       generic       of polynomials       used to estimate \u03c0      used in rational-number arithmetic   Green, Cordell   Griss, Martin Lewis   Guttag, John V ogel   half-adder       half-adder       simulation of   half-interval method       half-interval-method       Newton's method vs.   halting problem   Halting Theorem   Hamming, Richard W esley , [2]  Hanson, Christopher P ., [2]  Hardy , Godfrey Harold , [2]  has-value? , [2]  Hassle   Havender , J.  Haynes, Christopher T .  headed list , [2]  Hearn, Anthony C.   Henderson, Peter , [2], [3]      Henderson diagram   Heraclitus   Heron of Alexandria   Hewitt, Carl Eddie , [2], [3], [4]  hiding principle   hierarchical data structures , [2]  hierarchy of types       in symbolic algebra       inadequacy of   hig"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61275904h
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "h-level language, machine language vs.   higher -order procedures       in metacircular evaluator       procedure as ar gument      procedure as general method       procedure as returned value       strong typing and   Hilfinger , Paul   Hoare, Charles Antony Richard   Hodges, Andrew   Hofstadter , Douglas R.   Horner , W. G.  Horner's rule   \u201chow to\u201d vs. \u201cwhat is\u201d description, see imperative vs. declarative knowledge   Huffman code       optimality of       order of growth of encoding   Huffman, David   Hughes, R. J. M.   IBM 704   identity   if (special form)       cond  vs.      evaluation of       normal-order evaluation of       one-armed (without alternative)       predicate, consequent, and alternative of       why a special form   if-alternative   if-consequent   if-predicate   if?  imag-part        data-directed       polar representation       rectangular representation       with tagged data   imag-part-polar  imag-part-rectangular   imperative programming   imperative vs. declarative knowledge , "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61276928[
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "[2]      logic programming and , [2]      nondeterministic computing and   imperative vs. expression-oriented programming style   implementation dependencies, see also  unspecified values       numbers       order of subexpression evaluation   inc  incremental development of programs   indeterminate of a polynomial   indexing a data base , [2]  inference, method of   infinite series   infinite stream(s)       merging, [2], [3], [4]      merging as a relation       of factorials       of Fibonacci numbers, see fibs        of integers, see integers        of pairs       of prime numbers, see primes        of random numbers       representing power series       to model signals       to sum a series   infix notation, prefix notation vs.   inform-about-no-value   inform-about-value   information retrieval, see data base   Ingerman, Peter   initialize-stack  operation in register machine , [2]  insert!        in one-dimensional table       in two-dimensional table   insert-queue! , [2] install-complex-package   in"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61277952s
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "stall-polar-package   install-polynomial-package   install-rational-package   install-rectangular-package   install-scheme-number-package   instantiate   instantiate a pattern   instruction counting   instruction execution procedure   instruction sequence , [2]  instruction tracing   instruction-execution-proc   instruction-text   integer(s)       dividing       exact   integerizing factor   integers  (infinite stream)       implicit definition       lazy-list version   integers-starting-from   integral, see also  definite integral; Monte Carlo integration       of a power series   integral , [2], [3]      with delayed ar gument       with lambda       lazy-list version       need for delayed evaluation   integrate-series   integrated-circuit implementation of Scheme , [2]  integrator , for signals   interleave   interleave-delayed   Interlisp   internal definition       in environment model      free variable in       let vs.      in nondeterministic evaluator       position of       restrictions on       sc"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61278976a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "anning out       scope of name   Internet \u201cW orm\u201d   interning symbols   interpreter , see also  evaluator       compiler vs. , [2]      read-eval-print loop   intersection-set       binary-tree representation       ordered-list representation       unordered-list representation   interval arithmetic   invariant quantity of an iterative process   inverter       inverter   iteration contructs, see looping constructs   iterative improvement   iterative process       as a stream process       design of algorithm       implemented by procedure call , [2], [3], see also  tail recursion       linear , [2]      recursive process vs. , [2], [3], [4]      register machine for   Jayaraman, Sundaresan   Kaldewaij, Anne   Karr, Alphonse   Kepler , Johannes  key  key of a record       in a data base       in a table       testing equality of   Khayyam, Omar   Knuth, Donald E. , [2], [3], [4], [5], [6], [7]  Kohlbecker , Eugene Edmund, Jr .  Kolmogorov , A. N.   Konopasek, Milos   Kowalski, Robert   KRC , [2]   label  (in r"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61280000e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "egister machine)       simulating   label-exp   label-exp-label   Lagrange interpolation formula   \u03bb calculus (lambda calculus)   lambda  (special form)       define  vs.      with dotted-tail notation   lambda  expression       as operator of combination       value of   lambda-body   lambda-parameters   lambda?   Lambert, J.H.   Lam\u00e9, Gabriel   Lam\u00e9's Theorem   Lamport, Leslie   Lampson, Butler   Landin, Peter , [2]  language, see natural language; programming language   Lapalme, Guy  last-exp?   last-operand?   last-pair , [2]      rules   lazy evaluation   lazy evaluator   lazy list   lazy pair   lazy tree   leaf?   least commitment, principle of   lecture, something to do during   left-branch , [2]  Leibniz, Baron Gottfried W ilhelm von       proof of Fermat's Little Theorem       series for \u03c0 , [2]  Leiserson, Charles E. , [2]  length       as accumulation       iterative version       recursive version   let (special form)       evaluation model       internal definition vs.       named       scope of "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61281024v
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "variables       as syntactic sugar , [2]  let*  (special form)   letrec  (special form)   lexical addressing       lexical address   lexical scoping       environment structure and   lexical-address-lookup , [2]  lexical-address-set! , [2] Lieberman, Henry   LIFO buf fer, see stack  line segment       represented as pair of points       represented as pair of vectors   linear growth , [2]  linear iterative process       order of growth   linear recursive process       order of growth   linkage descriptor   Liskov , Barbara Huberman   Lisp       acronym for LISt Processing       applicative-order evaluation in       on DEC PDP-1     efficiency of , [2]      first-class procedures in       Fortran vs.       history of       internal type system       original implementation on IBM 704       Pascal vs.       suitability for writing evaluators       unique features of   Lisp dialects       Common Lisp       Franz Lisp       Interlisp       MacLisp       MDL       Portable Standard Lisp       Scheme       Zetalisp"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61282048
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "   lisp-value  (query interpreter)   lisp-value  (query language) , [2]      evaluation of , [2], [3]  list  (primitive procedure)   list structure      list vs.       mutable       represented using vectors   list(s)       backquote with       cdring down       combining with append       cons ing up       converting a binary tree to a       converting to a binary tree       empty , see empty list       equality of       headed , [2]      last pair of       lazy      length of       list structure vs.       manipulation with car, cdr, and cons       mapping over       nth element of       operations on       printed representation of       quotation of       reversing       techniques for manipulating   list->tree   list-difference   list-of-arg-values   list-of-delayed-args   list-of-values   list-ref , [2]  list-structured memory   list-union   lives-near  (rule) , [2]  local evolution of a process   local name , [2]  local state      maintained in frames   local state variable   local variable   location "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61283072
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "  Locke, John   log (primitive procedure)   logarithm, approximating ln 2  logarithmic growth , [2], [3]  logic programming , see also  query language; query interpreter       computers for       history of , [2]      in Japan       logic programming languages       mathematical logic vs.   logic puzzles   logical and   logical or   logical-not   lookup        in one-dimensional table       in set of records       in two-dimensional table   lookup-label   lookup-prim   lookup-variable-value , [2]      for scanned-out definitions   looping constructs , [2]      implementing in metacircular evaluator   lower-bound   machine language       high-level language vs.   Macintosh   MacLisp   macro , see also  reader macro character   magician, see numerical analyst  magnitude        data-directed       polar representation       rectangular representation       with tagged data   magnitude-polar   magnitude-rectangular   make-account       in environment model       with serialization , [2], [3]  make-account-and-ser"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61284096i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ializer   make-accumulator   make-agenda , [2]  make-assign   make-begin   make-branch   make-center-percent   make-center-width   make-code-tree   make-compiled-procedure   make-complex-from-mag-ang   make-complex-from-real-imag   make-connector   make-cycle   make-decrementer   make-execution-procedure   make-frame , [2], [3]  make-from-mag-ang , [2]      message-passing       polar representation       rectangular representation   make-from-mag-ang-polar   make-from-mag-ang-rectangular   make-from-real-imag , [2]      message-passing       polar representation       rectangular representation  make-from-real-imag-polar   make-from-real-imag-rectangular   make-goto   make-if   make-instruction   make-instruction-sequence   make-interval , [2]  make-joint   make-label   make-label-entry   make-lambda   make-leaf   make-leaf-set   make-machine , [2]  make-monitored   make-mutex   make-new-machine   make-operation-exp   make-perform   make-point   make-poly   make-polynomial   make-primitive-exp   make-procedu"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61285120r
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "re   make-product , [2]  make-queue , [2]  make-rat , [2], [3]      axiom for       reducing to lowest terms   make-rational   make-register   make-restore   make-save   make-scheme-number   make-segment , [2]  make-serializer   make-simplified-withdraw , [2] make-stack       with monitored stack   make-sum , [2]  make-table        message-passing implementation       one-dimensional table   make-tableau   make-term , [2]  make-test   make-time-segment   make-tree   make-vect   make-wire , [2], [3]  make-withdraw       in environment model       using let  making change, see counting change   map, [2]      as accumulation       with multiple ar guments   map-over-symbols   map-successive-pairs   mapping       over lists       nested , [2]      as a transducer       over trees   mark-sweep garbage collector   mathematical function, see function (mathematical)   mathematics       computer science vs. , [2]      engineering vs.   matrix, represented as sequence   matrix-*-matrix   matrix-*-vector   max (primitiv"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61286144e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "e procedure)   McAllester , David Allen , [2] McCarthy , John , [2], [3], [4]  McDermott, Drew   MDL   means of abstraction       define   means of combination , see also  closure   measure in a Euclidean ring   member   memo-fib   memo-proc   memoization , [2]      call-by-need and       by delay       garbage collection and       of thunks   memoize   memory       in 1964       list-structured   memq   merge   merge-weighted   merging infinite streams, see infinite stream(s)   message passing , [2]      environment model and       in bank account       in digital-circuit simulation       tail recursion and   metacircular evaluator   metacircular evaluator for Scheme       analyzing version       combinations (procedure applications)       compilation of , [2]      data abstraction in , [2], [3], [4]      data-directed eval       derived expressions       driver loop      efficiency of       environment model of evaluation in       environment operations       eval  and apply       eval -apply  cycle , [2]  "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61287168
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "    expression representation , [2]      global environment       higher -order procedures in       implemented language vs. implementation language       job of       order of operand evaluation       primitive procedures       representation of environments       representation of procedures       representation of true and false       running       special forms (additional) , [2], [3], [4], [5], [6]      special forms as derived expressions       symbolic dif ferentiation and       syntax of evaluated language , [2], [3]      tail recursiveness unspecified in       true  and false   metalinguistic abstraction   MicroPlanner   Microshaft   midpoint-segment   Miller , Gary L.   Miller , James S.   Miller -Rabin test for primality   Milner , Robin   min (primitive procedure)   Minsky , Marvin Lee , [2]  Miranda   MIT      Artificial Intelligence Laboratory       early history of       Project MAC      Research Laboratory of Electronics , [2]  MIT Scheme       the empty stream       eval       internal defini"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61288192t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "tions       numbers       random       user-initial-environment       without-interrupts   ML  mobile   modeling       as a design strategy       in science and engineering   models of evaluation   modified registers, see instruction sequence   modifies-register?   modularity , [2]      along object boundaries       functional programs vs. objects       hiding principle       streams and       through dispatching on type       through infinite streams       through modeling with objects   modulo n  modus ponens   money , changing, see counting change   monitored procedure   Monte Carlo integration       stream formulation   Monte Carlo simulation       stream formulation   monte-carlo       infinite stream   Moon, David A. , [2]  morning star , see evening star  Morris, J. H.   Morse code   Mouse, Minnie and Mickey   mul (generic)       used for polynomial coef ficients   mul-complex   mul-interval       more ef ficient version   mul-poly   mul-rat   mul-series   mul-streams   mul-terms   Multics time-sharing"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61289216
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " system   multiple-dwelling   multiplicand   multiplication by Russian peasant method   multiplier        primitive constraint       selector   Munro, Ian   mutable data objects , see also  queue; table       implemented with assignment       list structure       pairs       procedural representation of       shared data   mutator   mutex   mutual exclusion   mystery   name, see also  local name; variable; local variable       encapsulated       of a formal parameter       of a procedure  named let (special form)   naming       of computational objects       of procedures   naming conventions       ! for assignment and mutation       ? for predicates   native language of machine   natural language       parsing, see parsing natural language       quotation in   needed registers, see instruction sequence   needs-register?   negate   nested applications of car and cdr  nested combinations   nested definitions, see internal definition   nested mappings, see mapping   new register   new-cars  register   new-cdrs "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61290240
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " register   new-withdraw   newline  (primitive procedure) , [2]  Newton's method       for cube roots       for dif ferentiable functions       half-interval method vs.       for square roots , [2], [3]  newton-transform   newtons-method   next  (linkage descriptor)   next-to  (rules)   nil       dispensing with       as empty list       as end-of-list marker       as ordinary variable in Scheme  no-more-exps?   no-operands?   node of a tree   non-computable   non-strict   nondeterminism, in behavior of concurrent programs , [2]  nondeterministic choice point   nondeterministic computing   nondeterministic evaluator       order of operand evaluation   nondeterministic programming vs. Scheme programming , [2], [3], [4]  nondeterministic programs       logic puzzles       pairs with prime sums       parsing natural language       Pythagorean triples , [2], [3]  normal-order evaluation       applicative order vs. , [2], [3]      delayed evaluation and       in explicit-control evaluator       of if  normal-order"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61291264
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " evaluator , see lazy evaluator  not (primitive procedure)   not (query language) , [2]      evaluation of , [2], [3]  notation in this book       italic symbols in expression syntax       slanted characters for interpreter response   nouns   nth root, as fixed point   null?  (primitive procedure)       implemented with typed pointers   number theory   number(s)       comparison of       decimal point in       equality of , [2], [3]     in generic arithmetic system       implementation dependencies       integer vs. real number       integer , exact       in Lisp       rational number   number?  (primitive procedure)       data types and       implemented with typed pointers   numer , [2]      axiom for       reducing to lowest terms   numerical analysis   numerical analyst   numerical data   obarray   object program   object(s)       benefits of modeling with       with time-varying state   object-oriented programming languages   old register   oldcr  register   ones  (infinite stream)       lazy-list versio"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61292288n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "n   op (in register machine)       simulating   open coding of primitives , [2]  operands   operands of a combination   operation       cross-type       generic       in register machine   operation-and-type table      assignment needed for       implementing   operation-exp   operation-exp-op   operation-exp-operands   operator   operator of a combination       combination as       compound expression as       lambda  expression as   optimality       of Horner's rule       of Huf fman code   or (query language)       evaluation of , [2]  or (special form)       evaluation of       why a special form       with no subexpressions   or-gate       or-gate , [2]  order , [2]  order notation   order of evaluation       assignment and       implementation-dependent       in compiler       in explicit-control evaluator       in metacircular evaluator       in Scheme   order of events       decoupling apparent from actual       indeterminacy in concurrent systems   order of growth       linear iterative process      "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61293312
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " linear recursive process       logarithmic      tree-recursive process   order of subexpression evaluation, see order of evaluation   ordered-list representation of sets   ordinary numbers (in generic arithmetic system)   origin-frame   Ostrowski, A. M.   outranked-by  (rule) , [2]   P operation on semaphore   package       complex-number       polar representation       polynomial       rational-number       rectangular representation       Scheme-number   painter(s)       higher -order operations       operations       represented as procedures       transforming and combining   pair(s)       axiomatic definition of       box-and-pointer notation for       infinite stream of       lazy      mutable       procedural representation of , [2], [3]      represented using vectors       used to represent sequence       used to represent tree   pair?  (primitive procedure)       implemented with typed pointers   pairs   Pan, V . Y.  parallel-execute  parallel-instruction-sequences   parallelism, see concurrency   "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61294336p
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "parameter , see formal parameters   parameter passing, see call-by-name ar gument passing; call-by-need argument passing   parentheses       delimiting combination       delimiting cond  clauses       in procedure definition   parse   parse-...   parsing natural language       real language understanding vs. toy parser   partial-sums   Pascal       lack of higher -order procedures       recursive procedures       restrictions on compound data       weakness in handling compound objects   Pascal, Blaise   Pascal's triangle   password-protected bank account   pattern   pattern matching       implementation       unification vs. , [2]  pattern variable       representation of , [2]  pattern-match   pc register   perform  (in register machine)       simulating   perform-action   Perlis, Alan J. , [2]      quips , [2]  permutations of a set       permutations  Phillips, Hubert   \u03c0 (pi)       approximation with half-interval method       approximation with Monte Carlo integration , [2]      Ces\u00e0ro estimate for , [2"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61295360]
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "]      Leibniz's series for , [2]      stream of approximations       Wallis's formula for   pi-stream   pi-sum       with higher -order procedures       with lambda   picture language   Pingala, \u00c1ch\u00e1rya   pipelining   Pitman, Kent M.   Planner   point, represented as a pair   pointer       in box-and-pointer notation       typed   polar  package   polar?   poly  polynomial  package   polynomial arithmetic       addition       division       Euclid's Algorithm       greatest common divisor , [2]      interfaced to generic arithmetic system       multiplication       probabilistic algorithm for GCD       rational functions       subtraction   polynomial(s)       canonical form      dense       evaluating with Horner's rule       hierarchy of types       indeterminate of       sparse       univariate   pop  Portable Standard Lisp   porting a language   power series, as stream       adding       dividing       integrating       multiplying   PowerPC   predicate       of cond  clause       of if      naming conve"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61296384n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ntion for   prefix code   prefix notation       infix notation vs.   prepositions   preserving , [2], [3], [4]  pretty-printing   prime number(s)       cryptography and       Eratosthenes's sieve for       Fermat test for       infinite stream of, see primes        Miller -Rabin test for       testing for   prime-sum-pair   prime-sum-pairs       infinite stream   prime? , [2]  primes  (infinite stream)      implicit definition   primitive constraints   primitive expression       evaluation of       name of primitive procedure       name of variable       number   primitive procedures (those marked ns are not in the IEEE Scheme standard)       *      +      -, [2]      /      <      =      >      apply       atan       car      cdr      cons       cos      display       eq?      error  (ns)      eval  (ns)      list       log      max      min      newline       not      null?       number?       pair?       quotient       random  (ns), [2]     read       remainder       round       runtime  (ns)      set-car!"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61297408
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "       set-cdr!       sin      symbol?       vector-ref       vector-set!   primitive query , see simple query   primitive-apply   primitive-implementation   primitive-procedure-names   primitive-procedure-objects   primitive-procedure? , [2] principle of least commitment   print  operation in register machine   print-point   print-queue   print-rat   print-result       monitored-stack version   print-stack-statistics  operation in register machine   printing, primitives for   probabilistic algorithm , [2], [3]  probe        in constraint system       in digital-circuit simulator   proc  register   procedural abstraction   procedural representation of data       mutable data   procedure , [2]      anonymous       arbitrary number of ar guments , [2]      as argument      as black box       body of       compound       creating with define       creating with lambda , [2], [3]      as data       definition of       first-class in Lisp       formal parameters of       as general method       generic , [2]      "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61298432h
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "higher -order , see higher -order procedure       implicit begin  in body of       mathematical function vs.       memoized       monitored       name of       naming (with define )      as pattern for local evolution of a process       as returned value       returning multiple values       scope of formal parameters       special form vs. , [2]  procedure application       combination denoting       environment model of       substitution model of, see substitution model of procedure application   procedure-body   procedure-environment   procedure-parameters   process       iterative       linear iterative       linear recursive       local evolution of       order of growth of       recursive      resources required by       shape of       tree-recursive   product       as accumulation   product?   program       as abstract machine       comments in       as data       incremental development of     structure of , [2], [3], see also  abstraction barriers       structured with subroutines   program counter "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61299456
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "  programming       data-directed, see data-directed programming       demand-driven       elements of       functional, see functional programming       imperative       odious style   programming language       design of       functional       logic       object-oriented       strongly typed       very high-level   Prolog , [2]  prompt-for-input   prompts       explicit-control evaluator       lazy evaluator       metacircular evaluator       nondeterministic evaluator       query interpreter   propagate  propagation of constraints   proving programs correct   pseudo-random sequence   pseudodivision of polynomials   pseudoremainder of polynomials   push   put, [2]  puzzles       eight-queens puzzle , [2]      logic puzzles   Pythagorean triples       with nondeterministic programs , [2], [3]      with streams   qeval , [2]  quantum mechanics   quasiquote   queens   query , see also  simple query; compound query   query interpreter       adding rule or assertion       compound query , see compound query     "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61300480
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "  data base       driver loop , [2]      environment structure in       frame , [2]      improvements to , [2], [3]      infinite loops , [2]      instantiation       Lisp interpreter vs. , [2], [3]      overview       pattern matching , [2]      pattern-variable representation , [2]      problems with not and lisp-value , [2]      query evaluator , [2]      rule, see rule      simple query , see simple query       stream operations       streams of frames , [2]      syntax of query language       unification , [2]  query language , [2]      abstraction in       compound query , see compound query       data base       equality testing in       extensions to , [2]      logical deductions       mathematical logic vs.       rule, see rule       simple query , see simple query   query-driver-loop   question mark, in predicate names   queue       double-ended       front of       operations on       procedural implementation of       rear of       in simulation agenda   quotation       of character strings       "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61301504o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "of Lisp data objects       in natural language   quotation mark, single vs. double   quote  (special form)       read  and, [2]  quoted?   quotient  (primitive procedure)   Rabin, Michael O.   radicand  Ramanujan numbers   Ramanujan, Srinivasa   rand       with reset   random  (primitive procedure)       assignment needed for       MIT Scheme   random-in-range   random-number generator , [2]      in Monte Carlo simulation       in primality testing       with reset       with reset, stream version   random-numbers  (infinite stream)   Raphael, Bertram   rational  package   rational function       reducing to lowest terms   rational number(s)       arithmetic operations on       in MIT Scheme       printing       reducing to lowest terms , [2]      represented as pairs   rational-number arithmetic       interfaced to generic arithmetic system       need for compound data   Raymond, Eric , [2]  RC circuit   read  (primitive procedure)       dotted-tail notation handling by       macro characters   read  operati"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61302528o
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "on in register machine   read-eval-print loop , see also  driver loop   read-eval-print-loop   reader macro character   real number  real-part        data-directed       polar representation       rectangular representation       with tagged data   real-part-polar   real-part-rectangular   rear-ptr   receive  procedure   record, in a data base rectangle, representing   rectangular  package   rectangular?   recursion       data-directed       expressing complicated process       in rules       in working with trees   recursion equations   recursion theory   recursive procedure       recursive procedure definition       recursive process vs.       specifying without define   recursive process       iterative process vs. , [2], [3], [4]      linear , [2]      recursive procedure vs.       register machine for       tree, [2]  red-black tree   reducing to lowest terms , [2], [3]  Rees, Jonathan A. , [2]  referential transparency   reg (in register machine)       simulating   register machine      actions       co"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61303552n
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ntroller       controller diagram       data paths       data-path diagram       design of       language for describing       monitoring performance       simulator       stack       subroutine       test operation   register table, in simulator   register(s)       representing       tracing   register-exp   register-exp-reg   register -machine language       assign , [2]      branch , [2]      const , [2], [3]      entry point       goto , [2]      instructions , [2]      label       label , [2]      op, [2]      perform , [2]      reg, [2]      restore , [2]      save , [2]      test , [2]  register -machine simulator   registers-modified   registers-needed   relations, computing in terms of , [2] relatively prime   relativity , theory of   release a mutex   remainder  (primitive procedure)   remainder modulo n  remainder-terms   remove   remove-first-agenda-item! , [2] require       as a special form   reserved words , [2]  resistance       formula for parallel resistors , [2]      tolerance of resistors "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61304576
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "  resolution principle   resolution, Horn-clause   rest-exps   rest-operands   rest-segments   rest-terms , [2]  restore  (in register machine) , [2]      implementing       simulating   return  (linkage descriptor)   returning multiple values   Reuter , Andreas   reverse       as folding       rules   Rhind Papyrus   right-branch , [2]  right-split   ripple-carry adder   Rivest, Ronald L. , [2]  RLC circuit   Robinson, J. A.   robustness  rock songs, 1950s   Rogers, W illiam Barton   root  register   roots of equation, see half-interval method; Newton's method   rotate90   round  (primitive procedure)   roundof f error , [2]  Rozas, Guillermo Juan   RSA algorithm   rule (query language)       applying , [2], [3]      without body , [2], [3]  Runkle, John Daniel   runtime  (primitive procedure)   Russian peasant method of multiplication   same  (rule)   same-variable? , [2]  sameness and change       meaning of       shared data and   satisfy a compound query   satisfy a pattern (simple query)   save  (in reg"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61305600i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ister machine) , [2]      implementing       simulating   scale-list , [2], [3]  scale-stream   scale-tree , [2]  scale-vect   scan  register   scan-out-defines   scanning out internal definitions       in compiler , [2]  Scheme       history of  Scheme chip , [2]  scheme-number  package   scheme-number->complex   scheme-number->scheme-number   Schmidt, Eric   scope of a variable , see also  lexical scoping       internal define       in let     procedure's formal parameters   search       of binary tree       depth-first       systematic   search   secretary , importance of   segment-queue   segment-time   segments   segments->painter   selector       as abstraction barrier       generic , [2]  self-evaluating expression   self-evaluating?   semaphore       of size n  semicolon       comment introduced by   separator code   sequence accelerator   sequence of expressions       in consequent of cond       in procedure body   sequence(s)       as conventional interface       as source of modularity       operat"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61306624i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ions on      represented by pairs   sequence->exp   serialized-exchange       with deadlock avoidance   serializer       implementing       with multiple shared resources   series, summation of       accelerating sequence of approximations       with streams   set      set            (special form), see also  assignment       data base as       operations on       permutations of       represented as binary tree       represented as ordered list     represented as unordered list     subsets of   set!  (special form)       environment model of       value of   set-car!  (primitive procedure)       implemented with vectors       procedural implementation of       value of   set-cdr!  (primitive procedure)       implemented with vectors       procedural implementation of       value of   set-contents!   set-current-time!   set-front-ptr!   set-instruction-execution-proc!   set-rear-ptr!   set-register-contents! , [2] set-segments!   set-signal! , [2]  set-value! , [2]  set-variable-value! , [2]  setup-environmen"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61307648t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "t   shadow a binding   Shamir , Adi   shape of a process   shared data   shared resources   shared state   shrink-to-upper-right   Shrobe, Howard E.   side-ef fect bug   sieve of Eratosthenes       sieve   sum (sigma) notation   signal processing       smoothing a function       smoothing a signal , [2]      stream model of       zero crossings of a signal , [2], [3]  signal, digital   signal-error   signal-flow diagram , [2]  signal-processing view of computation   simple query       processing , [2], [3], [4]  simple-query   simplification of algebraic expressions Simpson's Rule for numerical integration   simulation       of digital circuit, see digital-circuit simulation       event-driven       as machine-design tool       for monitoring performance of register machine       Monte Carlo, see Monte Carlo simulation      of register machine, see register -machine simulator   sin (primitive procedure)   sine       approximation for small angle       power series for   singleton-stream   SKETCHP AD  smallest"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61308672-
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "-divisor       more ef ficient version   Smalltalk   smoothing a function   smoothing a signal , [2]  snarf   Solar System's chaotic dynamics   Solomonof f, Ray   solve  differential equation , [2]      lazy-list version       with scanned-out definitions   solving equation, see half-interval method; Newton's method; solve    source language   source program   Spafford, Eugene H.   sparse polynomial   special form       as derived expression in evaluator       need for       procedure vs. , [2]  special forms (those marked ns are not in the IEEE Scheme standard)       and      begin       cond       cons-stream  (ns)      define , [2]      delay  (ns)      if      lambda       let     let*       letrec       named let      or      quote       set!   split   sqrt       block structured       in environment model       as fixed point , [2], [3], [4]      as iterative improvement       with Newton's method , [2]      register machine for       as stream limit   sqrt-stream   square       in environment model   s"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61309696q
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "quare root , see also  sqrt        stream of approximations   square-limit , [2]  square-of-four   squarer  (constraint) , [2]  squash-inwards   stack       framed       for recursion in register machine       representing , [2]  stack allocation and tail recursion   stack-inst-reg-name   Stallman, Richard M. , [2]  start  register machine , [2]  start-eceval   start-segment , [2]  state       local, see local state       shared      vanishes in stream formulation   state variable , [2]      local   statements, see instruction sequence   statements   Steele, Guy Lewis Jr ., [2], [3], [4], [5], [6]  stop-and-copy garbage collector   Stoy, Joseph E. , [2], [3]  Strachey , Christopher   stratified design   stream(s) , [2]      delayed evaluation and       empty       implemented as delayed lists       implemented as lazy lists       implicit definition       infinite, see infinite streams       used in query interpreter , [2] stream-append   stream-append-delayed   stream-car , [2]  stream-cdr , [2]  stream-enum"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61310720e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "erate-interval   stream-filter   stream-flatmap , [2]  stream-for-each   stream-limit   stream-map       with multiple ar guments   stream-null?       in MIT Scheme   stream-ref   stream-withdraw   strict   string, see character string   strongly typed language   sub (generic)  sub-complex   sub-interval   sub-rat   sub-vect   subroutine in register machine   subsets  of a set   substitution model of procedure application , [2]      inadequacy of       shape of process   subtype       multiple   success continuation (nondeterministic evaluator) , [2]  successive squaring   sum      as accumulation       iterative version   sum-cubes       with higher -order procedures   sum-integers       with higher -order procedures   sum-odd-squares , [2]  sum-of-squares       in environment model   sum-primes , [2]  sum?   summation of a series       with streams   supertype       multiple   Sussman, Gerald Jay , [2], [3], [4], [5], [6], [7]  Sussman, Julie Esther Mazel, nieces of   Sutherland, Ivan   symbol(s)       equa"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61311744l
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "lity of       interning       quotation of       representation of      uniqueness of   symbol-leaf   symbol?  (primitive procedure)       data types and       implemented with typed pointers   symbolic algebra   symbolic dif ferentiation , [2]  symbolic expression , see also  symbol(s)   symbols   SYNC synchronization, see concurrency   syntactic analysis, separated from execution       in metacircular evaluator       in register -machine simulator , [2]  syntactic sugar       define       let as      looping constructs as       procedure vs. data as   syntax, see also  special forms       abstract, see abstract syntax       of expressions, describing       of a programming language   syntax interface   systematic search   #t  table       backbone of       for coercion       for data-directed programming       local       n-dimensional       one-dimensional       operation-and-type, see operation-and-type table       represented as binary tree vs. unordered list      testing equality of keys       two-dimens"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61312768i
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ional       used in simulation agenda       used to store computed values   tableau   tabulation , [2]  tack-on-instruction-sequence   tagged architecture   tagged data , [2]  tagged-list?   tail recursion       compiler and       environment model of evaluation and       explicit-control evaluator and , [2], [3]      garbage collection and       metacircular evaluator and       in Scheme   tail-recursive evaluator   tangent       as continued fraction       power series for   target register   Technological University of Eindhoven   Teitelman, W arren   term list of polynomial       representing   term-list   terminal node of a tree   test  (in register machine)       simulating   test operation in register machine   test-and-set! , [2]  test-condition   text-of-quotation   Thatcher , James W .  THE Multiprogramming System   the-cars       register , [2]      vector   the-cdrs        register , [2]      vector   the-empty-stream       in MIT Scheme   the-empty-termlist , [2]  the-global-environment , [2]  th"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61313792e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "eorem proving (automatic)   \u03b8 (f(n)) (theta of f(n))  thunk       call-by-name       call-by-need       forcing       implementation of       origin of name   time       assignment and       communication and       in concurrent systems       functional programming and       in nondeterministic computing , [2]      purpose of   time segment, in agenda   time slicing   timed-prime-test   timing diagram   TK!Solver   tower of types   tracing       instruction execution       register assignment   transform-painter   transparency , referential   transpose  a matrix   tree      B-tree       binary , see also  binary tree       combination viewed as       counting leaves of       enumerating leaves of       fringe of       Huffman       lazy      mapping over       red-black       represented as pairs       reversing at all levels   tree accumulation   tree->list...   tree-map   tree-recursive process       order of growth   trigonometric relations   true  true   true?   truncation error   truth maintenance   try-"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61314816a
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "again   Turing machine   Turing, Alan M. , [2]  Turner , David , [2], [3]  type field   type tag , [2]      two-level   type(s)       cross-type operations       dispatching on       hierarchy in symbolic algebra       hierarchy of       lowering , [2]      multiple subtype and supertype      raising , [2]      subtype       supertype       tower of   type-inferencing mechanism   type-tag       using Scheme data types   typed pointer   typing input expressions   unbound variable   unev  register   unification       discovery of algorithm       implementation       pattern matching vs. , [2]  unify-match   union-set       binary-tree representation       ordered-list representation       unordered-list representation   unique  (query language)   unique-pairs   unit square   univariate polynomial   universal machine       explicit-control evaluator as     general-purpose computer as   University of California at Berkeley   University of Edinbur gh  University of Marseille   UNIX , [2]  unknown-expression-type  "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61315840
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": " unknown-procedure-type   unordered-list representation of sets   unspecified values      define       display       if without alternative       newline       set!       set-car!       set-cdr!   up-split   update-insts!   upper-bound   upward compatibility   user-initial-environment  (MIT Scheme)   user-print       modified for compiled code   V operation on semaphore   val register   value       of a combination       of an expression , see also  unspecified values   value-proc   variable , see also  local variable       bound       free      scope of , see also  scope of a variable       unbound       value of , [2]  variable   variable-length code   variable? , [2]  vector (data structure)   vector (mathematical)       operations on , [2]      in picture-language frame       represented as pair       represented as sequence  vector-ref  (primitive procedure)   vector-set!  (primitive procedure)   Venus  verbs   very high-level language   Wadler , Philip   Wadsworth, Christopher   Wagner , Eric G.   Walke"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61316864r
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "r , Francis Amasa   Wallis, John   Wand, Mitchell , [2]  Waters, Richard C.   weight   weight-leaf   Weyl, Hermann   \u201cwhat is\u201d vs. \u201chow to\u201d description, see declarative vs. imperative knowledge   wheel  (rule) , [2]  width   width of an interval   Wilde, Oscar (Perlis's paraphrase of)   Wiles, Andrew   Winograd, T erry  Winston, Patrick Henry , [2]  wire, in digital circuit   Wisdom, Jack   Wise, David S.   wishful thinking , [2]  withdraw       problems in concurrent system   without-interrupts   world line of a particle , [2]  Wright, E. M.   Wright, Jesse B.  xcor-vect   Xerox Palo Alto Research Center , [2]   Y operator   ycor-vect   Yochelson, Jerome C.   Zabih, Ramin   zero crossings of a signal , [2], [3]  zero test (generic)     for polynomials   Zetalisp   Zilles, Stephen N.   Zippel, Richard E.  Contents     Foreword       Preface to the Second Edition       Preface to the First Edition       Acknowledgments       1  Building Abstractions with Pr ocedur es          1.1  The Elements of Programming  "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61317888
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "             1.1.1  Expressions               1.1.2  Naming and the Environment               1.1.3  Evaluating Combinations               1.1.4  Compound Procedures               1.1.5  The Substitution Model for Procedure Application               1.1.6  Conditional Expressions and Predicates               1.1.7  Example: Square Roots by Newton's Method               1.1.8  Procedures as Black-Box Abstractions           1.2  Procedures and the Processes They Generate               1.2.1  Linear Recursion and Iteration               1.2.2  Tree Recursion               1.2.3  Orders of Growth               1.2.4  Exponentiation               1.2.5  Greatest Common Divisors               1.2.6  Example: T esting for Primality           1.3  Formulating Abstractions with Higher -Order Procedures               1.3.1  Procedures as Ar guments               1.3.2  Constructing Procedures Using Lambda               1.3.3  Procedures as General Methods               1.3.4  Procedures as Returned V alues      2  Buil"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61318912d
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "ding Abstractions with Data           2.1  Introduction to Data Abstraction               2.1.1  Example: Arithmetic Operations for Rational Numbers               2.1.2  Abstraction Barriers               2.1.3  What Is Meant by Data?               2.1.4  Extended Exercise: Interval Arithmetic           2.2  Hierarchical Data and the Closure Property               2.2.1  Representing Sequences               2.2.2  Hierarchical Structures               2.2.3  Sequences as Conventional Interfaces               2.2.4  Example: A Picture Language           2.3  Symbolic Data               2.3.1  Quotation               2.3.2  Example: Symbolic Dif ferentiation               2.3.3  Example: Representing Sets               2.3.4  Example: Huf fman Encoding T rees          2.4  Multiple Representations for Abstract Data               2.4.1  Representations for Complex Numbers               2.4.2  Tagged data               2.4.3  Data-Directed Programming and Additivity         2.5  Systems with Generic Operations   "}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61319936
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "            2.5.1  Generic Arithmetic Operations               2.5.2  Combining Data of Dif ferent T ypes              2.5.3  Example: Symbolic Algebra       3  Modularity , Objects, and State           3.1  Assignment and Local State               3.1.1  Local State V ariables               3.1.2  The Benefits of Introducing Assignment               3.1.3  The Costs of Introducing Assignment           3.2  The Environment Model of Evaluation               3.2.1  The Rules for Evaluation               3.2.2  Applying Simple Procedures               3.2.3  Frames as the Repository of Local State               3.2.4  Internal Definitions           3.3  Modeling with Mutable Data               3.3.1  Mutable List Structure              3.3.2  Representing Queues               3.3.3  Representing T ables               3.3.4  A Simulator for Digital Circuits               3.3.5  Propagation of Constraints           3.4  Concurrency: T ime Is of the Essence               3.4.1  The Nature of T ime in Concurrent Sys"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61320960t
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "tems               3.4.2  Mechanisms for Controlling Concurrency           3.5  Streams               3.5.1  Streams Are Delayed Lists               3.5.2  Infinite Streams               3.5.3  Exploiting the Stream Paradigm               3.5.4  Streams and Delayed Evaluation               3.5.5  Modularity of Functional Programs and Modularity of Objects       4  Metalinguistic Abstraction           4.1  The Metacircular Evaluator               4.1.1  The Core of the Evaluator               4.1.2  Representing Expressions               4.1.3  Evaluator Data Structures               4.1.4  Running the Evaluator as a Program               4.1.5  Data as Programs               4.1.6  Internal Definitions               4.1.7  Separating Syntactic Analysis from Execution           4.2  Variations on a Scheme \u2013 Lazy Evaluation               4.2.1  Normal Order and Applicative Order               4.2.2  An Interpreter with Lazy Evaluation               4.2.3  Streams as Lazy Lists           4.3  Variations on a Sch"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61321984e
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "eme \u2013 Nondeterministic Computing               4.3.1  Amb and Search               4.3.2  Examples of Nondeterministic Programs               4.3.3  Implementing the Amb Evaluator           4.4  Logic Programming               4.4.1  Deductive Information Retrieval               4.4.2  How the Query System W orks              4.4.3  Is Logic Programming Mathematical Logic?               4.4.4  Implementing the Query System      5  Computing with Register Machines           5.1  Designing Register Machines               5.1.1  A Language for Describing Register Machines               5.1.2  Abstraction in Machine Design               5.1.3  Subroutines               5.1.4  Using a Stack to Implement Recursion               5.1.5  Instruction Summary           5.2  A Register -Machine Simulator               5.2.1  The Machine Model               5.2.2  The Assembler               5.2.3  Generating Execution Procedures for Instructions               5.2.4  Monitoring Machine Performance           5.3  Storage A"}


created_at: 2024-03-15 06:19:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: batch61323008l
encoding: FLOAT32
metadata:
{"length": 1024, "chroma:document": "llocation and Garbage Collection               5.3.1  Memory as V ectors               5.3.2  Maintaining the Illusion of Infinite Memory           5.4  The Explicit-Control Evaluator               5.4.1  The Core of the Explicit-Control Evaluator               5.4.2  Sequence Evaluation and T ail Recursion               5.4.3  Conditionals, Assignments, and Definitions               5.4.4  Running the Evaluator           5.5  Compilation               5.5.1  Structure of the Compiler               5.5.2  Compiling Expressions               5.5.3  Compiling Combinations               5.5.4  Combining Instruction Sequences               5.5.5  An Example of Compiled Code               5.5.6  Lexical Addressing               5.5.7  Interfacing Compiled Code to the Evaluator       Refer ences       List of Exer cises       Index  ........................................................................................................................................................................................."}


created_at: 2024-04-29 17:30:22
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The transc
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The transcription of the contents in the image is as follows:\n\n---\n\nCSC 335 Sections M and R  \nClasses 3 and 4  \nFebruary 1 and February 6 2024\n\n; functions are values, too Scheme has first-class functions  \n(lambda (x) (* x x)) lambda causes Scheme to create a  \n   \u2191        \u2191\nspecial closure You might enjoy  \nform searching  \nreserved the language  \nword Closure  \n\nThat is, a function along with certain environmental information  \nFor example, in response to  \n(define sq lambda (x) (* x x))  \n\nThe system augments its starting environment as follows \u2192  \n    \u2193         \u2192\nglobal namespace G  \n\n---"}


created_at: 2024-04-29 17:30:30
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The image
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The image contains notes discussing concepts related to programming in the Scheme programming language. Here\u2019s the transcription:\n\n```\nstarting environment\nfor Scheme \u2013 everything\npredefined in\nScheme is\ninstalled here\n\nsg --> ?\n\nStep 1: install sg in G\n(but we don\u2019t have a value \nfor sg yet, hence the\nquestion mark)\n\nStep 2: evaluate the lambda\n\nsg --> ?\n\nclosure\ncreated by\n(lambda(x)(+ x x))\n\nenvironment part\nof closure\n\ncode part\nof closure\n\nparams (x)\nbody (+ x x)\n```"}


created_at: 2024-04-29 17:30:42
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The conten
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The contents of the image include handwritten text and diagrams related to programming and functions. Here is the transcription:\n\n---\nStep 3: bind sq to the closure\n\nThe closure is a scheme object (much as the number 1 is a scheme object).\n\nWith this in place, what happens when we ask the system to evaluate `(sq 4)`?\n\nNot `sq(4)`.\n\n```\nsq      .                  .\nparam -> (x)\nbody  -> (x * x)\n```\n\nScheme has dynamic typing.\n\nFunction name `(sq 4) `<- argument - i.e., this is the actual parameter for the def.-given, scheme absolutely insists on exactly ONE argument.\n---\n\nNote: The image also contains various arrows and a box diagram linking the aspects of the function to illustrate the closure binding process."}


created_at: 2024-04-29 17:31:01
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The conten
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The contents of the image include handwritten notes and diagrams regarding programming or a related concept about how environments and frames work, particularly in the context of function calls and variable binding. Here\u2019s the transcription:\n\n- **Top left:** G [on environment]\n  - An environment is a sequence of frames\n\n- **Top right:**\n  - When `csq 4` is requested the system opens a new frame \u20dd\n  - or parent frame\n\n- **Middle of the image:**\n  - Diagrams and visuals of frames\n  - `sg4`\n  - `x: 4`\n  - `(*x*x)`\n\n- **Annotations around the diagram:**\n  - 1. [arrow pointing to G] System sees that the frame associated with sg is G, so it makes G the containing frame of this new frame\n  - 2. In the new frame, the formal parameter x is bound to the actual parameter (in this case 4) We say \"x has value 4 in this frame\"\n  - 3. Next, scheme evaluates the body `(x * x * x)` in the new-body [line is incomplete here]\n\nThese notes discuss how a new frame is created and linked back to the global environment (referenced as \"G\"), the binding of variables, and the evaluation process of expressions within this new frame."}


created_at: 2024-04-29 17:31:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The conten
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The contents of the image are as follows:\n\n- At the top, there is the word \"frame\" written.\n- There is a box labeled \"x: A\" and arrows pointing to it indicating a structure or scheme related to frames.\n- A hand-drawn note that says \"This new frame is memory allocated from the heap\" beside the diagram.\n- There is an arrow from a point (x, y) in what looks like a coordinate system connecting to another point (y, x).\n- Handwritten text below:\n  - \"what does it mean to evaluate (x x x) in the new frame?\"\n  - \"(i.e., in the env. formed by the new frame and its parent.)\"\n  - \"We know from the scheme evaluation rule that the system needs to eval. x and x . To\"\n  - \"evaluate x you can think of the\"\n\nThis appears to be handwritten notes possibly related to computer science or programming, discussing memory allocation and evaluating expressions in a certain 'frame' or context within a programming environment."}


created_at: 2024-04-29 17:31:27
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The transc
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The transcription of the handwritten text in the image reads:\n\n\"system starting to look in the 'current frame'. But x is not defined in that frame (only a is), so the system goes to the parent frame and looks there for the definition of x.\n\nSince in this case the parent frame is G, the scheme of x is found. So x is evaluated to the system mvt.\n\nop.\n\nWhat about x? Again, the system starts in the closest\""}


created_at: 2024-04-29 17:31:38
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The transc
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The transcribed text from the image is as follows:\n\n---\nframe in which x has been\nbound to A.\n\nSo now (x + A) can be\ncomputed, and to return,\n\n5) still not done ... we need\nto free up the memory allocated\nto the new frame. This is\ndone by the garbage collector\n(invented in the 1960s\nfor LISP)\nThe idea is that storage which is no\nlonger needed (i.e, no longer \"alive\")\n---"}


created_at: 2024-04-29 17:31:47
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The transc
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The transcribed content of the image is as follows:\n\n```\nis returned to the heap.\n\nHow do we tell whether storage is \nstill alive? Storage is live, if \nit is pointed at (even indirectly)\nfrom the initial environment.\n\ng ->\n\nsq \n\n              Not alive,\n              because no\n              pointer\n              from g\n\n              Alive\n              because\n              pointed at by sq\n``` \n\nThe image also includes handwritten diagrams with pointers indicating relationships between variables, supporting the discussion on determining whether storage locations are still alive."}


created_at: 2024-04-29 17:31:55
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The image
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The image contains handwritten text and a small diagram. Here is the transcription of the text:\n\n\"When the entire evaluation is done, the situation is ________ ________\n\nNo concerns about memory leakage, as GC takes care of the problem.\n\n( )       }-----{ \n( )*              \n\nThis evaluation mode is described in Ch. 3 of AbS \u2013 EXCEPT they have introduced assignment by ______ every call it the environment model of evaluation.\"\n\n(Note: Some words are not clearly visible or are missing, noted with '________')"}


created_at: 2024-04-29 17:32:04
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The transc
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The transcribed content of the image is as follows:\n\n```\nWe can use this model to explain\nWhy (sq 5-) does not change\nx if x has previously been\ndefined.\n\nSuppose (define x 7)\n    (sq 5)\nand subseq. ask for x - you\nwill see that it is still 7. Why?\n```"}


created_at: 2024-04-29 17:32:36
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The conten
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The contents of the image are as follows:\n\n- At the top, the text reads: \"Here's the situation after x and sq have been defined\"\n- There's a drawing of a box labeled \"G\" containing \"x: 17.\"\n- There's an arrow from the box labeled \"G\" with a label that reads, \"This binding is shadowed by the new binding.\"\n- There's another diagram including a smaller box inside a larger one, with the smaller box containing \"(x x x)\" and the larger box containing \"sq\" and \"G.\"\n- A line is drawn from the smaller box to the larger box.\n- There's a rectangular box near the middle of the image containing \"x: 5.\"\n- A green text arrow points to the \"x: 17\" saying, \"This binding is shadowed by the new binding.\"\n- The bottom text reads:\n  - \"The system takes the first value of x that it finds as it works up the linked list of frames.\"\n  - \"After sq 5\"\n  - \"Again, x is found in G and x is found in the new frame.\""}


created_at: 2024-04-29 17:32:45
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The conten
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The contents of the image are as follows:\n\n\"After computing 25 the new frame is garbaged \u2014 and we\u2019re left with\n\nx : 17\n\nand of course when now we ask for the value of x, we get 17.\n\n(The 5 is gone for good)\" \n\nAlso, the image includes a drawing with the numerals \"59\" and \"69\" linked with arrows and encircled, along with the equation \"(x)\"."}


created_at: 2024-04-29 17:32:57
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The transc
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The transcription of the image contents is as follows:\n\n---\n\nAbelson-Sussman format, which is under the hood\" \u2014 The same as the lambda form\n\n; some names are local, while others are global\n\n(define x 3)\n\n(define (add-x y)\n(+ x y))\nx is free in the body of add-x\n\nWhat happens when we have these definitions, and then execute for `(add-x 6)`?\n\nThe env pointer of the closure always goes to the frame in which the definition was created\n\nadd-x\n- (x: 3)\n- (+ x y)\n\ny: 6\n\n\u2192 9\n- t: is system\n\n---\n\nThe image also contains various arrows and illustrations showing the flow of execution and the environment frames for the expression evaluation in a programming context."}


created_at: 2024-04-29 17:44:03
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcribed text from a handwritten note about programming concepts
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "CSc 335 Sections M and R\nClasses 3 and 4\nFebruary 1 and February 6 2024\n\n; functions are values, too\nScheme has first-class functions\n(lambda (x) (* x x))\nlambda causes Scheme to create a closure\nspecial form\nreserved word\nYou might enjoy searching the language closure\n\nthat is, a function, along with certain environmental information\n\nFor example, in response to\ndefine sq\nlambda (x) (* x x)\n\nThe system augments its starting environment as follows ->\nglobal namespace -> G"}


created_at: 2024-04-29 17:44:16
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming concepts
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "starting environment - everything pre-defined in scheme is installed here\n\n- - - - - - - - - - - - - - - -\n\nsq ----> ?\n\nt ---------->\n\nStep 1: install sq in G\n(but we don't have a value for sq yet, hence the question mark)\n\nStep 2: evaluate the lambda\nclosure created by (lambda (x) (* x x))\n\nenvironment part of closure\n\n-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\nsq ----> ?\n\n-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n\nparams (x)\nbody (* x x)\n\n-- -- -- -- -- -- -- -- -- -- -- -- --\ncode part of closure"}


created_at: 2024-04-29 17:44:25
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming concepts and an illustrated diagram
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Step 3: bind sq to the closure\n\nThe closure is a Scheme object (much as the number 1 is a Scheme object).\n\nsq\n\nparam -> (x)\nbody -> (* x x)\n\nWith this in place, what happens when we ask the system to evaluate (sq 4)? Not sq(4)!\n\nfunction\nname\n\nScheme has dynamic typing\n\nfor the def. given, Scheme absolutely insists on exactly ONE argument."}


created_at: 2024-04-29 17:44:42
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
The image contains handwritten notes likely describing a programming environment and function frame behavior.

metadata:
{"source": "pdf", "chroma:document": "G\nan\nenvironment\nis a\nsequence\nof\nframes\nglobal frame\nWhen\n(f sq 4) is requested\nThe system opens a new\nframe\nx: 4\nor parent\nframe\nsystem sees that the frame\nassociated with sq is G ,\nso it makes G the containing\nframe of this new frame\n3. In the new frame, the formal\nparameter x is bound to the\nactual parameter (in this case, 4)\nWe say 'x has value 4 in this frame'\n4. Next, scheme evaluates the\nbody (x x x) in the new"}


created_at: 2024-04-29 17:44:50
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
The image contains handwritten notes and a diagram related to programming or computing concepts, focusing on 'frames' and memory allocation.

metadata:
{"source": "pdf", "chroma:document": "frame\n\nThis new frame is memory allocated from the heap\n\nx; A\n\n(* x x x)\n\nWhat does it mean to evaluate (* x x x) in the new frame?\n(i.e., in the env. formed by the new frame and S9 as its parent.\n\nWe know from the scheme evaluation rule that the system needs to eval. x and x . . . to evaluate x you can think of the"}


created_at: 2024-04-29 17:45:00
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes explaining the search process for a variable in nested scopes.
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "system starting to look in the closest frame. But x is not defined in that frame (only x is), so the system goes to the parent frame and looks there for the definition of x.\n\nSince in this case the parent frame is G, the scope of x is found. So x is evaluated to the system mft.\n\nWhat about x? Again, the system starts in the closest"}


created_at: 2024-04-29 17:45:08
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming concepts
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "frame in which x has been bound to A.\n\nSo now (* A A) can be computed, and to be returned to free up the memory allocated to the new frame. This is done by the garbage collector (invented in the 1960s for Lisp) the idea is that storage which is no longer needed (i.e., no longer 'alive')"}


created_at: 2024-04-29 17:45:16
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten text and diagrams illustrating concepts in computer programming.
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "is returned to the heap.\n\nHow do we tell whether a storage is still alive? Storage is live if it is pointed at (even indirectly) from the initial environment.\n\nNot alive, because no pointer from g\nAlive because pointed at by sq"}


created_at: 2024-04-29 17:45:25
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes and diagram about evaluation model and memory management.
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "When the entire evaluation is done, the situation is\n\nNo concerns about memory leakage, as GC takes care of the problem.\n\nThis evaluation model is described in Ch. 3 of A&S \u2014 EXCEPT they have introduced assignment by them, they call it the environment model of evaluation."}


created_at: 2024-04-29 17:45:34
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten text explaining a concept in programming or mathematics
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "We can use this model to explain\nWhy (sq 5) does not change\nx if x has previously been\ndefined.\nSuppose (define x 7)\n(sq 5)\nand subseq. ask for x - you\nwill see that it is still 7. Why?"}


created_at: 2024-04-29 17:45:56
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes explaining the scoping and binding of variables in a programming concept.
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Here's the situation after x and sq have been defined. x : 17. This binding is shadowed by the local binding. After sq, x : 5. Again, x is found in G and x is found in the new frame. The system takes the first value of x that it finds as it works up the linked list of frames."}


created_at: 2024-04-29 17:46:04
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes possibly related to a mathematical or programming concept
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "After computing 25, the new frame is garbage - and we're left with \n x : 17 \n  \n and of course when now we ask for the value of x, we get 17. \n (the 5 is gone for good)"}


created_at: 2024-04-29 17:46:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
The image contains handwritten text and diagrams related to programming concepts, specifically about variable scope and function definition.

metadata:
{"source": "pdf", "chroma:document": "; some names are local, while others are global\n(define x 3)\n(define (add-x y) (+ x y))\nx is free in the body of add-x\nAbelson-Sussman format, which is under the hood \u2014 the same as the lambda form\nWhat happens when we have these definitions, and then one for (add-x 6) ?\n\n(add-x y)\n\n(closure always goes\nto the frame in\nwhich the definition\nclosure\nwas created)\n\nx: 3\n\n(add-x)\n\ny: 6\n(+ x y)\n\n(+ x y)\n\n(+ x y)\n\n(? system\n+ 3\n+ 6\n~ 6)"}


created_at: 2024-04-29 17:46:28
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Student's question and code definition analysis with example application
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Student Question: What if add-x were defined\n(define (add-x x y)\n  (+ x y))\nConsider\n(add-x 4 5)\n\nx: 3\nadd-x\nx: 4\ny: 5\n(+ x y)\n 9\n 4 5\n\nNote that you may not call this new version with just a single argument."}


created_at: 2024-04-29 17:46:41
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing programming concepts, with code snippets, comments, and diagrams.
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "What about\n(define x 3)\n(add-x x 4)\n?\nIn this case, the system would eval x to 3\n\nx: 3\nadd-x\n\nx: 3\ny: 4\n\n(x y)\n(+ x y)\n\nlook up will be needed to get that value\n\nParameter, because\nScheme will regard that as a type error"}


created_at: 2024-04-29 17:46:54
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on parameter passing in programming and a student question
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "At this point, Scheme's default parameter passing mechanism is call-by-value\n\nA local copy of the param. value is created\n\nStudent Question\nWhat about\n(define (sq x)\n    (lambda (x) ((x x x) x x)))\n\nConsider (sq 4)\n\n(define sq\n    (lambda (x)\n        ( (lambda (x) ((x x x) x)) x)))"}


created_at: 2024-04-29 17:47:02
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: This is a complex diagram containing mathematical functions and notation.
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "G -> sq -> C(. X) -> ((Lambda (x) (x x x)) x) -> (x x x) / (x; 4) -> ((Lambda (x) (x x x)) x) -> (x x x) -> (evaluating lambda produces another closure)"}


created_at: 2024-04-29 17:47:13
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes on function composition, including two definitions of a cube function in programming syntax.

metadata:
{"source": "pdf", "chroma:document": "Function Composition\n\nOne imagines wanting a function cube - one idea might be (define (cube x) (x * x * x)) What if x^2 were wanted?\n\nBut another (better) would be to break the function down as (define (cube x) (x * (square x)))\n\nEven without having first implemented the square function.\n\n(Notice the divide & conquer thinking)\n\nAnother example:"}


created_at: 2024-04-29 17:47:29
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The image contains handwritten notes about programming constructs and functions.
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; functions may occur in other functions - for example\n(define (sum-of-squares x y)\n  (+ (square x) (square y)))\n\n; we can use sum-of-squares as a building block in constructing\n; further procedures\n\n(define (f a)\n  (sum-of-squares (+ a 1) (* a 2)))\n\n(f 5)\n\nThese occurrences of a are said to be free in the body of f.\n\nWe can calculate (f 5) using either what is called the substitution model or the model introduced last time (the environment model).\n\nSee Ch 3 in AK 5\n\nThe substitution model: to evaluate a function call - (f 5) - substitute the value of the actual parameter for every free occurrence of the corresponding formal parameter in the function body\n\nReview quantifiers (x, y, z) in your discrete math differentiate logic\n\nFor (f 5):\n1) substitute 5 for a in (sum-of-squares (+ a 1) (* a 2))"}


created_at: 2024-04-29 17:47:41
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming concepts
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Eager evaluation (applicative order) gives (sum-of-squares 6 10) if we substitute the parameters for sum-of-squares before we substitute for sum-of-squares. 2) Now do the same thing for sum-of-squares (+ (square 6) (square 10)) 3) Now do the same thing for square (+ * 3 6 100) 4) Compute : 3 6 The substitution model is valid ONLY if assignment is absent - consider x = x + 1 we substitute 6 for x and get (6 = 7) x visual symbol for logical contradiction."}


created_at: 2024-04-29 17:47:49
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes discussing the substitution model in programming.
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The substitution model should remind you of pre-calc algebra \u2014 and indeed, it suggests the possibility of an algebra of programs which would allow one to work with programs as easily as one would with algebraic equations. E.g.: do prgm1 and prgm2 compute the same values?\n\nprgm1\n\u2193\nsome sequences\nof manipulations\n\u2193\nprgrm3\n\u2190-------------------\nprgm2"}


created_at: 2024-04-29 17:48:00
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes describing a programming concept with diagrams and annotations
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Can we at least start the environment model evaluation of (f 5)? Sure...\n\nf\nsum-of-squares\nsquare\nparams (x y)\n(x x) (+ square x) (square y)\nsquare (x)\nbody (x)\n(+ square x)\nroot (x)\n(sum-of-squares)\n(+ x 2)\n\nAfter the functions have been defined in a (fresh) initial environment\n\nWe call (f 5)"}


created_at: 2024-04-29 17:48:10
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes outlining steps and diagrammatic representations in programming context
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "first step: using the closure for f\nf\nsum-of-squares\nsquare\nx\n(x x)\n(x x)\n(+ (square x) (square y))\nCreate new frame\nSecond Step:\neval call to sum-of-squares\nx: 6\ny: 10\n(+ (square 6) (square 10))\nThird step\neval call to square\nx: 10\n(+ x x)"}


created_at: 2024-04-29 17:48:19
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming functions
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Two useful observations on functions\n\n; functions can also have 0 arguments\n(define (one) 1)\n; equivalently\n(define one (lambda () 1))\n\n; functions need not use all of their arguments\n(define (two x y z) 2)\n; equivalently\n(define two (lambda (x y z) 2))"}


created_at: 2024-04-29 17:48:40
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This is a transcription of the image regarding different evaluation strategies in programming (Applicative and Normal order).

metadata:
{"source": "pdf", "chroma:document": "; let's recall the earlier example\n\n(define (f a)\n  (sum-of-squares (+ a 1) (* a 2)))\n\n; using applicative order, the evaluation\n; of the call (f 5) proceeds as\n\n; (f 5)\n\n; ((sum-of-squares (+ a 1) (* a 2)) 5)\n\n; (sum-of-squares (+ 5 1) (* 5 2))\n\n; (sum-of-squares 6 10)\n\n; (+ (square 6) (square 10))\n\n; (+ (* 6 6) (* 10 10))\n\n; (+ 36 100)\n\n; 136\n\n; using normal order, the computation\n; proceeds differently:\n\n; (f 5)\n\n; ((sum-of-squares (+ a 1) (* a 2)) 5)\n\n; (sum-of-squares (+ 5 1) (* 5 2))\n\n; (+ (square (+ 5 1)) (square (* 5 2)))\n\n; (+ (+ (* 5 1) (+ 5 1)) (* (* 5 2) (* 5 2)))\n\n; (+ 6 6) (* 10 10)\n\n; (+ 36 100)\n\n; 136\n\nIn this case, applicative and normal order give the same result, but this is not always the case."}


created_at: 2024-04-29 17:49:00
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcribed text from the annotated handwritten academic notes on scheme programming in the image
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "applicative and normal order evaluation do not always give the same result. consider (define (p) (p) ) Clambda. observe that test, a user-defined function, will follow applicative order (define (test x y) (if (> x 0) 1 0) ) with this call, control never reaches the f... as scheme gets stuck trying to eva (p) what will happen if (test 0 (p)) is evaluated using applicative order? why? what will happen if it is evaluated using normal order? you can stop an infinite loop under DrRacket by using the redStop button at the top right of your screen. (if #t not (p) ) returns 0 -- because if is a special form, the infinite loop (p) is never evaluated to drive this point home, suppose that instead of if, we defined our own function, ne(if) (define (new-if predicate then-clause else-clause) (cond (predicate then-clause) (else else-clause))) (new-if (> 2 0) 3 4) (new-if (> 2 3) 3 4) ; this seems to 'work'! But should we try ... (let ((x 0)) (new-if (= x 0) (p) )) we find that we have an infinite loop, precisely because the standard evaluation rules apply to the user-defined function new-if. new-if is not a special form"}


created_at: 2024-04-29 17:49:14
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
The image contains handwritten notes on Boolean Functions and Conditionals, specifically focusing on coding in Scheme.

metadata:
{"source": "pdf", "chroma:document": "Boolean Functions and Conditionals\n\n(define (myabs x)\n  (cond ((> x 0) x)\n        ((= x 0) 0)\n        (else (- x))))\n\n(myabs -4)\n\n; another way\n\n(define (myabs x)\n  (cond ((<= x 0) (- x))\n        (else x)))\n\n; another way\n\n(define (myabs x)\n  (if (<= x 0)\n      (- x)\n      x))\n\n;; >, =, < are primitive predicates\n;; Scheme also supplies logical connectives such as and, or, not\n\n(define x 6)\n\n(and (> x 5) (<= x 10))\n\n(not (> x 4))\n\n#f\n\n(not #f)\n\n(= x 6)"}


created_at: 2024-04-29 17:52:52
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes on programming concepts related to Scheme language, specifically about lambda functions and closures.0

metadata:
{"source": "pdf", "chroma:document": "CSc 335 Sections M and R\nClasses 3 and 4\nFebruary 1 and February 6 2024\n\n; functions are values, too \nScheme has first-class\nfunctions\n(lambda (x) (* x x))\nlambda causes Scheme to create a\nclosure\nYou might enjoy\nstudying\nthe language\nLisp\n\nThat is, a function, along\nwith certain environmental\ninformation\n\nFor example, in response to\ndefine sq\nlambda (x) (* x x))\nThe system augments its starting\nenvironment as follows ->\n\nnamespace -> global"}


created_at: 2024-04-29 17:53:06
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: handwritten notes about programming concepts and steps1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "starting environment - everything predefined in scheme is installed here\n\nsq -> ?\n\nt.\nstep 1 : install sq in G\n(but we don't have a value\nfor sq yet, hence the\nquestion mark)\nstep 2 : evaluate the lambda\nclosure created by lambda(x)(+ x x)\n\nsq -> ?\n\nThe diagram shows closure with components labeled as 'environment part of closure' and 'code part of closure', as well as 'params (x)' and 'body (+ x x)'."}


created_at: 2024-04-29 17:53:14
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: This is educational content regarding programming concepts.2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Step 3: bind sq to the closure\n\nThe closure is a scheme object (much as the number 1 is a scheme object).\n\nparam -> (x)\nbody -> (* x x)\n\nWith this in place, what happens when we ask the system to evaluate (sq 4)? Not sq(4)!\n\nfunction name\n\nScheme has dynamic typing\n\nfor the def-given, Scheme absolutely insists on exactly ONE argument."}


created_at: 2024-04-29 17:53:24
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Diagram and handwritten notes explaining a computer science concept involving frames and parameters in a system.3

metadata:
{"source": "pdf", "chroma:document": "G is an environment of a sequence of frames. Global frame. When (sq 4) is requested the system opens a new frame. x: 4 or parent frame. The system sees that the frame associated with sq is G, so it makes G the containing frame of this new frame. 3. In the new frame, the formal parameter x is bound to the actual parameter (in this case, 4). We say 'x has value 4 in this frame'. 4. Next, scheme evaluates the body (x x x) in the new frame."}


created_at: 2024-04-29 17:53:32
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on a programming concept4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "frame\n\nThis new frame is memory allocated from the heap\n\nx: A\n\n(* x x)\n\nWhat does it mean to evaluate (* x x) in the new frame?\ni.e., in the env. formed by the new frame and S9, its parent.\n\nWe know from the scheme evaluation rule that the system needs to eval. x and x ... to evaluate * you can think of the"}


created_at: 2024-04-29 17:53:41
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on system behavior and variable scope5
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "system starting to look in the closest frame. But x is not defined in that frame (only x is), so the system goes to the parent frame and looks there for the definition of x. Since in this case the parent frame is G, the scope of x is found. So x is evaluated to the system nil. op, What about x? Again, the system starts in the closest"}


created_at: 2024-04-29 17:53:50
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This is an excerpt from handwritten notes, possibly discussing topics related to programming or computer science.6

metadata:
{"source": "pdf", "chroma:document": "frame in which x has been bound to A.\n\nso now (* A A) can be computed, and to return,\n\n5) still not done ... we need to free up the memory allocated to the new frame. This is done by the garbage collector (invented in the 1960s for LISP ) the idea is that storage which is no longer needed (ie, no longer \"alive\")"}


created_at: 2024-04-29 17:53:58
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes and diagram explaining memory allocation and pointers7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "How do we tell whether a storage is still alive? Storage is live if it is pointed at (even indirectly) from the initial environment.\n\nNot alive, because no pointer from g\nAlive because pointed at by sq"}


created_at: 2024-04-29 17:54:12
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes regarding an evaluation method, including a text diagram and comments on garbage collection.8

metadata:
{"source": "pdf", "chroma:document": "When the entire evaluation is done, the situation is ________\n\nNo concerns about memory leakage, as GC takes care of the problem.\n\nThis evaluation mode is described in Ch. 3 of A&S \u2013 EXCEPT they have introduced assignment by them, they call it the environment model of evaluation."}


created_at: 2024-04-29 17:54:19
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes9
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "We can use this model to explain\nWhy (sq 5-) does not change\nx if x has previously been\ndefined.\nSuppose (define x 7)\n(sq 5-)\nand subseq. ask for x - you\nwill see that it is still 7. Why?"}


created_at: 2024-04-29 17:54:28
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes explaining code behavior with diagram10
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Here's the situation after x and sq have been defined. This binding is shadowed by the local binding. (x x x) (x x x) x: 5 The system takes the first value of x that it finds as it works up the linked list of frames. Again, x is found in G and x is found in the new frame."}


created_at: 2024-04-29 17:54:35
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Text transcribed from a handwritten image including mathematical inline statements11
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "After computing 25 the new frame is garbage - and we're left with\nx = 17\nand of course when now we ask for the value of x, we get 17.\n(The 5 is gone for good)"}


created_at: 2024-04-29 17:54:48
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Hand-written notes on programming concepts involving scopes, local and global variables, and function closures.12

metadata:
{"source": "pdf", "chroma:document": "Abelson-Sussman format, which is under the hoo \u2014 the same as the lambda form. \n; some names are local, while others are global\n\n(define x 3)\n\n(define (add-x y) \n(+ x y))\n\nx is free in the body of add-x\n\nWhat happens when we have these definitions and then call for (add-x 6)?\nNon own for (add-x 6)\n\nx:3\n\nadd-x\n\n;;Env pointer of the closure always goes to the frame in which the definition is created\n\n(add-x y) \n\n;;system\n\n(+ x y)\n\n(+ x y)\n\n6\n\n3"}


created_at: 2024-04-29 17:54:59
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of the handwritten text from the provided image13
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "student question: What if add-x were defined\n\ndefine (add-x x y)\n(+ x y))\n\n?  \n\nConsider\n(add-x 4 5)\n\nx: 3\n\nadd-x ->\n\n(Define (add-x x y) \n(+ x y) \n\nsame as \ndefine \nadd-x \n(+ x y)\n\nx: 3 \nx: 4 \ny: 5 \n\n(+ x y)\n\nNote that you may not\ncall this new\nversion with just a single\n(x + y) \n(+ x y) \n\n4 5"}


created_at: 2024-04-29 17:55:08
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
The image contains handwritten notes and diagrams related to a programming concept, particularly focusing on defining and calling functions with parameters.14

metadata:
{"source": "pdf", "chroma:document": "What about\n(define x 3)\n(add-x x 4)\n\nIn this case, the system\nwould eval x to 3\n\nx: 3\nadd-x\n\nlook up will\nbe needed\nto get that\nvalue\n\nParameter, because\nScheme will regard\nthat as a\ntype error"}


created_at: 2024-04-29 17:55:16
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Description of the handwritten note15
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "At this point, Scheme's default parameter passing mechanism is call-by-value\n\nA local copy of the param. value is created\n\nStudent Question\n\nWhat about\n\n(define (sq x)\n  (lambda (x) ((x x) (x x))) x))\n\nConsider (sq 4)\n\n(define sq\n  (lambda (x)\n    ((lambda (x) ((x x) x)) x)\n  ))"}


created_at: 2024-04-29 17:55:24
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This image contains handwritten notes and diagrams related to computer programming concepts, specifically dealing with functions and evaluations.16

metadata:
{"source": "pdf", "chroma:document": "G -> sq ((lambda x) (x x x)) x ((lambda x) (x x x)) x x; 4 ((lambda x) (x x x)) x evaluating the lambda produces another closure (x x x) (x x x)"}


created_at: 2024-04-29 17:55:38
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about function composition in programming17
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Function Composition\n\nOne imagines wanting a function cube - one idea might be\n(define (cube x)\n    (x * x * x))\nWhat if sqrt were wanted?\n\nBut another (better) would be to break\nthe function down as\n\n(define (cube x)\n    (x * (square x)))\n\nEven without having first implemented\nthe square function.\n\n(Notice the divide & conquer thinking)\n\nAnother example :"}


created_at: 2024-04-29 17:55:52
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
The text of the image shows various programming and mathematical concepts written on lined paper with multicolored marker annotations18

metadata:
{"source": "pdf", "chroma:document": "; functions may occur in other functions - for example\n(define (sum-of-squares x y)\n  (+ (square x) (square y)))\n\n; we can use sum-of-squares as a building block in constructing\n; further procedures\n\n(define (f a)\n  (sum-of-squares (+ a 1) (* a 2)))\n\n(f 5)\n\nWe can calculate (f 5) using what is\ncalled the substitution model or the model\nintroduced last time (The environment model)\n\nThe substitution model: to evaluate a function\ncall - s\n(f 5) - substitute the value of\nthe actual parameter for every free ocurrence\nof the corresponding formal parameter in the\nfunction body\n\nFor (f 5):\n1) substitute 5 for a in\n(sum-of-squares (+ a 1) (* a 2))"}


created_at: 2024-04-29 17:56:05
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming concepts19
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Eager evaluation (applicative order)\n\n1) gives\n   (sum-of-squares 6 10)\n   if we substitute for the parameters before we sub for sum-of-squares\n\n2) now do the same thing for sum-of-squares\n   (+ (square 6) (square 10))\n\n3) now do the same thing for square\n   (+ * 36 100)\n\n4) compute: 136\n\nThe substitution model is valid ONLY if assignment is absent - consider\n   x = x+1\n\nwe substitute 6 for x and get\n   (6 = 7)\n   x\n\n            (visual symbol for logical contradiction)."}


created_at: 2024-04-29 17:56:14
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing programming and algebraic concepts20
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The substitution model should remind you of pre-calc algebra \u2014 and indeed it suggests the possibility of an algebra of programs which would allow one to work with programs as easily as one would with algebraic equations. Eg: do prgm1 and prgm2 compute the same values? prgm1 -> some sequences -> of manipulations -> prgm3; prgm2 -> some sequences -> of manipulations -> prgm3"}


created_at: 2024-04-29 17:56:23
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes21
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Can we at least start the environment model evaluation of (f 5)? Sure...\n\ninit\nenv\n\nf\nsum-of-squares (sum-of-squares) (x) (sum-of-squares (x + x))\nsquare\ny\n(square x) (square y)\n\nparams (x y)\nbody (+ square x) (square y)\n\nAfter the functions have been defined in a (fresh) initial environment\n\nWe call (f 5)"}


created_at: 2024-04-29 17:56:33
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes and diagrams explaining a concept involving closure in programming22
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "first step: using the closure for f\nf\nsum-of-squares\nsquare\n(sum-of-squares)\n(+ a 1)\n(+ a 2)\n(a x y)\n(+ square x) (square y)\ncreate new frame\nSecond step:\neval call to sum-of-squares\n(+ (square 6) (square 10))\nx = 6\ny = 10\na = 5\n(sum-of-squares 6 10)\nThird step:\neval call to\nsquare\nx=10\n(+ x x)"}


created_at: 2024-04-29 17:56:43
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes on functions in programming23
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Two useful observations on functions\n\n; functions can also have 0 arguments\n(define (one) 1) ; one is a constant \u2014 every time it's called, it returns 1.\n; equivalently\n(define one (lambda () 1)) ; Works out with both eval models\n\n; functions need not use all of their arguments\n(define (two x y z) 2) ; body just returns 2, ignoring x, y, or z\n; equivalently\n(define two (lambda (x y z) 2))"}


created_at: 2024-04-29 17:57:02
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcribed text from the image discussing Applicative and Normal Order in programming24
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; let's recall the earlier example\n\n(define (f a)\n(sum-of-squares (+ a 1) (* a 2)))\n\n; using applicative order, the evaluation\n; of the call (f 5) proceeds as\n\n; (f 5)\n\n; ((sum-of-squares (+ a 1) (* a 2)) 5)\n\n; (sum-of-squares (+ 5 1) (* 5 2))\n\n; (sum-of-squares 6 10)\n\n; (+ (square 6) (square 10))\n\n; (+ (* 6 6) (* 10 10))\n\n; (+ 36 100)\n\n; 136\n\n; using normal order, the computation\n; proceeds differently:\n\n; (f 5)\n\n; ((sum-of-squares (+ a 1) (* a 2)) 5)\n\n; (sum-of-squares (+ 5 1) (* 5 2))\n\n; (+ (square (+ 5 1)) (square (* 5 2)))\n\n; (+ (+ (* 5 1) (+ 5 1)) (* (* 5 2) (* 5 2)))\n\n; (+ 36 100)\n\n; 136\n\nIn this case, applicative and normal order give the same result, but this is not always the case."}


created_at: 2024-04-29 17:57:22
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of programming notes on evaluation schemes with annotations25
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; applicative and normal order evaluation do not always give the same result\n; consider\nequivalently (define p (lambda () (p)))\nobserve that test, a user-defined function,\n(define (p) (p))\nwill follow applicative order\n\n(define (test x y)\n  (if (= x 0)\n      0\n      y))\n\nwith this call, control never reaches the f...\nas scheme gets stuck trying to evaluate (p)\n\n; what will happen if (test 0 (p)) is evaluated using applicative order? why?\n; what will happen if it is evaluated using normal order?\n\n; you can stop an infinite loop under DrRacket by using the redStop button\n; at the top right of your screen\n\n; remark\n(if #t 0 (p))\n; returns 0 -- because if is a special form, the infinite loop (p) is never evaluated\n\n; to drive this point home, suppose that instead of if, we defined our own function, new-if\n\n(define (new-if predicate then-clause else-clause)\n  (cond (predicate then-clause)\n        (else else-clause)))\n\n(new-if (> 2 0) 3 4)\n(new-if (> 2 3) 3 4)\n\n; this seems to work! But should we try...\n\n(let ((x 0))\n  (new-if (= x 0)\n         0\n         (p)))\n\n; we find that we have an infinite loop, precisely because the standard evaluation\n; rules apply to the user-defined function new-if. new-if is not a special form"}


created_at: 2024-04-29 17:57:39
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This image contains handwritten annotations and code examples about Boolean functions and conditionals specifically in a programming context.26

metadata:
{"source": "pdf", "chroma:document": "Boolean Functions and Conditionals\n(define (myabs x)\n  (cond ((> x 0) x)\n        ((= x 0) 0)\n        (else (- x))))\n(myabs -4)\n; another way\n(define (myabs x)\n  (cond ((<= x 0) (- x))\n        (else x)))\n; another way\n(define (myabs x)\n  (if (<= x 0)\n      (- x)\n      x))\n\n; >, =, < are primitive predicates\n; Scheme also supplies logical connectives such as and, or, not\n(define x 6)\n(and (> x 5) (<= x 10))\n(not (> x 4))\n\n#f\n(not #f)\n(= x 6)\n\n; and has its own evaluation rule\n; conjuncts are evaluated left to right, with immediate exit when one of them tests to false\n; minus is two unary negation op\n; necessary for formulating more general predicates\n; not a scheme function, it is instead a macro\n; this evaluation order is not part of any language standard"}


created_at: 2024-04-29 17:58:02
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This image contains handwritten notes about the Scheme programming language, specifically discussing the 'cond' and 'if' constructs.27

metadata:
{"source": "pdf", "chroma:document": "general form: cond followed by a list of question-answer pairs. (? : \"predicate\" e1: \"expression\" optional else\n\nnote that cond and if do not obey the standard evaluation rule -\n\n(cond (p1 e1) (p2 e2) ... (pn en) (else E)) is evaluated as follows: evaluate p1 -- if #t, then evaluate e1 and return this value; otherwise evaluate p2 -- if #t, evaluate e2 and return this value; otherwise evaluate p3 -- if #t, evaluate e3 and return this value\n\nand so on. If none of the pi is #t, evaluate E and return this value\n\nsimilarly, (if p1 e1 e2) evaluates e1, but not e2, if p1 is #t; it evaluates e2, but not e1, if p1 is #f\n\nit is interesting to note that cond and if forms can be evaluated by themselves - they do not need to be embedded in a function\n\n(define x 6)\n\n(cond ((> x 6) 1)((= x 6) 2)(else 0))\n\ncond and if can occur alone as input to scheme\n\n(if (= x 6) 2 3)\n\nand even such expressions as\n\n(+ (cond ((> x 6) 0)(else 1)) 2)\n\nand can also occur in ANY expression\n\nA more interesting example:\n\n(define (a-plus-abs-b a b) (if (> b 0) (+ a b) (- a b)))\n\nmake sure you fully understand the Scheme evaluation rule!"}


created_at: 2024-04-29 17:58:19
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes about programming in Scheme28
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "We can return functions as values in Scheme.\n\n(a-plus-abs-b 2 3) = (+ 2 3) = 5\n(a-plus-abs-b 2 -3) = (+ 2 -3) = 5\n\nIt is instructive to note that and and or can be defined in terms of cond.\n\nand in terms of cond?\ncond ((x y)) = (and x y)\n\nLet's look at the truth tables\n\nx   y   (cond (x y))   (and x y)\nT   F            F                 F\nF   T            unspecified F\nF   F            unspecified F\n\nSo the functions are NOT the same - though we could say that the restrictions of the functions defined by (cond (x y)) and (and x y) to all pairs whose first elt is T are the sam."}


created_at: 2024-04-29 17:58:25
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes related to programming concepts29
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Can we remove this restriction? Easy enough :\n(cond ((< x y)\n(else #f)))\n\nYou can check that this is possibly (and?)\n\nSuggested HW: Show how OR can be implemented using cond.\n\nThink about whether NOT could be implemented using cond."}


created_at: 2024-04-29 17:58:38
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten programming exercise and diagram illustration0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "A&S Exercise 2.27, from HW 9\n\nDeep Reverse Illustrated\n\n(define (deep-reverse x)\n  (cond ((null? x) '())\n        ((not (pair? x)) x)\n        (else (append (deep-reverse (cdr x))\n                      (list (deep-reverse (car x)))))))\n\n(deep-reverse of the cdr)\n\n(deep-reverse of the car)\n\n(recall/eg) (append '(1 2 3) 4) = \n\nor however fir presents this) which is not a list"}


created_at: 2024-04-29 17:58:52
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Written notes and a programming code example along with tree diagrams1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "So you see that list (list 1 2 3) is forced by append and by the logic underlying, our tree diagrams we need to insert the link terminating at 1. We use append in the first place to preserve the root outdegree of the cdr. \n\n; the following is surely simpler to understand (and to prove ; correct) -- now looking at the argument as a list ; of subtrees\n\n(define (alt-alt-deep-reverse tr)\n   (cond ((null? tr) '())\n         ((atom? tr) tr)\n         (else (reverse (map alt-alt-deep-reverse tr)))))"}


created_at: 2024-04-29 17:59:03
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Description of the handwritten notes related to a function or algorithm concerning trees or data structure nodes2

metadata:
{"source": "pdf", "chroma:document": "first: map the deep-rev function over t:\nGiving a list of deeply reversed subtrees, but in the wrong order. How wrong? Well, it's exactly the reverse of what we want. And that accounts for the call to reverse, giving"}


created_at: 2024-04-29 17:59:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten and printed text from a notebook page3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "which is the list-of-subtree view of the derived result, We also discussed A&S exercises 2.31 (which needed 2.30) and 2.32. Again, these are part of HW 9. I ask you to work these out on your own, making note of where you get stuck, if in fact you do get stuck. Please bring your questions either to my office hours after the break, or to one of these zoom sessions (also after the break). I can go back to HW 7 if anyone has questions. Of course we need to discuss further problems in HW 8, the rest of HW 9, and the later HW assignments. This material will be emphasized heavily on both Quiz 3 and the final exam - please do not let it slide."}


created_at: 2024-04-29 17:59:37
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Text and annotations from a class notes or document discussing the construction of a Scheme interpreter0

metadata:
{"source": "pdf", "chroma:document": "CSc 335 Class 22 April 18 2024\n\n; we start off our construction of a scheme interpreter by building its environment subsystem, followed by the interpreter presented in chapter 10 of the 'little schemer'\n\n; environments implemented as tables, i.e., rib-cages\n\n; pre:\n; name is a symbol\n; table is a rib-cage, that is, a list of entries, where each entry is a list (names values), where names is a list of symbols and names is the corresponding list of values. The lists names and values have the same length, and the kth name corresponds to the kth value.\n; table-f is a function of one argument, name, which specifies the action taken when name does not exist in any of the entries of the table\n\n; post:\n; returns the value associated with name in table - note that the search is entry by entry, starting with the topmost entry.\n; entry - if this exists, otherwise returns (table-f name)\n\n(define lookup-in-table\n(lambda (name table-f)\n(cond\n((null? table) (table-f name)) catastrophic fail\n(else (lookup-in-entry name\n(car table)\n(lambda (name)\n(lookup-in-table name\n(cdr table)\n table-f))))))\n\nYou might try working out a proof for the suite of functions implementing the environment subsystem. In particular, work out the specification of this subsystem, and @see related documentation."}


created_at: 2024-04-29 17:59:55
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This image contains handwritten Scheme programming code and annotations explaining how to handle lookup functions with mutual recursion.1

metadata:
{"source": "pdf", "chroma:document": "\n; pre: name is a symbol\n; entry is a pair of lists (names vals), where names is a lat, and vals is a list of values\n; with length at least as long as that of names\n; entry-f is a function which specifies the action taken when name does not occur in names\n;\n; post: returns the value associated with name, with positional association: the kth name is assigned to the kth value\n; if name occurs in the names component of entry. Otherwise calls entry-f with argument name\n\n(define lookup-in-entry\n  (lambda (name entry entry-f)\n    (lookup-in-entry-help name\n                          (names entry)\n                          (vals entry)\n                          entry-f)))\n\n(define lookup-in-entry-help\n  (lambda (name names vals entry-f)\n    (cond\n      ((null? names) (entry-f name))\n      ((eq? (car names) name) (car vals))\n      (else (lookup-in-entry-help name\n                                  (cdr names)\n                                  (cdr vals)\n                                  entry-f)))))\n\n; simultaneously cdr down the lists names and vals\n"}


created_at: 2024-04-29 18:00:11
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: This is a transcription of code and comments from the image.2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; here are constructor and selectors for entries\n\n(define build\n  (lambda (s1 s2)\n    (list s1 s2)))\n\n(define new-entry build)\n\n(define names\n  (lambda (entry) (car entry)))\n\n(define vals\n  (lambda (entry) (cadr entry)))\n\n; here are the basic definitions for tables\n\n(define initial-table '())\n\n(define table-f\n  (lambda (name)\n    (car (quote ()))))\n\n; note that as (car (quote ())) throws an error: when the table is empty,\n; attempting to look anything up in it is an error. See the definition\n; for lookup-in-table, above.\n\n; we could just use the error primitive, but I wanted to explain\n; the presentation given in tls. Why didn't they use error? Perhaps\n; to make the point that it is not necessary to have this primitive.\n; Or perhaps because error was not included in standard scheme at\n; the time the book was written.\n\n(define extend-table cons)"}


created_at: 2024-04-29 18:00:29
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This image contains handwritten notes and code related to a programming concept, possibly involving lookups in nested data structures.3

metadata:
{"source": "pdf", "chroma:document": "; testing data\n\n(define names1 '(a b))\n(define vals1 (list 1 2))\n(define entry1 (new-entry names1 vals1))\n\n(define names2 '(a c))\n(define vals2 (list 3 4))\n(define entry2 (new-entry names2 vals2))\n\n(define table1 (extend-table entry1 initial-table))\n(define table2 (extend-table entry2 table1))\n\n; a few tests\n\n(lookup-in-table 'a table2 table-f)\n\n; observe that this returns 3, not 2: a is found in the topmost rib, and so the second rib is never searched.\n\n(lookup-in-table 'b table2 table-f)\n\n; b is not present in the first rib, and so the second rib is searched.\n\n; from the call\n;; (lookup-in-entry name\n;;   (car table)\n;;   (lambda (name)\n;;     (lookup-in-table name\n;;       (cdr table) table-f)))\n; we see that entry-f has been bound to (lambda (name) (lookup-in-table name (cdr table) table-f))\n\n; and that the topmost entry is discarded for the continuation of the search. We are cdring down t... (image cut off)\n\n(lookup-in-table 'd table2 table-f)\n\n; as expected, this fails"}


created_at: 2024-04-29 18:00:39
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten and typed notes related to programming4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; Perhaps one additional remark is in order for this first look at the environment subsystem of the tls scheme interpreter: observe that ANY scheme value at all can occur in the values lists. We used integer values for our example, but soon we will take advantage of the genericity of scheme's lists by (for example) having function ; descriptions occur in them\n\n(define names3 (list 'e 'id))\n(define vals3 (list 17 '(lambda (x) x))) ; (lambda (x) x) is here regarded as a description of the identity function\n(define entry3 (new-entry names3 vals3))\n(define table3 (extend-table entry3 table2)) .\n\nThis point is important for understanding\nhow TLS implements higher-order\nfunctions."}


created_at: 2024-04-29 18:00:58
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Excerpt from a book discussing the scheme interpreter from The Little Schemer5
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Now we begin discussion of the entire scheme interpreter presented in Chapter 10 of The Little Schemer. This interpreter, which we shall refer to as TLS Scheme, or just TLS, implements a subset of Scheme, which we shall also refer to as TLS. Whether we mean the interpreter or the language will be clear from context.\n\nTLS scheme has just 6 types of expressions, named *const, *quote, *identifier, *lambda, *cond, and *application.\n\nMore precisely, the syntax of TLS can be given inductively as follows:\n\nbasis step of an inductive definition of TLS\n:\nnumbers, #t, #f, cons, car, cdr, null?, eq?, atom?, zero?, add1, sub1, number? have type *const -- we may find it desirable to add others later -- as you will see, this is very easy to do\n\nsymbols have type *identifier\n\ninductive step of an inductive definition of TLS\n:\n(quote x) has type *quote, where x is any TLS expression\n\n(lambda varlist lambda-body) has type *lambda, where varlist is a list of *identifiers and lambda-body is any TLS expression\n\n(cond (p1 e1) ... (pk ek)) has type *cond, where the pi and ei are any TLS expressions\n\n(e1 e2 ... en) has type *application, where the ei are any TLS expression\n\nOf course, syntax says nothing at all about the meaning of expressions - it is the interpreter which supplies meaning for expressions in TLS."}


created_at: 2024-04-29 18:01:19
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of programming and mathematical concepts in an image6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; It will be helpful to look at TLS (The interpreter) in layers. Let us begin by examining the evaluation of expressions without variables. You may find the complete interpreter posted on Piazza.\n;if the top level of the interpreter is given as:\n(define value\n(lambda (e)\n(meaning (quote ())))\n\n(define meaning\n(lambda (e table)\n((expression-to-action e) table)))\n\n;then we can say that the interpreter computes the value of a given TLS expression e by calling the meaning function with the empty list as table parameter. Here the system will use tables - as sketched above - to organize information about variables/values. Our limitation to variable-free expressions for this initial look allows us to assume that table always has the value 'quote(())'.\n\n;from the definition of the meaning function, we are motivated to look into expression-to-action\n\n(define expression-to-action\n(lambda (e)\n((atom? e) (atom-to-action e))\n(else (list-to-action e)))))\n\n; where\n\n(define atom?\n(and (not (null e)) (not (pair e))))\n\n;now one thing at a time, in an attempt to manage complexity - we look at atom-to-action\n\n(define atom-to-action\n(lambda (e)\n(cond\n((number? e) '*const)\n((eq? e '#f) '*const)\n((eq? e '#t) '*const)\n((eq? e (quote cons)) '*const)\n((eq? e (quote car)) '*const)\n((eq? e (quote cdr)) '*const)\n((eq? e (quote null?)) '*const)\n((eq? e (quote eq?)) '*const)\n((eq? e (quote atom?)) '*const)\n((eq? e (quote zero?)) '*const)\n((eq? e (quote add1)) '*const)\n((eq? e (quote sub1)) '*const)\n((eq? e (quote number?)) '*const)\n(else 'identifier))))\n\n; where"}


created_at: 2024-04-29 18:01:31
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Source code and handwritten annotations7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(define *const\n  (lambda (e table)\n    (cond\n      ((number? e) e)\n      ((eq? e #t) #t)\n      ((eq? e #f) #f)\n      (else (build (quote primitive) e))))\n\n; with\n\n(define build\n  (lambda (s1 s2)\n    (list s1 s2)))\n\n; and\n\n(define *identifier\n  (lambda (e table)\n    (lookup-in-table e table initial-table)))\n\n; as we are assuming there are no identifiers, for the moment, we say nothing further at this time regarding\n; *identifier.\n\n{*const 1 '()} = 1\n(primitive sub)"}


created_at: 2024-04-29 18:01:42
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Teaching notes or commentary on evaluating expressions in programming8
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "As we noted last time, we can already evaluate some simple expressions with the code we have:\n(value 't')\n; returns 1\n(value '+t')\n; returns #t\n(value 'sub1')\n; returns ('primitive sub1')\n; here the tag 'primitive' will be used later to further steer the evaluation of expressions involving sub1.\n\nWhy quoted? Well, without the quote, Rocket Scheme will of course eval. but why to value. This is on for numbers and booleans, but what about sub1 is not defined in R5RS, so this would trigger an error - even though sub1 is defined in TLS.\nThe main idea: we quote the input to value so that OUR interpreter gets to evaluate the input."}


created_at: 2024-04-29 18:02:01
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten computer code and notes from the image9
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(define list-to-action\n(lambda (e)\n  (cond\n    ((not (pair? e)) (error \"bad syntax\" e))\n    ((eq? (car e) 'quote) (list 'quote (cadr e)))\n    ((eq? (car e) 'lambda) (list 'procedure (cadr e) (caddr e)))\n    ((eq? (car e) 'if)\n      (if (eval (cadr e) env)\n          (eval (caddr e) env)\n          (eval (cadddr e) env)))\n    (else (list 'application (map eval (cdr e) env)))))))\n\n; with\n\n(define *application\n  (lambda (e table)\n    (myapply\n      (meaning (function-of e) table)\n      (evals (arguments-of e) table))))\n\n(define function-of car)\n\n(define arguments-of cdr)\n\n; and\n\n(define myapply\n  (lambda (fun vals)\n    (cond\n      ((primitive? fun) (myapply-primitive (second fun) vals))\n      ((non-primitive? fun) (myapply-closure (second fun) vals))))))\n\n; with\n\n(define primitive?\n  (lambda (l)\n    (eq? (first l) (quote primitive))))\n\n; and\n\n(define first car)\n\n(define second cadr)\n\n(define third caddr)\n\n; and\n\n(define myapply-primitive\n  (lambda (name vals)\n    (cond\n      ((eq? name (quote cons)) (cons (first vals) (second vals)))\n      ((eq? name (quote car)) (car (first vals))))))"}


created_at: 2024-04-29 18:02:23
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: This is a piece of annotated code written along with handwritten comments10
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(define myapply-primitive\n(lambda (name vals)\n  (cond\n    ((eq? name (quote cons))\n      (cons (first vals) (second vals)))\n    ((eq? name (quote car))\n      (car (first vals)))\n    ((eq? name (quote cdr))\n      (cdr (first vals)))\n    ((eq? name (quote null?))\n      (null? (first vals)))\n    ((eq? name (quote eq?))\n      (eq? (first vals) (second vals)))\n    ((eq? name (quote atom?))\n      (atom? (first vals)))\n    ((eq? name (quote zero?))\n      (zero? (first vals)))\n    ((eq? name (quote add1))\n      ((lambda (x) (+ x 1)) (first vals)))\n    ((eq? name (quote mul))\n      (* (first vals) (second vals)))\n    ((eq? name (quote sub1))\n      (sub1 (first vals)))\n    ((eq? name (quote number?))\n      (number? (first vals)))))\n\n; and finally\n\n(define evalis\n(lambda (args table)\n  (cond\n    ((null? args) (quote ()))\n    (else\n      (cons (meaning (car args) table)\n           (evalis (cdr args) table))))))\n\n; now we can evaluate (sub1 4)\n; on board, in class\n(value 'sub1 4) gives just 3.\n\nSub1 note: note that sub1 is an R5RS function defined by the user. Use an augmented interpreter code\n(define (sub1 x)\n  (- x 1))"}


created_at: 2024-04-29 18:02:50
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Transcription of a document discussing evaluation in a computer science context with code examples in a Lisp-like programming language0

metadata:
{"source": "pdf", "chroma:document": "CSC 335 Class 23 April 30 2024\nWe start by looking at the evaluation of more complex expressions, to better understand the recursive structure of the interpreter.\n\n(define list-to-action\n  (lambda (e)\n    (cond\n      ((atom? (car e))\n        (cond\n          ((eq? (car e) (quote quote))\n            'quote)\n          ((eq? (car e) (quote lambda))\n            'lambda)\n          ((eq? (car e) (quote cond))\n            'cond)\n        (else *application*))))\n\n(define primitive?\n  (lambda (l)\n    (eq? (first l) (quote primitive))))\n\n(define first car)\n\n(define second cadr)\n\n(define third caddr)\n\n;;; with\n\n(define *application\n  (lambda (e table)\n    (myapply\n      (meaning (function-of e) table)\n      (evlis (arguments-of e) table))\n    (define-function-of car)\n    (define arguments-of cdr)))\n\n(define myapply\n  (lambda (fun vals)\n    (cond\n      ((primitive? fun)\n        (myapply-primitive\n          (second fun) vals))\n      ((non-primitive? fun)\n        (myapply-closure\n          (second fun) vals)))))\n\n;;; and\n\n(define myapply-primitive\n  (lambda (name vals)\n    (cond\n      ((eq? name (quote cons))\n        (cons (first vals) (second vals)))\n      ((eq? name (quote cdr))\n        (cdr (first vals)))\n      ((eq? name (quote null?))\n        (null? (first vals)))\n      ((eq? name (quote eq?))\n        (eq? (first vals) (second vals)))\n      ((eq? name (quote atom?))\n        (atom? (first vals)))\n      ((eq? name (quote zero?))\n        (zero? (first vals)))\n      ((eq? name (quote add1))\n        ((lambda (x) (+ x 1)) (first vals)))\n      ((eq? name (quote mul))\n        ((* first vals) (second vals)))\n      ((eq? name (quote sub1))\n        ((sub1 (first vals))))\n      ((eq? name (quote number?))\n        (number? (first vals)))))\n\nNow we can evaluate:\n(value ('mul (add1 3) (sub1 4)))\nmeaning ('mul (add1 3) (sub1 4))\n-> ((expression-to-action 'e) (list-to-action 'e) (e '() '))"}


created_at: 2024-04-29 18:02:59
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Written content of the image related to programming or mathematical functions1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(applyfun e '())\n(apply    (meaning '()) (evlis ((add 3) (sub 4)) '()))\nmaps meaning with the '()' table over this\n('primitive mul') (( 4   3 ))\n(myapply->primitive ( 4 3 )) -> 12"}


created_at: 2024-04-29 18:03:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes and code from an image2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(define list-to-action\n(lambda (e)\n  (cond\n    ((atom? (car e))\n    (cond\n      ((eq? (car e) (quote quote)) '*quote)\n      ((eq? (car e) (quote lambda)) '*lambda)\n      ((eq? (car e) (quote cond)) '*cond)\n      (else '*application)))\n    (else '*application)))\n\n; with\n\n(define *application\n  (lambda (e table)\n    (myapply\n      (meaning (function-of e) table)\n      (evlis (arguments-of e) table))))\n\n(define function-of car)\n\n(define arguments-of cdr)\n\n; and\n\n(define myapply\n  (lambda (fun vals)\n    (cond\n      ((primitive? fun) (myapply-primitive (second fun) vals))\n      ((non-primitive? fun) (myapply-closure (second fun) vals)))))\n\n; now we can evaluate:\n\n(value '(cond (#f 1) (#t 2)))\n\n(value '(cond ((number? (quote x)) 1) (else 2)))\n\n(value '(mul (add1 (cond (#f 1) (#f 2) (else 3))) 4))"}


created_at: 2024-04-29 18:03:23
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Text from a handwritten note emphasizing a mathematical topic3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "a number \u2014 again\nemphasizing the importance of recursion in the working of the meaningful function."}


created_at: 2024-04-29 18:03:49
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten annotations and code on a programming lecture slide about lambda functions and closures4

metadata:
{"source": "pdf", "chroma:document": "finally, we add the lambda subsystem -- in TLS, the only way we associate values with variables is via lambda. (define list-to-action (lambda (e) (cond ((atom? (car e)) ((cond ((eq? (car e) (quote quote)) (*quote) ((eq? (car e) (quote lambda)) (*lambda) ((eq? (car e) (quote cond)) (*cond) (else *application)))))) ; with (define *application (lambda (e table) (myapply (meaning (function-of e) table) (evalis (arguments-of e) table)))) (define function-of car) (define arguments-of cdr) ; and (define myapply (lambda (fun vals) (cond ((primitive? fun) (myapply-primitive (second fun) vals)) ((non-primitive? fun) (myapply-closure (second fun) vals))))) (value '(lambda (x) (add1 x) 3)) builds a closure so you can see what closures actually look like (define *lambda (lambda (e table) (build (quote non-primitive) (cons table (cdr e))))) (define table-of first) (define formals-of-second) (define body-of-third) (define non-primitive? (lambda (l) (eq? (first l) (quote non-primitive)))) (define myapply-closure (lambda (closure vals) (meaning (body-of-closure (extend-table (new-entry (formals-of closure) vals) (table-of closure)))))) with this last definition, we pause to make sure everyone understands the concept of closure we now actually have a Turing-powerful programming system we will start by looking at lambda without recursion, and then see how one can use a device called the Y-combinator to implement arbitrary recursive functions."}


created_at: 2024-04-29 18:03:58
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes explaining a closure in programming, particularly a lambda function.5
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "This is the closure created by this particular lambda: \n\n general form of a closure in LISP \n\n (stable formals body) \n\n What does myapply do with this? \n\n (myapply-closure '(T . (x add1 x))  (3)) \n\n Meaning (add1 x) ((x (3))) \n\n ie - eval(add1 x)^(x) - (3)"}


created_at: 2024-04-29 18:04:25
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: This is a transcription of programming code and notes hand-written on a paper.6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(define list-to-action\n(lambda (e)\n  (cond\n    ((atom? (car e))\n      (cond\n        ((eq? (car e) (quote quote))\n          *quote)\n        ((eq? (car e) (quote lambda))\n          *lambda)\n        ((eq? (car e) (quote cond))\n          *cond)\n        (else *application))))\n; with\n(define *application\n  (lambda (e table)\n    (myapply\n      (meaning (function-of e) table)\n      (evals (arguments-of e) table))))\n(define function-of car)\n(define arguments-of cdr)\n; and\n(define myapply\n  (lambda (fun vals)\n    (cond\n      ((primitive? fun)\n        (myapply-primitive\n          (second fun) vals))\n      ((non-primitive? fun)\n        (myapply-closure\n          (second fun) vals)))))\n(define *lambda\n  (lambda (e table)\n    (build (quote non-primitive)\n      (cons table (cdr e)))))\n(define table-of first)\n(define formals-of second)\n(define body-of third)\n(define non-primitive?\n  (lambda (l)\n    (eq? (first l) (quote non-primitive))))\n(define myapply-closure\n  (lambda (closure vals)\n    (meaning (body-of closure)\n      (extend-table\n        (new-entry\n          (formals-of closure)\n          vals)\n        (table-of closure))))\n(value '((lambda (y)\n  (lambda (x) (cons x y)))\n  3\n  4))\n(value '((lambda (x) (add1 x))\n  ((lambda (x) (add1 x)) 4)))\n; emerging (lambda x)(add1 x)) (5)\n; via list-to-action to *application, then to myapply\n; ?\n; This punctuation can even occur?\n; No"}


created_at: 2024-04-29 18:04:41
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes on programming concepts and exercises.7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "\n(cmyapply meaning (lambda (x) (add1 x)) '(3))\nmeaning => (evals ((lambda (x) (add1 x)) 3) => 4))\n\n(cmyapply-closure (non-primitive (G (x) (add1 x)) 1))\n(5)\n\n(meaning (add1 x) ((x 5)))\n\n(value '((lambda (y)\n          (lambda (x) (cons x y))))\n  3)\n  4)\n\nconjecture\nwe expect at some point to see a\ntable with 2 cols:\n\n  (x)     (3)\n  (y)     (4)\n\nWork this out first by hand,\nas we've been doing -- and\nthen check your computation by 'instrumenting'\nthe #!scm code with display and newline\n"}


created_at: 2024-04-29 18:05:04
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
The image contains computer code in a functional programming language and various handwritten annotations clarifying certain aspects of the code.8

metadata:
{"source": "pdf", "chroma:document": "(define list-to-action\n(lambda (e)\n(cond\n((atom? (car e)) quote)\n(cond\n((eq? (car e) (quote quote)) *quote)\n((eq? (car e) (quote lambda)) *lambda)\n((eq? (car e) (quote cond)) *cond)\n(else *application))))\n\n; with\n\n(define *application\n(lambda (e table)\n(myapply\n(meaning (function-of e) table)\n(evlis (arguments-of-e table)))))\n\n(define function-of car)\n(define arguments-of cdr)\n\n; and\n\n(define myapply\n(lambda (fun vals)\n(cond\n((primitive? fun) (myapply-primitive (second fun) vals))\n((non-primitive? fun) (myapply-closure (second fun) vals)))))\n\n; also defines lambda handling\n\n(define *lambda\n(lambda (e table)\n(build 'quote-non-primitive\n(cons table (cdr e)))))\n\n(define table-of-first)\n(define formals-of-second)\n(define body-of-third)\n(define non-primitive?\n(lambda (l)\n(eq? (first l) (quote non-primitive))))\n\n(define myapply-closure\n(lambda (closure vals)\n(meaning (body-of-closure) (extend-table (new-entry (formals-of-closure) vals) (table-of-closure))))\n\n; example of evaluation:\n(value '((lambda (x z)\n(cons x\n((lambda (x y) (cons z x)) 3 4)\n) 1 2)))\n\nHandwritten notes:\n'Will pick up here tomorrow'\n'Take what this x is evaluated to'\n'x z \u2192 (x z)'"}


created_at: 2024-04-29 18:05:19
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes discussing programming concepts related to lambda calculus and table operations in a computational context.9

metadata:
{"source": "pdf", "chroma:document": "need an interesting conjecture on the tables which appear as this computation proceeds. Perhaps (x y) + (13 47)? Table for (x+z) = '1 2') inner lambda. Will we see the table both grow and shrink? Hmmm... looks like growth, but no shrinkage. Leads to your asking: how could the program be modified so that we see both growth and shrinkage? (value '(lambda (x z) (cons x (lambda (x y) (cons z x))) 3 4)) - maybe a and a subsequent reference to x?? Consider the inner lambda. (value '((lambda (x z) cons (lambda (x y) cons z x)) 3 4 1 2))"}


created_at: 2024-04-29 18:05:32
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Description of Scheme code example and commentary10
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; next, let's translate the following simple illustration of a closure to tls-scheme\n\n(let ((x 3))\n  (let ((x 4)\n        (f (lambda (y) (+ y x))))\n    (f 2)))\n\n; to get\n\n(value '((lambda (x)\n           ((lambda (x f) (f 2))\n            4\n            (lambda (y) (+ y x))))\n         3))\n\n; you see that tls-scheme features lexical scope and first-class functions --\n; after you have had some time to think about how one might go about\n; certifying that TLS correctly implements\n; lexical scope and first class functions, I will describe proof outlines in class,\n; and then ask you to write\n; up the arguments for homework. Big surprise: induction is involved."}


created_at: 2024-04-29 18:05:47
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Hand-written lecture notes on Tree Recursion focusing on Fibonacci sequence0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Class 9 CSC 335 February 27 and 29 2024\n\nTree Recursion\n\nThe first example is one that CS-1 text book writers love to use to discredit the whole idea of recursion. We compute the nth Fibonacci number, where the Fibonacci numbers are\n\n0 1 1 2 3 5 8 13 21\n\nusually with 0-based indexing\n\n0 1 2 3 4 5 6 7 8\n\nOur program is to input an integer n >= 0 and return the nth Fibonacci #\n\ndefine (fib n)\n  cond ((zero? n) 0))\n       ((one? n) 1)\n       (else (+ fib (- n 1)) (fib (- n 2)))\n       )\n\nThis is just the scheme version of the definition (so not focussing here on hw development)\nbut it nonetheless brings up some interesting points."}


created_at: 2024-04-29 18:05:58
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on recursion in programming1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "First: how do we deal with a 2-case basis step? Basis step: any computation done without a recursive call.\n\nSecond question: how do we deal with two recursive calls?\n\nLet's do the second: as before, we may assume that the recursive calls work correctly PROVIDED the precondition is satisfied when the calls are made\n\n-> need n-1 >= 0 is an integer when (Fib(n-1)) is called\n-> need n-2 >= 0 is an integer when (Fib(n-2)) is called\n\nSo the program computes the nth Fib # for n >= 2, as the sum of the (n-1)st and (n-2)nd numbers."}


created_at: 2024-04-29 18:06:07
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This is a handwritten note discussing a programming concept related to recursion in calculating Fibonacci numbers.2

metadata:
{"source": "pdf", "chroma:document": "and (n-2)nd fib # - which is correct.\nFor the basis step, one must show the correctness of each case separately.\n\nThis seems easy enough - so why the abuse heaped on this poor program?\nThe reason is that it is extremely inefficient - bad recursions are indeed to be avoided (but this does not mean that recursion is to be avoided)."}


created_at: 2024-04-29 18:06:18
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Transcribed text from the educational handwritten note discussing inefficiencies in recursive function calls, specifically the Fibonacci sequence.3

metadata:
{"source": "pdf", "chroma:document": "The inefficiency can be seen in a pattern of calls expansion. E.g.: \n\nfib5        fib5\n    \\        /\n    fib4  fib3\n      \\   /     \\   /\n     fib3 fib2 fib2 fib1\n   /    \\    /    \\ \n fib2 fib1 fib1 fib0\n\nThe problem is that so many computations are duplicated. This program requires exponential time -> idea for proof is to count the number of times fib0 and fib1 are computed."}


created_at: 2024-04-29 18:06:26
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing programming techniques4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Could use memoization to store previously computed results to improve efficiency - but of course this requires assignment. \n\nLet's next develop an iterative Fibonacci program.\n\n(At the board)"}


created_at: 2024-04-29 18:06:34
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This is a transcription of code written in Scheme programming language for calculating Fibonacci numbers.5

metadata:
{"source": "pdf", "chroma:document": "(define (fib n)\n\n(define (fib-iter curr prev count)\n  (cond ((= count n) curr)\n        (else (fib-iter (+ curr prev) curr (+ count 1)))))\n\n(cond ((= n 0) 0)\n      ((= n 1) 1)\n      (else (fib-iter 1 0 1))))\n\n; what are the design roles of curr and prev?\n; what is the invariant? is this version correct?"}


created_at: 2024-04-29 18:06:46
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing termination arguments in programming and mathematical conjectures.6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Question: are termination arguments always so easy? Collatz conjecture\n\nNo - go ahead and search for the '3n+1 problem' for an example of an apparently simple while loop with completely unknown termination properties.\n\nBut even here - for the recursive fib program - while it is clear that the fib (n-1) + fib (n-2) calls will stop - can we be equally sure that new (fib (- n 2)) calls will stop?\n\nMaybe we just blow through the stopping cases!\n\nSee if you can work this out."}


created_at: 2024-04-29 18:07:01
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes regarding homework and class developments0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Class 10 and HW5 CS 335 Sections M & R\n\nDevelopments \u2014 which you should attempt before\nhand \u2014 to be sketched in class\n\n1. Recursive and iterative procedures to decide\nwhether an integer n \u2265 0 is sorted\n(i.e whether its digits occur in non-decreasing\norder)\n\n2. Recursive and iterative procedures to return\nthe number formed from an integer\nn \u2265 0 by sorting the digits of n.\n\u2192 insertion sort\n\u2192 selection sort\n\n3. Recursive and iterative procedures\nwhich input integers m \u2265 0 and n \u2265 0\nand which decide whether all the\ndigits of m occur in n, in the same order.\n\n4. Recursive and iterative procedures which\ninput an integer n \u2265 0 and a\ndigit d and which return the\nnumber obtained from n by removing the\nleftmost occurrence of d."}


created_at: 2024-04-29 18:07:16
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about a programming class0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Classes 1 and 2 January 25 and 30, 2024\n\nWe begin by describing the purely functional sublanguage of R5RS-Scheme\n\nPurely functional means no assignment and, more generally, no destructive programming; after initial definition, values are not changed or destroyed.\nWe focus on what is called declarative programming, in contrast to the imperative programming style.\n\nAt the basis of this language are a few primitive data types. Finally, we'll make use of just three of these:\n- numbers\n- booleans\n- functions\n\nNumbers can be integers, rationals, or reals (complex, too, but we won't use those)\nintegers: 'infinite' precision\nrationals: 1/3 displays as 1/3, not as 0.333333...\nreals: subject to same precision limitations as in C"}


created_at: 2024-04-29 18:07:32
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about programming concepts1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Booleans are just #t (true) and #f (false) not themselves defined. This is one difference between R5RS and the version of MIT Scheme used in Abelson & Sussman (SICP). They use nil for #f as well as for the empty list. Note that nil is not even defined in R5RS. Functions come in two main flavors \u2013 primitives and user-defined. For this introductory look at the basis of R5RS, we\u2019ll focus on the arithmetic primitives. Examples of these are +, -, *, /, modulo, quotient, remainder, etc. I urge you to get in the habit of taking incremental reads of the R5RS manual where you will find a complete list of new primitives. Numbers, Booleans and primitive functions can be said to be self-evaluating: type one in, and get it back unchanged."}


created_at: 2024-04-29 18:07:42
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes discussing programming concepts2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "We can (of course) use these primitives to form more complex expressions. Before showing some of these, let me emphasize the critical role of parentheses in Scheme. Unlike their usage in math papers, where they are NOT just for the convenience of the reader. When we write\n(+ 2 3)\nFor example, the parens are regarded as an instruction:\n\u2022 evaluate the leftmost entry - throw an error if its value is not a function\n\u2022 evaluate the remaining entries\n\u2022 apply the value of the leftmost entry to those values\n\u2022 return the result"}


created_at: 2024-04-29 18:07:53
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: A handwritten note discussing programming language primitives and behavior.3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "For (+ 2 3) + evals to the built-in + function, 2 evals to the internal representation of 2, and 3 to the internal rep. of 3 - The application then returns 5, \n\nSimilarly for (* 5 2) returns 10 and (< 10 2) returns False and so on. \n\nInterestingly, these primitives are generic, in at least two ways. \n\nFirst (unlike C ), + is happy to accept reals and rationals as well as integers; indeed, even mixtures of them \n\n(* will record that these lectures moved over to racket for some examples.)"}


created_at: 2024-04-29 18:08:07
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This is a transcription of handwritten notes discussing programming concepts related to generics and type tags.4

metadata:
{"source": "pdf", "chroma:document": "Main takeaways from first excursion: generic and regards numeric types (i.e., we do not need separate functions for int, real, rat, etc.) and allows mixed types. Despite the absence of user-created type tags, types dynamically detected at runtime are nonetheless present \u2013 one cannot compute (+ #f #f), for example \u2013 the primitive + requires that its arguments be numbers. A second kind of genericity has to do with the number of arguments. Main takeaways from second excursion: Generic also as regards the number of arguments \u2013 e.g., (+ 1 2 3) computes 6. The idea is that + regards its args as a list, and it returns the sum of the numbers in that list. On this mode, (+) ought also"}


created_at: 2024-04-29 18:08:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Transcription of handwritten text discussing arithmetic operations and evaluation rules in programming.5

metadata:
{"source": "pdf", "chroma:document": "make sense and indeed (+) returns 0 --- the sum of all the numbers in the empty list. Similarly for the other arithmetic primitives? Explore! Note that (*) returns 1, not 0, in line with mathematical convention. Even more complex expressions can be formed if we nest parens. For example, (+ (* 3 4) 2) is eval'd using the same rule (the Scheme Evaluation Rule) . + evals to the builtin + function (call it plus) . 2 evals to two"}


created_at: 2024-04-29 18:08:25
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten mathematical notation and explanation6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The rule is applied recursively to get the value 12 for (* 3 4). So (+ (* 3 4) 2) = 14. There is no limit on how nesting depth, but as these expressions become larger, it will be helpful to have a simple visualization for them. We use: traveled in the expected way: * / \\ 3   4 + 2"}


created_at: 2024-04-29 18:08:37
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about evaluation order in programming.7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "It is important to know that one should not expect that t evaluates its args in left to right order, In fact, we know nothing at all about the eval. order except that the arguments to a function (as well as the function itself) must have been evaluated before the function can be applied. In fact, this is the ONLY notion of order which matters for this kind of programming. As you will soon see, this explains why the semicolon (;) has in Scheme."}


created_at: 2024-04-29 18:08:48
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Discussion of functional languages with reference to C and Scheme exemplifying evaluation of functions and arguments.8

metadata:
{"source": "pdf", "chroma:document": "For any functional language, noting the importance of this in C. Essentially, 'before and after' are concerns in Scheme only as they apply to the evaluation of a function and its args before the function can be applied to these arguments. In other words, P; Q (i.e., 'do P, then Q') makes NO sense in pure functional Scheme. We will see how function composition makes up for this; assuming..."}


created_at: 2024-04-29 18:08:54
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Mathematical notes about composable functions9
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "f and g are composable functions\n(f\u2022g)(x) = f(g(x))\n\nNext, let's look at\nvariables."}


created_at: 2024-04-29 18:09:05
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes on programming concerning the use of the 'define' form in Scheme programming language.10

metadata:
{"source": "pdf", "chroma:document": "We'll get at variables via the special form define.\n\nFor example\n\n(define x 3)\n\nWe say that define is a special form because the 'scheme Evaluation Rule' discussed last time does not apply for define.\n\nSo - how does define work?\n\nInitially, scheme opens a global namespace in which the primitives (etc.) are defined, but no user variables are defined.\n\n(initial (empty) environment)\n\n-> (define x 3) ->\n\nx : 3\n\nWe write x : 3 to indicate that x is a name of the value 3."}


created_at: 2024-04-29 18:09:16
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes explaining variable binding and scope in programming11
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "We say 'x is bound to 3'. Another suggestive picture is\n\nx -> 3\n\nIf we were now to\n\ndefine y 3\n\nthen the global env would be\n\n| x: 3 |\n| y: 3 |\n\nwith x -> 3 as the corresponding\n\npointer diagram.\n\nOnce (define x 3) has been evaluated, then, within the scope\n\nof this defun, you may replace all occurrences of x by 3 without\n\nchanging the meaning of the substituted expression."}


created_at: 2024-04-29 18:09:27
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten mathematical and programming notes12
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(define x 3) \n\n(+ x 4) \n\nmeans (+ 3 4) : anywhere x occurs, we can replace it with a 3. This illustrates referential transparency. \n\nSo what? Well, consider the contrast with C. After the declaration \n\nint x = 3; \n\nconsider \n\nx = x + 1; \n\nCan we replace x by 3 without wrecking the meaning? Clearly not. \n\nWhat's responsible for the difference?"}


created_at: 2024-04-29 18:09:40
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Explanation of how variables and memory locations work in the C programming language, including a contrast with the Scheme programming language regarding variable scoping.13

metadata:
{"source": "pdf", "chroma:document": "In C, x is NOT a name for 3 after this initialization\u2014rather it is a name for a box (memory location) containing 3.\nx -> [3]                                   x -> 3\n\n\nin C                                       in Scheme\n\n(*) In scheme, as in C, scopes frequently have \"holes\" typically brought about by local variables\n\nlocal scope                                       global scope\n    local scope"}


created_at: 2024-04-29 18:09:49
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Transcribed text from a handwritten note about changing variable 'x' and its scope in a programming context14

metadata:
{"source": "pdf", "chroma:document": "One way of changing x and its scope:\n\n(define x 3)\n\nscope of x\nin head, x names 3\n\n(define x 4)\n\n(new) scope of x\nin HEAD, x names 4\n\nHey! Why isn't this just assignment?\nWell, it is: it is definitional assignment, making an association between x and its value.\nBut it is extremely restricted, and Scheme in no way allows anything"}


created_at: 2024-04-29 18:09:59
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing programming concepts related to the 'define' statement.15
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "equivalent to x = x + 1. In particular, define cannot occur within an expression nor in the body of a program.\n\nWhat haven't we explained yet about define?\n\nWhat about (define x (+ x 1))?\n\nThis would assume that x has already been defined. The eval rule for (define x e) is something like\n\n(1) install x in the global env, perhaps without a value."}


created_at: 2024-04-29 18:10:07
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about a programming or computational concept16
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "x: ?\n\n2) Evaluate e to get its value, say v\n\n3) Finish the binding - so that when the eval. of the def is complete, we would have x: v\n\nTake a moment to think why the standard evaluation rule would not work for 'define'."}


created_at: 2024-04-29 18:10:17
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming concepts with specific examples.17
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(define x e)\nThe standard rule would say\nstandard rule\n   eval: The primitive define\n   eval x (but x is usually\n   here being defined\n   for the first time) -->\n   so x has no value!\n   eval e\nOnce a variable has been bound to\na value, we can use it anywhere\nwe like as (eg) a shorthand for\nthat value. often\n(define pi 3.1415 ...)\nwe could write (+ 2 pi)\n(+ 2 (* 3 pi))\n.\n.\n."}


created_at: 2024-04-29 18:10:24
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Written example of defining variables in code and a query about their use18
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Another example\n(define x 17)\ncould we then write\n(define y x) ?\nYES!\ny: ?\nx: 17"}


created_at: 2024-04-29 18:10:35
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten text explaining the programming concepts related to 'define' in functional programming19

metadata:
{"source": "pdf", "chroma:document": "We talked about the special form define - but although I mentioned the severe restrictions on the use of define, I still need to give you an example of forbidden usage of define in an expression. Here's one (+ (define x 3 ) 2) You can use the Check Syntax button in Dracket to see the explanation of why this won't work. Recall the C distinction between expressions and statements. Pure functional scheme does not have statements. So this restriction on define is very strong. Should also have mentioned that 'define' may not be used as a variable \u2013 it is a reserved word (***)"}


created_at: 2024-04-29 18:10:46
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about identifier rules in Scheme programming language20
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Just about any combination of numbers and characters can be used to form identifiers in Scheme. There are some restrictions\n- no embedded white space\n- no embedded parens\n- perhaps others, but I am not thinking of them just now\nBy default, Scheme does not differentiate upper and lower case letters.\nYou will find the complete set of rules in the R5RS reference manual, which I have posted on Teams."}


created_at: 2024-04-29 18:10:58
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about the lambda function in Scheme programming language.21
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Another special form is lambda. When we enter (lambda (x) (* x x)) in R5RS, the system returns #procedure. We conclude that the lambda form is a 'stand-alone' Scheme value. In fact, such forms are Scheme values in the same sense that, e.g., numbers and booleans are Scheme values. We will see that, just as numbers and booleans can be returned by function calls, so too can functions be returned by function calls. In fact, functions can occur as components of data structures - e.g., we will see lists of functions. One says that, in Scheme, functions are first class."}


created_at: 2024-04-29 18:11:08
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming concepts related to lambda functions22
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "It's useful to take the lambda form apart:\n\nlambda (x) (* x x)\n\nlambda is a reserved word\n\nformal parameter list\n\nlambda body (G**)\n\nlambda (x y) (* x y) local\n\nThe formal parameters each open a scope, which is precisely the body of the lambda form.\n\nReturning to the lecture discussion, these scopes can be said to be holes in any containing scope of the same variable.\n\nFor example:"}


created_at: 2024-04-29 18:11:18
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming and scopes23
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "define x 1\nThis x is 1\n(lambda (x) (+ x 2))\nThis x is 4\n(define x 6)\nThis new x is 6\nYou will want to experiment...consider\ndefine x 2\n(lambda (x) (+ x 2))\n(lambda (x) (+ x 3))\nWhat is the value of this x?\nThe value is 1\nValue returned by this application\n(+ 4 2) = 6"}


created_at: 2024-04-29 18:11:38
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming concepts involving lambda functions and application form.24
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(Anything of the form\n(fn arg1 arg2 ... argk)\nis said to be an application.)\n\nNote that define and lambda play nicely together:\n\n(define square\n    (lambda (x) (* x x)))\n\nAbelson & Sussman notation for this function definition is\n\n(define (square x)\n    (* x x))\n\nThey prefer to not write the lambda.\n\n(This is the first instance we've seen of what is called syntactic sugar)"}


created_at: 2024-04-29 18:11:45
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten text about programming evaluation rules25
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Having defined square this way, one uses it as follows\n\n(square 2)\n\nBy the scheme eval-rule, square would be evaluated to\n\n(lambda (x) (* x x))\n\nand then the evaluation continues as we have described, via the substitution rule - substitute the value of the actual parameter, 2, for the formal parameter, x, everywhere x occurs in the lambda body."}


created_at: 2024-04-29 18:11:59
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
The content consists of handwritten notes discussing various topics related to functions in programming.26

metadata:
{"source": "pdf", "chroma:document": "Still to discuss in connection with functions:\n- type checking\n- what is a function value?\n- can we have an operational description of function evaluation?\n- what happens if there is an undefined variable in a lambda body?\n- how can functions be composed?\n- your questions\n\nMentioned in class while using DrRacket:\n- newline\n- display\n\nThese primitives can be useful in understanding Scheme - allowing simple instrumentation of our programs (eventually and now) of our interactions with the language.\n\nI will summarize my use of them momentarily. First however, it is important to know that neither of the calls\n\n(newline)\n(display e)\n\n(where I assume e has been given a value previously) return a value which can be input to another function."}


created_at: 2024-04-29 18:12:36
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes about coding, including examples of codes and explanations27
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "If one attempts (+ (display 1) 2) for example an error will be thrown - complaining about the fact that (display 1) returns no useable value. All it does is print 1 to the screen (that's the side-effect).\n\nThat being said, here is an annotated copy of an interaction with racket\n\n(define x 1) ;entered into a fresh window\n(newline)\n(display x) ;see what happens when\n(newline) ;you remove the newlines.\n\nx is 2 in the local scope\n\n(lambda (x y) (+ (+ x y 2)) x) 2 4 opens a local scope for x and y\n\n(newline)\n(display x) ; local scope has disappeared\n(newline) ; and x is again 1.\n\n(define x 17)\n(newline) ; now x is 17 in the global\n(display x) ; scope: there is no record\n(newline) ; of it ever having been 1\n\nSimilarly, there is no record of x ever having been 2 ; you cannot reach back into a scope"}


created_at: 2024-04-29 18:12:50
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes discussing programming concepts related to function arguments and error messages.28

metadata:
{"source": "pdf", "chroma:document": "What if, at the end of this session, we were to ask for a display of the value of 'y'? An error message, complaining about 'y' being undefined, would be shown.\n\nWhat about writing just 'y', instead of '(display y)'? Same error; 'y' has first to have some form display can evaluate its argument to.\n\nNote that display takes only a single argument: R5RS does not have the primitive corresponding to printf.\n\nYou are familiar with side-effects in C, though it is possible that this term was not used to describe them.\n\nConsider what you can do with a function parameter that has been passed by reference: from inside the function, you can change the ('external') value of that parameter."}


created_at: 2024-04-29 18:13:00
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes explaining lambda functions in programming29
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Such a change is said to be a side-effect of the function call. \n\n(x:x) There is no requirement that all of the formal parameters actually occur in the lambda body. Eg \n\n((lambda (x y) x) 17 18) \n\nmakes perfect sense, and returns 17. \n\nIndeed, there is no requirement that ANY of the formal parameters occur in the function body. Eg"}


created_at: 2024-04-29 18:13:13
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes related to lambda expressions in programming30
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "((lambda (x) 3) 8) will return 3. This is said to be a constant function. Perhaps a better way to write such a function might be (lambda () 3) with calls having 0 actual parameters. Note also that we may not write lambda forms with duplicated parameters - e.g. (lambda (x x) x) is not accepted by the reader."}


created_at: 2024-04-29 18:13:25
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Describing the use of terminology and the function of formal and actual parameters in programming.31

metadata:
{"source": "pdf", "chroma:document": "(****) I will use standard terminology to describe parameters: in the call ((lambda (x y) (+ x y)) 2 3) x and y are the formal parameters and 2 and 3 are the actual parameters (****) The number of actual parameters is set by the definition of the function, and any call with a different number of actual params than the number of formal params will be flagged as an error. This is true for C++, as well; it is a type error."}


created_at: 2024-04-29 18:13:34
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: This is a handwritten note detailing class sessions and schedules for CSC335.0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "CSC335 Class 12 March 7 2024\nQuiz 2\n(Full Period)\n\nCSC335 Class 13 March 12 2024\nTowards Higher Order Procedures"}


created_at: 2024-04-29 18:13:49
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This is a handwritten note that contains a discussion of a recursive summation procedure along with mathematical notation and feedback.1

metadata:
{"source": "pdf", "chroma:document": "; Consider the summation procedure sigma: \n; pre: a and b are integers \n; post: returns \u2211 i from a to b of i \n(define (sigma a b) \n(cond \n((> a b) 0) \n(else (+ a (sigma (+ a 1) b))))) \n; this is a recursive program, but the induction is a bit different from what we have seen so far \n; in that we will induct on the size of the gap between a and b: \n\nWhy? Suppose we were to say in \nproof by induction \non a \"program is \nthat a is increasing \nand so the \nprogram is \nsmaller than \nprovided a<b, the gap between \nand b. So this METRIC is variable. \nwould be for \nfor an induction. \n\nYour documentation should include \nThe definition you have in mind for \ngap(a,b) \n\nSuggested hw\n\nWould ((= a b) 0) be better? \nWell, NO: when a = b, ans' needed for a."}


created_at: 2024-04-29 18:13:56
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: This is a handwritten note containing code and some instructions or thoughts.2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Code for this design is easily seen to be\n\n(define (sigma a b)\n  (cond ((> a b) 0)\n        (else (+ a (sigma (+ a 1) b)))))\n\nMight we instead keep a fixed and induct on b?\nWork out the details!\nWork out the program!"}


created_at: 2024-04-29 18:14:14
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes about higher-order functions and functional programming3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Higher-order functions \u2014 some motivation\n\nWe've discussed :\n\n(define (sigma a b)\n  (cond ((> a b) 0)\n        (else (+ a (sigma (+ a 1) b)))))\n\nand one notices that this pattern occurs frequently. For example, we can compute\n\n\u2211i from a to b i\n\nusing\n\n(define (sum-of-squares a b)\n  (cond ((> a b) 0)\n        (else (+ (square a) (sum-of-squares (+ a 1) b)))))\n\nAlso -\n\n(define (sum-of-cubes a b)\n  (cond ((> a b) 0)\n        (else (+ (cube a) (sum-of-cubes (+ a 1) b)))))\n\nWhen a functional programmer detects a pattern like this, he/she asks whether one program might be made to do\nThe work of all three.\n\nIn fact, this is easy to do: one introduces a function\nparameter and calls the new function with values\n(lambda (x) x), square, and cube for that parameter"}


created_at: 2024-04-29 18:14:27
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on programming concepts4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Define generalized-sigma a term b)\n(cond ((> a b) 0)\n      (else (+ (term a)\n            (generalized-sigma (+ a 1)\n                               term\n                               b)))))\n\nNow we obtain sigma using generalized-sigma\n\n(define (sigma a b)\n    (generalized-sigma a (lambda (x) x) b))\n\nand sum-of-squares\n\n(define (sum-of-squares a b)\n    (generalized-sigma a square b))\n\nand sum-of-cubes\n\n(define (sum-of-cubes a b)\n    (generalized-sigma a cube b))\n\nThis is one nice way of achieving software reuse -\nhere, for example, only generalized-sigma would\nneed to be stored in a function library, rather\nthan sigma, sum-of-squares and sum-of-cubes"}


created_at: 2024-04-29 18:14:41
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten text regarding a concept in programming or mathematics5
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "generalized-sigma is said to abstract the functions sigma, sum-of-squares, and sum-of-cubes.\n\nIs this all there is to do? Does introducing this new variable have any impact on the proofs we write? Looking at the code you can see that it does \u2013 we need to check the interface between term and generalized-sigma.\n\n(define (generalized-sigma a term b)\n  (cond ((> a b) 0)\n    (else (+ (term a)\n              (generalized-sigma (+ a 1) term b)))))\n\nYou can see that term needs to be a function from [a, b] \u2192 Numbers \u2013 otherwise makes no sense.\n\nMoreover, you can see that (term i) needs to terminate for each i in [a,b] - for otherwise we cannot make any promises about the termination of generalized-sigma.\n\nSo we should perhaps look at how one would write a proof for a function with a function parameter."}


created_at: 2024-04-29 18:14:59
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten text from a mathematics-related note6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Just as we want our function library to contain just the most general version of sigma, so also would we like to write just one proof. In particular, we do not want to be forced to write a proof for each possible value of term. (Can you see other values of term which would be acceptable? fourth-power? Maybe sqrt? Maybe ... our catching that pattern is very much more powerful than just generalizing the functions we started with) Can you see what the qualifications for term values must be? Those qualifications are precisely the specification for term; if the proof we file is to be as useful as the function, then the pf should not refer at all to particular choices for term \u2014 e.g. not to square or to cube \u2014 but just to the specification of term. In other words, we want the proof to be abstract in the same sense that the code is abstract."}


created_at: 2024-04-29 18:15:11
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: This is a transcription of handwritten mathematics notes.7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Let's sketch a proof for generalized n-sigma\ndefine (generalized-sigma a term b)\n  (cond ((> a b) 0)\n        (else (+ (term a)\n                (generalized-sigma (+ a 1)\n                               term\n                               b))))\nAs for sigma (see earlier notes), we can\norganize the proof as an induction on gap(a, b)\n\nwhere gap(a, b) = { 0 if a > b\n                    b-a otherwise\n\nWe focus just on the nth :\n\n'The recursive call works correctly,'\nie\n\ngiven the pre-conditions\n(generalized-sigma (+ a 1) term b)\ncorrectly computes\n\n     b\n   \u03a3 term(i)\n   i=a+1"}


created_at: 2024-04-29 18:15:22
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about mathematical term properties and generalized sigma summation8
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "For this to make sense, term must be compatible with + (i.e., \u03a3) and the values term(i) must all be defined (i.e., term i) must terminate.\n\nThese are the ONLY requirements we impose on term.\n\nThe spec for generalized-sigma has - in the spec for sigma - requirements for term\n\npre: a \u2264 b and a, b are integers\n    and\n    for each a\u2264i\u2264b, term(i) is\n    compatible with +\n\npost: returns \u03a3 term(i)\n           i=a\n\nTermination argument also requires that (term i) returns a value for each i \u2208 [a, b]"}


created_at: 2024-04-29 18:15:33
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten text related to theoretical concepts and properties9
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "To put this another way - the user who wishes to use generalized-sysm must guarantee as b , a and b integers, AND that term has the properties required by the precondition. All of square, cube, fourth, sqrt -- have those properties. Notice that our proofs - both of partial correctness and termination - rely on the fact the evaluating (term a) does not change a or b. We know this because our functions have no side-effects. In C, you'd need to add this requirement to the precondition."}


created_at: 2024-04-29 18:15:44
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about a function10
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "We can go even further with this usage of function parameters. Suppose, for example, that we wanted to compute the sum of the odds between a and b. We'd need of course to worry about the parity of a and b, but surely there is no need to lock a up by 1 at each step \u2014 why not have a step size of 2? This suggests\n\n(define (even-more-general-sigma a term b next)\n  (cond ((> a b) 0)\n    (else (+ (term a)\n      (even-more-generalized-sigma\n        (next a) term\n        b next)))))"}


created_at: 2024-04-29 18:15:57
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten text in the image11
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "where a possible value for next is\n\n(lambda x)(+ x 2)\n\nYou should develop a specification for the function\nnext - and indeed, for this entire procedure.\n\nPay particular attention to the requirements\nimposed by termination!\n\nFor example, you might want to require\nthat gap (next (a), b) < gap (a,b)\n\nBut in fact - though the mechanism would need to\nbe adjusted - all you would need is that\nnext reduces the gap after a bounded\nnumber of calls..."}


created_at: 2024-04-29 18:16:13
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of programming code and comments written on lined notebook paper12
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Now consider an iterative version\n\n(define (sigma a b)\n\n(define (iter a result-so-far)\n(cond ((= a b) result-so-far)\n(else (iter (+ a 1) (+ (+ a 1) result-so-far))))))\n\n(cond ((> a b) 0)\n(else (iter a a))))\n\n; with guess-invariant for iter as follows:\n; a <= b AND result-so-far = sum of all integers i\n; from A up to a, A <= i <= a, where A is the\n; original value of the parameter a"}


created_at: 2024-04-29 18:16:24
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes related to programming or mathematical analysis13
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Let's check the G_i:\nstrong_enough? When a=b, this sum result_so_far is the sum from A up to and including b - which is correct.\nweak_enough? We need to check the fact that \u2211 from i=a to a is a and check if this is true.\nIs it preserved? Yes, given the code and the fact that \u2211 from i=a to b is a + \u2211 from i=a+1 to b.\n\nSuggested Exercise\nWhat changes are needed if result_so_far is initialized to 0 rather than a?"}


created_at: 2024-04-29 18:16:35
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes primarily about functional parameters in computing, along with a pseudocode section.14

metadata:
{"source": "pdf", "chroma:document": "We can go even further with this usage of function parameters. Suppose, for example, that we wanted to compute the sum of the odds between a and b. We'd need of course to worry about the parity of a and b, but surely there is no need to lock a up by 1 at each step \u2014 why not have a step size of 2? This suggests\ndefine even-more-general-sigma\n(an term b next)\n(cond ((> a b) 0)\n(else (+ (term a)\n(even-more-generalized-sigma\n(next a) term\nb next))))"}


created_at: 2024-04-29 18:16:46
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes about a function and its requirements focusing on termination and behavior adjustments.15

metadata:
{"source": "pdf", "chroma:document": "where a possible value for next is\n(lambda (x) (+ x 2))\n\nYou should develop a specification for the function\nnext - and indeed, for this entire procedure.\n\nPay particular attention to the requirements\nimposed by termination!\n\nFor example, you might want to require\nthat gap (next (a), b) < gap (a, b)\n\nBut in fact - though the reduction would need to\nbe adjusted - all you would need is that\nnext reduces the gap after a bounded\nnumber of calls..."}


created_at: 2024-04-29 18:17:05
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes about programming concepts related to Lisp.0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Class 19 April 2024\n\nQ: append & reverse\n; append - a primitive\n\n(define (myappend l m) \n  (cond ((null? l) m)\n    (else (cons (car l) (myappend (cdr l) m)))))\n\nexample: (myappend '(1 2) '(3 4 5)) = (1 2 3 4 5)\n\n\\(obugrac\\): '\\(l\\)' is the zero -> \\(1e\n\n(myappend '()' '(3 4 5))=\n\\(\\upppa\\)\\(3 4 5\\)'\\(l\\) = (3 4 5)\n\nnot set union - look in \\(\\ads\\) ch 2 for discussion of\nrepresenting sets as lists without duplicates.. and find\nobserve (coppend '(1 2) '(3 5)) = (1 2 3 5).\n\nobserve: cdrs down first list, does nothing\nwith the second list.\n\n* Weirdness: in fact, the second argument can\nbe any scheme object - not required even to be\na pair.\n\nRuntime: \nIncrease in the length of the first argument\nCan the efficiency be improved? - e.g. by selecting\nthe shorter list for cdring down. Possibly, depending on\nthe shorter list for cdring down. Possibly, depending\non various factors."}


created_at: 2024-04-29 18:17:28
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing a programming concept with Scheme code1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "on the data set, might it be worth inverting the cost of computing (length l) and (length m)? Let\u2019s think about how this might work - noting that the result we want is not\n\nwe might try to build a solution using snoc :\n(define (snoc e l)\n  (cond ((null? l) (list e))\n    (else (cons (car l)\n                (snoc e (cdr l))))))\n\nClearly, we can compute (append l m) by \u201csnocing each element of m down l.\u201d But could this ever be more efficient than the design we gave first regardless of the relative lengths of l and m? I\u2019ll leave this for you to think about."}


created_at: 2024-04-29 18:17:42
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This is a handwritten note discussing an inductive proof related to a function called 'append' and other programming concepts.2

metadata:
{"source": "pdf", "chroma:document": "We sketch an inductive proof for append ...\n\nWhat about an iterative append?\n(define (append-iter l m)\n(define (iter remaining so-far)\n(cond ((null? remaining) so-far)\n(else (iter (cdr remaining)\n(cons (car remaining) so-far)))))\n(iter (reverse l m)))\n\nGI: append l M) =\n(append (reverse remaining) so-far)\n\nFinally, for append, we note\nAlgebraically - append is NOT commutative ~\n(append l m) \u2260 (append m l)\nAlgebraically - append IS associative"}


created_at: 2024-04-29 18:17:59
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes and code related to recursion and list manipulation in programming.3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; reverse - another primitive in R^5 R^s\n\nRecursive;\n(define (myreverse l)\n  (cond ((null? l) l)\n    (else (append (myreverse (cdr l)) (list (car l))))))\n\nwork out na pf\n1+; rec. call\nreturns the reverse\nof (cdr l)\n\nobserve\n\nmain functions\n\nreverse L E append reverse (cdr L) list (car L)\n\nFeel free to use the main functions of the same names as your scheme functions in your writeups.\n\n; quadratic time, and we wonder whether we can do better\n\nDoes everyone see this? If |L|=n, then\nThe first call to append needs time (n-1),\nThe second needs time (n-2), and so on.\nYou recall \u03a3 (i = 1 to n-1) i = O(n^2)"}


created_at: 2024-04-29 18:18:07
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes on a computer science topic, specifically about a function and a formula involving recursion and list operations.4

metadata:
{"source": "pdf", "chroma:document": "(define (myreverse l)\n(define (iter l result)\n(cond ((null? l) result)\n(else (iter (cdr l) (cons (car l) result)))))\n(iter l '()))\n;linear time, so better\n\nGI: reverse(L) = append((reverse (cdr l)), result)\n\nThis GI is of the form\ntotal work = work remaining + work done."}


created_at: 2024-04-29 18:18:23
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes and code related to a map function in programming5
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "2. note that R5RS's map primitive is more powerful than mymap - map - a function compatible with elts of the list Q (define (mymap f l) (cond ((null? l) l) (else (cons (f (car l)) (mymap f (cdr l)))))) (define (square x) (* x x)) ;examples (mymap square (1 2 3 4)) = ((square 1) (square 2) (square 3) (square 4)) -> (1 4 9 16) observe: (mymap f Q) = l & map does not change l Q B. order is preserved - i.e. - the i-th element of the returned list is (f l_i ), where l_i is i-th elt of the input list. C. Arena time if f works in constant time - more generally, if f of l_i is constant for each l_i, then the time needed is time (f Q) * |Q|."}


created_at: 2024-04-29 18:18:36
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten programming code and notes6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "3. accumulate\n(define (accumulate op init seq)\n  (cond ((null? seq) init)\n    (else (op (car seq) (accumulate op init (cdr seq))))))\n; accumulate is also known by the name foldr\n; examples ...\n(accumulate + 0 '(1 2 3 4)) =\n(+ 1 (accumulate + 0 '(2 3 4)))\nreturns (+ 2 (+ 3 (+ 4 0)))\nreturns\n(+ 1 (+ 2 (+ 3 (+ 4 0))))\n(accumulate * 1 '(2 3 4)) =\n4\nI = 1\nnote that the initial values can (and need to be) different.\n(accumulate cons '() '(1 2 3 4)) =\n(1 2 3 4)"}


created_at: 2024-04-29 18:18:51
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes on using the 'accumulate' function with 'append' in a programming context7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(accumulate append '() seq) ... ->\n\nWhat type is seq?\n\nGot to be a list of elements compatible with append -\nie - a list of lists.\n\n(accumulate append '() '((1 2 3) (4 5) (6)))\n\n\u2193\n\n(1 2 3 4 5 6)\n\nWe say that the input list had been flattened.\n\nTry: (accumulate append '() '((a b c) '(1 2 3) (4 5)))\n\nWe've changed int\n\nTry: (accumulate append '() '('((1 2 3)) ((4 5)) (6)))\n\nfr (define (flatten list-of-lists)\n   (accumulate append '() list-of-lists))\n\nYou'll see that flatten 'promotes' each sublist by 1 level (think of trees)"}


created_at: 2024-04-29 18:19:05
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Notes and code annotations regarding functional programming concepts8
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Note that accumulate does not necessarily preserve the length (etc) of the input list. It's not even required to return a list.\n\n; examples ...\n(define (mymap f l)\n  (accumulate (lambda (x y) (cons (f x) y)) '() l))\n\n;; illuminating\n(define (leftmost lst)\n  (foldr (lambda (x y) x) '() lst))\n\nCan you apply the same reasoning to explain why this is called leftmost?\n\n; may computing\n(accumulate (lambda (x y) (+ x y)) 0 '(1 2 3 4))\n\nThis is just the binary specialization of +\n\nSame as\n(accumulate + 0 '(1 2 3 4))"}


created_at: 2024-04-29 18:19:24
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Transcribed text from an image of handwritten notes about programming concepts, particularly fold functions.9

metadata:
{"source": "pdf", "chroma:document": "Subbing function to fold:\n\n; accumulate-left, or fold\n\n(define (accumulate-left op init seq)\n  (define (iter acc rest)\n    (if (null? rest)\n        acc\n      (iter (op acc (car rest)) (cdr rest))))\n  (iter init seq))\n\n; examples ...\n\n(define (elem e l)\n  (accumulate-left\n    (lambda (acc first) (or acc (eq? first e)))\n    #f\n    l))\n\n(elem 3 '(1 2 3 4 5))\n(elem 6 '(1 2 3 4 5))\n\n; check out the symmetry - compare leftmost, above\n\n(define (rightmost lst)\n  (accumulate-right (lambda (x y) y) '(0) lst))\n\nacc initially #f, so first: (or #f (eq? 3 1))\nso on the second call to iter, acc: (or #f #f)#f\nand on the third call, acc: (or #f (eq? 3 2))#f\nand on the fourth call, acc: (or #f ((eq? 3 3))#t\n\nand once acc is #t, its value does not change\n(even though we don't have early exit)\n\nWhy bother with the folds? Their importance and usefulness are hard to overstate; virtually all\nfunctions which process lists' elements-by-element\ncan be realized as folds."}


created_at: 2024-04-29 18:19:36
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes regarding the filter function in programming10
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Filter\nnot a primitive boolean function, compatibility is required\nJust\n(define (filter pred seq)\n  (cond\n    ((null? seq) seq)\n    ((pred (car seq)) (cons (car seq) (filter pred (cdr seq))))\n    (else (filter pred (cdr seq)))))\n; examples...\n(filter odd? '(1 2 3 4)) - (1 3)\nIterative or recursive?\nRecursive, because the stack might be used.\n\nsuggested for memorization\n- accumulate\n- filter\n\nYou need these at your fingertips\nif they are to be useful in\nconceptualizing problem\nsolutions."}


created_at: 2024-04-29 18:19:48
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcribed handwritten notes11
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Brief comment on the replace-nth occurrence problem (of old by new). \n\nTwo cases - either an occurrence occurs in the car of t or occurs in the cdr. \n\ncdr is the interesting case since there is no way for the recursive call on the car to communicate to the recursive call on the cdr the number of olds which were found in the car. \n\nThe nth occurrence of old in t is the 2nd occurrence of old in (cdr t). \n \nHint: count the number of occurrences of old in the car (in a separate tree traversal) - and adjust the replacement index for the cdr call accordingly. \n\nIf we had assignment to a mutually visible global variable, this would be trivial."}


created_at: 2024-04-29 18:20:05
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
The text describes a lesson on tree recursion from a computer science class, focusing on a function called 'subst*' in a programming context, including diagrammatic representations and code snippets.0

metadata:
{"source": "pdf", "chroma:document": "CSC 335 Class 18 April 2 2024\n\n1. Resume with subst* as an example of tree recursion.\nReplace each occurrence of old by new (both old and new are atoms)\n\n- a pattern in which the recursive calls are on the car and cdr\n- The divide and conquer decision is to work on car and the cdr separately\n\ndefine (subst* tree old new)\n(cond ((null? tree) tree)\n      ((atom? tree) (if (eq? tree old) new tree))\n      (else (cons (subst* (car tree) old new) (subst* (cdr tree) old new))))\n\nWhat to do with the results of the recursive calls?\nBy this point, we know subst* is to return a tree. And from that we know that the recursive calls return trees, so the question becomes: 'How do we put two trees together to get another tree.' The only option: cons."}


created_at: 2024-04-29 18:20:22
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes about programming and recursion1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Since car tree and cdr tree are proper components of tree, we may assume that the recursive calls work.\n\nA restricted form of equal? introduced as another example of tree recursion.\n\n(define same-shape?\n  (lambda (l1 l2)\n    (cond\n      ((or (not (pair? l1)) (not (pair? l2))) (eq? l1 l2))\n      (else\n        (and (same-shape? (car l1) (car l2))\n             (same-shape? (cdr l1) (cdr l2)))))))\n\nThe goal here is to identify when l1 and l2 have the same structure as trees. Their cars must recursively have the same structure, and their cdrs must recursively have the same structure.\n\nIf either l1 or l2 is not a pair, then they must be eq?. \n\ne.g. If l1 = 2 and l2 = '(2) then (eq? l1 l2) => #f and surely l1 and l2 have different structures.\n\nBut stronger, since eq (same-shape? a b) is #t for atoms a and b only if (eq? a b).\n\nSo (same-shape? (subst x a b)) = #f"}


created_at: 2024-04-29 18:20:32
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten note discussing the concept of isomorphism in trees in computer science or mathematics.2

metadata:
{"source": "pdf", "chroma:document": "Even though t and (substituting t a b) are 'tree-isomorphic'\u2014have the same shape as trees at every level\u2014they are not identical. Wait a minute! For t1: and t2:, we do have (same shape? t1, t2) = #t, even though t1 and t2 occupy different memory locations (i.e., (eq? t1 t2) = #f). So we mean logically identical, as opposed to physically identical. This is what eq? worries about."}


created_at: 2024-04-29 18:20:44
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Description of a simple interpreter for a programming language focusing on algebraic expressions3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "A simple interpreter \u2014 simple, yes, but it serves as a template for all interpreters yet to come in 335.. an evaluator. The goal is to provide an evaluator for a class of algebraic expressions; i.e., for a particularly simple programming language. As you might expect, we begin by defining the syntax of the programming language \u2014 i.e., by defining the class AExp of algebraic expressions. I say this is expected \u2014 because once we have the syntax \u2014 the structure of AExp \u2014 we more or less automatically know how to write the interpreter/evaluator/calculator. Let's say that AExp is the least class containing non-negative integers which is closed under the operations of +, *, and !, defined as follows: if e1 \u2208 AExp and e2 \u2208 AExp, then"}


created_at: 2024-04-29 18:20:57
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Mathematical notation and definitions written on notebook paper.4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(e1 @ e2) \u2208 Aexp\n(e1 # e2) \u2208 Aexp\n(e1 ! e2) \u2208 Aexp\nThis is just syntax! Nothing at all has been said about the meanings of @, #, !\nSome examples of expressions belonging to Aexp\n0, 1, 2, ...\n(1 @ 2), (1 # 2), ...\n(1 @ (1 # 2)), ...\nIn BNF, Aexp ::= non-terminal scheme infix\n(Aexp @ Aexp)\n(Aexp # Aexp)\n(Aexp ! Aexp)"}


created_at: 2024-04-29 18:21:10
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This is a handwritten note related to computer science concepts, discussing data structures, constructors, and notations used in programming.5

metadata:
{"source": "pdf", "chroma:document": "Going back to our discussion of structural induction\nThe components of, say\n((1 1 (2 # 3)) @ (4 1 5))\n\nand;\n1, 2, 3, 4, 5\n((1 1 (2 # 3))\n(2 # 3.)\n(4 1 5)\n\nNote that ((1 . . . is NOT a component - components must themselves be well-formed - ie - must belong to Aexp.\n\nIt's useful to set up Aexp as a data structure.\nData structures have constructors, selectors, and classifiers - here, we use make to define a user-interface:\n\nconstructors:\n(define (make-@ el e2))"}


created_at: 2024-04-29 18:21:21
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes and code related to data structure parsing in Scheme-like syntax6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(list e1 '( e2))\n(define (make-# e1 e2)\n(list e1 # e2))\n(define (make-! e1 e2)\n(list e1 ! e2))\nSelectors\n(define (first-operand e)\n(car e))\n(define (second-operand e)\n(cadr e))\n(define (operator e)\n(car e))"}


created_at: 2024-04-29 18:21:28
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes with code-like syntax, possibly related to programming or a pseudocode.7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "classifiers\n(define (#-exp? e)\n  (eq? (operator e) #))\n(define (@-exp? e)\n  (eq? (operator e) '@))\n(define (!-exp? e)\n  (eq? (operator e) '!))"}


created_at: 2024-04-29 18:21:43
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Lecture notes on the implementation and functions of an interpreter for Aexp, including recursion and parameter handling0

metadata:
{"source": "pdf", "chroma:document": "CSc 335 Class 18 Part 2 April 4 2024\n\nAn interpreter for Aexp using the Aexp data structure, as well as tree-recursion. This is parameterized: inputs e - Aexp. This outputs the correct value of e for or a higher postconditions. The definitions of the operators @, #, ! because it has function parameters. We name the interpreter value - The interpreter is the entity which defines the semantics (i.e., the meaning of expressions in Aexp.\n\nDefine value =\n(lambda (aexp) (cond ((actnum? aexp) aexp)\n(else cond ((@-exp? aexp) (+ (value (first-operand aexp))\n(value (second-operand aexp)))),\n ((#-exp? aexp) (# function))))\n\nThis is an example of interpretation by recursive"}


created_at: 2024-04-29 18:21:57
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes, involving programming concepts and definitions.1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "descent \n(value (first-operand aexp) \n(value (second-operand aexp))))\n\n((l-exp? aexp)\n(l-function\n(value (first-operand aexp))\n(value (second-operand aexp))))\n\nWhat are some possible definitions for @-function and !-function?\n\nWhile we could simply \ndefine @-function + \ndefine #-function * \ndefine !-function expt\n\nIt is important - and demonstrative of the basic power of interface technology - to realize\nthat these functions could be defined arbitrarily\nwithout the constraints imposed by the value\nfunction. That is: They each need to be binary\nfunctions."}


created_at: 2024-04-29 18:22:11
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes related to programming functions and mathematical operations.2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "functions returning numbers.\n\nEven this could be refactored\nif we changed the basis step\nto return some type other\nthan scheme-number.\n\nIn my notes you will find my-plus, my-times, my-=rest\nand you should to produce other examples on your\nown. To that end, I ask you to spend some time\nwith the group exercise of HW 7. I ask you\nto discover and carry out a minimal set of\nmodifications on the value function to allow\nto deal with Axiom modified so that its\nbasis code is simply lists of ones. E.g.\n\n(1)@(1) = (1)\n\n(1)@(1,1) = (1,1,1)\n\nIE - simple 'stroke notation'. One goal is to"}


created_at: 2024-04-29 18:22:21
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "NOT use base-10 numbers anywhere in your design. Another is to preserve data abstraction - you should not 'reach behind' the interface functions to work directly with the low-level representations.\n\nTo solidify your understanding of function parameters, you should also rewrite the value function so that it takes a @-function, #-function and $-function as parameters. Notice that doing so brings the function into alignment with the spec we gave.\n\nCan we in fact make even greater use of higher-order functions to further improve the value function?"}


created_at: 2024-04-29 18:22:31
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing the implementation of Lisp functions.4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Now consider the following function:\n(define atom-to-function\n  (lambda (x)\n    (cond ((eq? x 't) t-function)\n          ((eq? x '#) f-function)\n          (else l-function))))\n\nWe can use this to improve value:\n(define value\n  (lambda (aexp)\n    (cond ((anatum? aexp) aexp)\n    (else\n      (atom-to-function (operator aexp))\n        (value (first-operand aexp))\n        (value (second-operand aexp))\n    ))))"}


created_at: 2024-04-29 18:22:51
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes on programming0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "CSc 335 Class 20 April 9 2024\n\n; enumeration\n(define (enumerate-interval low high)\n(if (> low high)\n'()\n(cons low (enumerate-interval (+ low 1) high))))\n\n(define (enumerate-tree tree)\n(cond ((null? tree) '())\n((not (pair? tree)) (list tree))\n(else (append (enumerate-tree (car tree)) (enumerate-tree (cdr tree))))))\n\n; previously called this\n; fringe\n\n.Lets look at 2 versions of postorder for\nenumerate-tree. The first.\n\n; post : returns list of the leaves of tree.\n; (no mention of the order of these)\n\n; post2 : returns the list of the leaves of tree in\n; the same order as they occur in tree.\n\nI want to look at proofs appropriate for each version\n\nBoth are tree recursions so we know we need to carry\nout tree inductions.\n\nHH : the recursive calls each return a list of leaves,\n\n; one of the leaves in (car tree) and the\n; other of the leaves in (cdr tree)."}


created_at: 2024-04-29 18:23:09
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This image contains handwritten text discussing programming concepts related to lists and their efficiencies in Python.1

metadata:
{"source": "pdf", "chroma:document": "Is; given two lists, we see that append is the right combiner since (append l1 l2) is just the concatenation of l1 and l2.\n\nBut the program as written actually satisfies the stronger specification given with post. The reason for this, of course, is that append preserves the element-wise order of its arguments.\n\nSo the question is: can the program be made more efficient or more clean if we used a combiner other than append?\n\nFor example, if we require that a tree not have duplicate leaves, so that the fringe is a set instead of a multiset, perhaps some version of set-union could be more efficient than append - or without making the program perhaps multiset union could be useful.\n\nThe point I am making is that the program is overspecified relative to post, - suggesting that one wants to consider alternatives."}


created_at: 2024-04-29 18:23:26
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Text from a handwritten note discussing concepts related to graph algorithms2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "This kind of thing happens frequently \u2013 consider, for example, the gap between many graph algorithms and their implementations. Spanning Tree Algorithm implementations with unprocessed nodes stored on a heap implementations with unprocessed nodes stored on a stack. One could say that when the algorithm states, at a high level of abstraction, 'select an unprocessed node' that it actually doesn't care how this selection is done. That the algorithm is non-deterministic. Non-determinism is actually used by all of us in thinking \u2013 at a high level \u2013 about computational  processes. Consider, for example, the process"}


created_at: 2024-04-29 18:23:39
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes discussing high-level view and behavior of an email transmission from point A to point B.3

metadata:
{"source": "pdf", "chroma:document": "of sending email from point A to point B. High-level view A -> B In reality, we have no idea (without using your favorite net utilities) what happens. The message makes A -> A1 -> A2 -> ... -> AN -> B on a day with light traffic. But maybe A -> B1 -> B2 -> ... -> BN -> B on an entirely different set of crowded time. Yet, the behavior - at the top level - appears deterministic."}


created_at: 2024-04-29 18:23:51
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten text discussing the concept of nondeterministic programming languages in relation to functional programming.4

metadata:
{"source": "pdf", "chroma:document": "The convenience of this kind of abstraction is evident \u2013 and very much the kind we seek in functional programming. So: are nondeterministic programming languages a thing? YES \u2013 eg. see (part of) Ch. 4 in A&S, where they build an interpreter for one. See also the A&S discussion of amb, which was used by McCarthy (inventor of LISP) for nondeterministic programming. As the not-example suggests, what happens non-det. at one level must be in deterministic at a lower level. So amb is actually nothing more than a one-word trigger for BFS. You'll see some amazingly elegant solutions to puzzles using amb in A&S."}


created_at: 2024-04-29 18:24:11
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Transcription of the handwritten and typewritten text from the image including code snippets and annotations5

metadata:
{"source": "pdf", "chroma:document": "; signal processing approach to some problems\n\n(define tree-2 (list 1 (list 2 3) (list 4 5)) (list (list 6)))\n\n(define (sum-odd-square-tree)\n  (accumulate +\n              0\n              (map square\n                   (filter odd?\n                          (enumerate-tree tree)))))\n\n(define (fib-n)\n  (define (aux curr prev count)\n    (if (= count 0)\n        prev\n        (aux (+ curr prev) curr (- count 1)))))\n  (aux 1 0 n))\n\n(define (even-fibs n)\n  (accumulate cons\n              '()\n              (filter even?\n                     (map fib\n                          (enumerate-interval 0 n)))))\n\n(map by\n  (0 1 2 ... n fibs))\n(filter by even\n  (0 2 ... just even fibs out to n))\naccumulate cons ??\n\n(0 2 ... list is unchanged)\n\nThis is the returned value proving that the program returns progressively\nlengthening list consisting of precisely\nfib #'s up to fib n.\n\nWhy is this a proof? There is no recursion or iteration at the top level - in fact, we have already"}


created_at: 2024-04-29 18:24:18
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing programming concepts6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "proved the correctness of map, filter, accumulate -> SO THERE IS NO NEED TO DO IT AGAIN! \nAll one needs to do is to describe the data flow (after checking that the recomposed functions are compatible), perhaps with a diagram (as I have done)."}


created_at: 2024-04-29 18:24:37
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten programming notes and code7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "IE, nested for-loops in Scheme\n\n; nested mappings\n\n; given a positive integer n, find all ordered pairs of distinct positive integers i and j,\n; where 1 <= i < j <= n\n\n(define (ordered-pairs-of-distinct-integers n)\n  (accumulate append\n    '()\n    (map (lambda (i) (map (lambda (j) (list i j))\n                          (enumerate-interval (+ i 1) n))))\n    (enumerate-interval 1 (- n 1)))))\n\nRealize that - once again - there is no top-level recursion or looping. So our interest is enrafted\nat the data flow or for the previous example , so that the code appears\n\n(map (lambda (i) (list i))\n     (enumerate-interval 1 (- n 1)))\n\nIt's easy to see that the flow is\n\n(1 2 ... n-1) -> ((1) (2) ... ((n-1) n))\n\nNow we look at (f i) - eg\n(f 2) -> ((1 2) (1 3) ... (1 n))\n       -> ((2 3) (2 4) ... (2 n))\n\nand so on. So when this completes,"}


created_at: 2024-04-29 18:24:45
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes about mathematical sequences and lists of pairs8
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "You have (1 i) replaced by ((i i+1) (i i+2) ... (i n)) and thus the intermediate output is a list of lists of pairs ((1 2) ... (1 n)) ((2 3) ... (2 n)) ... ((n-1 n)) Problem output is a list of pairs, not a list of lists of pairs - so we flatten using the usual accumulate + append combination."}


created_at: 2024-04-29 18:24:59
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: A script of Scheme programming language demonstrating the use of functions to manipulate lists.9
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; flatmap allows a simplification\n\n(define (flatmap proc seq)\n  (accumulate append '() (map proc seq)))\n\n(define (ordered-pairs-of-distinct-integers n)\n  (flatmap (lambda (i)\n            (map (lambda (j) (list i j))\n                 (enumerate-interval (+ i 1) n)))\n           (enumerate-interval 1 (- n 1))))\n\n; flatmap turns out to be quite useful - next we use it to compute\n; all permutations of a set S\n\n; for example, the permutations of {1,2,3} are given --\n; first, list all permutations with 1 in the first position\n; next, list all permutations with 2 in the first position\n; finally, list all permutations with 3 in the first position\n\n(define (permutations s)\n  (if (null? s)\n      (list '())\n      (flatmap\n       (lambda (x)\n         (map (lambda (p) (cons x p))\n              (permutations (remove x s))))\n       s)))\n\n; where\n\n(define (remove item sequence)\n  (filter (lambda (x) (not (= x item)))\n          sequence))"}


created_at: 2024-04-29 18:25:22
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Text from a class lecture slide0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Class 21 CSc 335 April 11 2024\n\n2nd Interpreter of the Term\n\n(Due to Friedman and Felleisen, the authors of TLS)\n\nAn L-expression is an S-expression which is either:\n(AND 1 2), or\n(OR 1 2), or\n(NOT 1 1), or\nan arbitrary symbol, which we call a variable\n\nHere 1 and 2 are arbitrary L-expressions, so this is an inductive definition once we add 'and nothing else is an L-expression'\n\n(a) Write and certify a function lexp? which checks whether an S-expression is an L-expression.\n\n(b) Write and certify a function covered? of an L-expression lexp and a list of symbols los that tests whether all the variables in lexp are in los.\n\n(c) For the evaluation of L-expressions we need association lists, or alists. An alist for L-expressions is a list of (variable, value) pairs. The variable component is always a symbol, and the value-component is either the number 0 (for false) or 1 (for true). Write and certify a function lookup var the symbol var and the association list al, so that (lookup var al) returns the value of the first pair in al whose car is eq? to var.\n\n(d) If the list of symbols in an alist for L-expressions contains all the variables of an L-expression lexp, then lexp is called _closed_ with respect to this alist. A closed L-expression can be evaluated essentially by substituting the values of the variables given in the alist for the variable occurrences in the L-expression. You are asked to write and certify the function value of an L-expression lexp and an alist al, which, after verifying that lexp is closed with respect to al, determines whether lexp means true or false. If lexp is not closed wrt al, then (value lexp al) should return the symbol not-covered.\n\n (a) comprises the pre-evaluation sanity check\n\n (b) and (c) comprise the environment subsystem"}


created_at: 2024-04-29 18:25:41
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This image appears to contain handwritten pseudo-code and notes explaining some concepts in programming.1

metadata:
{"source": "pdf", "chroma:document": "(b)  Define covered? (exp pos)\n    (cond ((symbol? exp) (member? exp pos))\n          ((member? 'op exp) '(and or))\n          (and (covered? (first-arg exp) pos)\n               (covered? (second-arg exp) pos)))\n    (else (covered? (first-arg exp) pos)))\nThis is an example of recursive descent exploring the inductive structure of EXP.\n\n(c)  An example a-list might be\n    ((x 0) (y 1) (z 1))\n    i.e., a flat list of bindings. There's no restriction on the number of times a given variable can occur \u2014\n\neg ((x 0) (y 1) (z 1) (z 0))\n    rs also an a-list.\n\n    The lookup function will ignore all but the first binding for a variable.\n\n(define (lookup var a-list)\n    (cond ((eq? var (car (car a-list))) (cadr (car a-list)))\n          (else (lookup var (cdr a-list))))\nThis returns the value from the first (leftmost) binding of var."}


created_at: 2024-04-29 18:25:56
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about programming concepts involving logical expressions and evaluation2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Note that (AND x y) means one thing if a list is ((x 0) (y 1)), and means something else if a list is ((x 1) (y 1)) explains the need for the alist argument.\n\nCD) We separate checking from evaluation - we are assuming pre for value is satisfied - ie \nlexpr really is in lexp and also that \ncovered? leXp (map can alist)) is true.\n\n(define (value lexp alist) represents this systems\nalist is this systems representation of environment.\n(cond ((symbol? lexp) (lookup lexp alist))\n((and? lexp) \n(cond (value (first-arg lexp) alist) \n(value (second-arg lexp) alist))\n\n(or? lexp)\n\n(not? lexp)))\n\n. Define (check-and-evaluate lexp alist)\n(cond ((not (lexp? lexp)) syntax-error)\n((not (covered? lexp(map can alist)))\nnot-covered)"}


created_at: 2024-04-29 18:26:09
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about data structures and programming concepts3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "; pre for value guaranteed at this part.\n(else (Value ReqQ aList)))\n\nIt will be useful to notice that a list can be thought\nof as a stack -\n\nlist stack\ncons push\ncar top\ncdr pop\n\n(The left end of the list is the top of the stack)\n\nWe will make use of this to implement local\nvariables (and, generally, scoped) in the TES\ninterpreter -> ch 10 of the Little Schemer ->\nstarting next.\n\nNote that all variables in the LEXD system\nare global\n\n(Historical reference: This was true of BASIC in the\n1960s as well as of the first versions of\nFORTRAN)"}


created_at: 2024-04-29 18:26:22
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Transcript of the handwritten notes related to computer science, specifically discussing environments in programming.4

metadata:
{"source": "pdf", "chroma:document": "For scheme, we need somewhat more complex environment structures.\n\nTo see this, let's consider some lambda forms and their associated environments\n\nExample 1\n(lambda (a b) (+ a b)) \n2 3\n\nThe expression (+ a b) is evaluated in this environment\n\n(a b)----(2 3)\n\nEssentially the same flat structure used for L-exps, perhaps represented as a pair of lists -- the first is a list of names, i.e., (a b), and the second is the list of corresponding values, (2 3)\nThe lookup procedure here would be to simultaneously cdr down the vars and values lists\n\nBut this simple one-rib environment is not\nalways adequate\n\nConsider:"}


created_at: 2024-04-29 18:26:43
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
This is a transcription of notes presumably related to a programming or computer science lecture, including handwritten annotations.5

metadata:
{"source": "pdf", "chroma:document": "; example 2\n\n((lambda (a b)\n  (+ a b (+ (lambda (a c) (+ (+ a c) b))\n    3 4)))\n  1 2)\n\n; the expression (+ (* a c) b) is evaluated in this environment\n\n; (a c) ---- (3 4)\n; (a b) ---- (1 2)\n\n; and can be seen to have values a=3, b=2 and c=4. The search for a given symbol begins with the rib containing the symbol; it proceeds to the 'outer' rib only if the symbol does not occur in the first rib. What happens if it does not occur in any rib?\n\n; when this expression has been evaluated, the outer expression (+ a (* b 14)) is evaluated in this environment.\n\n; (a b) ---- (1 2)\n\n; to give (+ 1 (* 2 14)) = 29\n\n; these environment structures are usually described as 'rib-cage environments': you can see the ribs, like a sternum, suggested in our diagrams\n\n; clearly, an interpreter is going to need to 'push' and 'pop' ribs at appropriate times."}


created_at: 2024-04-29 18:26:59
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten class notes on recursive list reference function in programming0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Wake Up Class 4/10/24 (by Zoom)\n\nHW 2 - #2\nRecursive list-ref\n\npre: L is a list, and j is an index into that list\npost: (list-ref L j) returns the index j'th of L\n\nidea: defer cdr - we'll have a wrapper, but the recursive function will assemble a stack of cdrs.\nFor example:\n((cdr(cdr(cdr '(1 2 3 4 5)))) = an '(4 5)' = 4 (index 3 elt)\n\ndefine (rec L j)\n(cond ((zero? j ) (car L ))\n(else (cdr (rec ?? ...) ))\n\nLooks wrong. So let's try moving on to the wrapper.\n\ndefine (rec L j)\n(cond ((zero? j) L)\n(else (cdr (rec L (- j 1)))))\n\nwant to return cdr(cdr...(cdr L))...\nj cdrs\n\nWhat are we recursing on? (clearly not L)"}


created_at: 2024-04-29 18:27:09
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing programming concepts and functions1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "So - \nDet: to apply cdr j times to l,\nwe apply cdr to (cdr^j-1 l),\n\nwe need a wrapper.\n\n(define (myListRef l j)\n  (car (rec l j)))\n\nThus we return the index j element of l.\n\nCheck: has the 0-based indexing been\ncorrectly worked in?\n\nYes - by induction on j - {work this out.}\n\nNotice that rec itself does not cdr down l in the usual sense -\nrec returns the result of applying cdr j times to l."}


created_at: 2024-04-29 18:27:22
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Description of a mathematical problem involving writing a high order function to compose two functions, f and g, in programming.2

metadata:
{"source": "pdf", "chroma:document": "Let's take another look at this problem. A problem from [ABS ch 1] asked us to write a high order function which inputs 2 composable functions f and g and which returns the composed function \u03bbx. f (g x) using lambda.\n\nFor example, (compose square cube) would be called as (compose square cube) 2 giving 64.\n\n; Pre: f and g are composable\n(define (compose f g)\n  (lambda (x) (f (g x))))\n; Post: returns \u03bbx. f (g x)."}


created_at: 2024-04-29 18:27:35
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten text containing programming code and related commentary3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "And a related problem is (iirc)\n\nWrite a function, repeated, which works\n\n((repeated square 2) 5) = 625\n\n(define (repeated f n)\n   (cond ((zero? n) (lambda x x))\n     (else (compose f (repeated f (- n 1))))))\n\npf by induction on n\n\nYou should rework your solutions to HW using repeated(). It might not apply to all of those problems, but it certainly applies to a number of them.\n\nLet's revisit the recursive list-ref...\n\nwe have\n\n(define (rec a i)\n   (cond ((zero? i) a)\n     (else (cdr (rec a (- i 1)))))"}


created_at: 2024-04-29 18:27:43
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "(define (alt-rec i j)\n  (if (null? i) j\n      (appulted-cdr j)))\n\nThis returns the functim\n\n\u03bbx.(cdr x)\n\nWhich is not what rec desired. Can\nwe change the wrapper to make this\ncompute lst-ref?\n\nHow about you all working this out?"}


created_at: 2024-04-29 18:28:00
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Class notes transcription from an image0
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "CSC 335 Class 16 March 26 2024\n\n;; list ::= () | (cons atom list) | (cons list list))\n;; lat ::= () | (cons atom lat)\n\nWe want a function member? which inputs a lat and an atom and which checks whether the atom is included in the lat.\n(Give a recursive development)\n\nOur divide & conquer strategy is simply to cut down the input list;\n- we process the car explicitly\n- we let the recursive call 'magically' process the cdr\n- we combine those results to solve the problem\n\nFocus on *ie* - on the recursive call\n\nWe expect the recursive call to completely solve the problem for the cdr.\nWe need to write down precisely what"}


created_at: 2024-04-29 18:28:15
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing recursive function programming1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "this means. for this problem:\n\nThe recursive call returns #t when the input atom occurs in the cdr, and #f otherwise.\n\nSince a occurs in mlat precisely when it is either (car mlat) or it occurs in (cdr mlat), we see how to write the code\n\n(define (member? a mlat)\n  (cond ((null? mlat) #f)\n        (else (or (eq? a (car mlat))\n                  (member? a (cdr mlat))))))\n\nWhat now does the directive pf look like?\n\n(H: recursive call works if a is an atom and (cdr mlat) is a list)\n\nOf course the Pgm hasn't changed a - so a is an atom here if it was originally.\n\nAnd we know from the BNF data description that (cdr lat) is a lot. (Note that because mlat is not empty, we know as well that the"}


created_at: 2024-04-29 18:28:20
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes about programming.2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "application of cdr will not throw an error.\nwe already gave the basis and induction\nsteps already."}


created_at: 2024-04-29 18:28:34
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten content discussing computer programming logic.3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Is this really recursive? Syntactically, it is recursive, with or serving as the ground. But in reality - given the standard left-to-right short-circuit implementation of or - an efficient compiler would likely cast it as a tail recursion. Consider (or x y z) -> returns x if x is #t, with no need to eval y or z. And if x is #f, it simply moves on to y - no need to remember the value of x. But if or happens not to be implemented this way - say it evals right to left - or could indeed use that stack."}


created_at: 2024-04-29 18:28:45
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten text regarding algorithmic concepts.4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Next let's consider the problem of removing an element from a list.\n\ncdr\ncdr-down as our\ndivide & conquer\nstrategy\ntermination is\nimplicit in cdr-down\n\ncan\n\nWhat do we do in this case to process the\ncan?\n\nTwo cases: either (can inlat) is the\nelement to be removed, or it's not.\n\nIf it is - then - well want - The\nSpec seems incomplete; Are we to\nremove every occurrence of a, or just\nthe first occurrence of a?\n\nFor E, we need to remove all\noccurrences from the cdr as well as\nremoving the can.\n\nFor F, we could just return the cdr\n"}


created_at: 2024-04-29 18:29:01
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The content of this image is handwritten notes discussing draft code and its functions.5
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "If it is not, then we have to return it.\n\nSo it seems we have a more or less complete design idea; pseudo-code, termination, etc.\n\nLet's have draft code for e\n\n(define (remember* a lat)\n  (cond ((null? lat) '())\n        (else (if (not (eq? a (car lat)))\n                  (cons (car lat)\n                        (remember* a (cdr lat)))\n                  (remember* a (cdr lat)))))\n\nI am content to talk through the inductive argument - so I can emphasize the tentative nature of the draft code. The role of\nthe induction is to serve as a check on the code you currently have.\n\nIf an error is exposed, then one revisits it."}


created_at: 2024-04-29 18:29:12
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Description of the handwritten note6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The earlier steps. Another way of exposing errors is to run a few tests. In fact, it makes sense to run the tests BEFORE taking the time to write out the induction.\n\nThere's another flaw with the spec! It doesn't say ...\n\nwhy not just return the empty list each time? Certainly that would strip out all occurrences of a !\n\nThat the non-a elements have to be retained in the same order they were originally."}


created_at: 2024-04-29 18:29:22
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten text from the image discussing computer programming code and thoughts7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "What about option f?\n\n(define (remember a lat)\n  (cond ((null? lat) '())\n        (else (if (not (eq? (car lat) a))\n              (cons (car lat)\n                    (remember a (cdr lat)))))))\n\nThe inductive argument must involve confirmation for the claim that my code removes the first occurrence of a and no others.\n\nAgain - I leave for you the important tasks of testing and writing out the induction."}


created_at: 2024-04-29 18:29:37
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes from a class related to computing or programming concepts, discussing lists, atoms, and recursion.0

metadata:
{"source": "pdf", "chroma:document": "Class 17 March 28 2024\n\nGoing beyond lists of atoms \u2013 how to carry out inductions?\n\nWhy not continue inducting on list length? The problem is brought out by an observation and an example:\n\nObservation: If we want to process a list of lists, then it will be necessary to process the sublists as well as any top-level atoms.\n\nExample: (: (1 (2 3 4 5 6) 7)\nThe entire list has length 3 but the cdr has length 5. If we were to try inducting on length, and if we wanted to use the IH to claim that our program works on all components of the top-level input, we run into trouble because the chosen induction metric us length for the cdr component than for the original input."}


created_at: 2024-04-29 18:29:50
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten text discussing a concept1
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The idea is to find a new induction metric. We will use \"Tree complexity\", which we need to define.\n\nTree? What do trees have to do with lists of lists?\n\nIt turns out that there is a natural correspondence between these:\n\nS-exp \u279c tree\n\na \u279c \u2022\n\n() \u279c \u2022\n\n(a) \u279c \u2022\na\n\n(a b) \u279c   a\n          /   \\\n          b\n\n(a (b c)) \u279c    a\n             /     \\\n          b       c\n\nAdd a link to reflect parens"}


created_at: 2024-04-29 18:30:00
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes describing Lisp operations on trees2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The ops of car, cdr and cons can be defined on trees also.\n(car '(a (b c))) -> a\n(cdr '(a (b c))) -> (b c)\n(cons 'a '(b c)) -> (a b c)\nSo you see that we can carry out these operations either in s-exp space or in tree space.\neg (car (b c))\n  s-exp -> Tree -> a\n           car                   Tree-car\n             \u2193                          /\n            a                a\nSimilarly for cdr, and for cons."}


created_at: 2024-04-29 18:30:10
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: A handwritten note explaining a concept and posing related questions3
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "The reason I'm showing you this?\nSometimes it is easier (simpler, more clean) to think in terms of trees when we are designing code \u2014 and it is necessary to know that this is mathematically justified.\n\nQuestions\n1) What has happened to 'a' in the tree diagram for 'n'?\n(cons 'a 'n) in free space is (tree-cons . a . n) is\n2) What does this have to do with induction?"}


created_at: 2024-04-29 18:30:23
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcribed text from the handwritten note4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "It gives us a useful metric: we can induct on the \"size\" of the tree corresponding to the s-expression.\n\nWhat do we mean by size? Some combination of height and width?\n\nLet's look at our example('1 ('2 3 4 5 6) 7)\n\nIn this case the height of the cadr is less than that of the entire tree.\n\nAside:('1 2 3)\ncdr -> ('2 3)\ncar -> 2"}


created_at: 2024-04-29 18:30:36
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing concepts related to tree data structures5
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "car -> 3\nBut height doesn't work for the cdr - \nThe cdr has the same height as the entire tree.\n\nWell - what about the number of nodes?\nClearly smaller for each component than for \nthe original.\n\nWhat about the number of leaves? Doesn't work.\n(Trade-off, one leaf to one leaf)\n\nCounting nodes is easy in tree space. Since \nwe claim to have a correspondence between \ntrees and sexps, we should be able to figure \nout what to count in sexp space as well.\n\nWhat about counting the number of cons cells?\nTwo questions:(1) is this the same as counting \nnodes?, and (2) does it work ?"}


created_at: 2024-04-29 18:30:53
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: The image contains handwritten notes and a graph diagram6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Again consider '( 1 2 3 4 5 (6) 7)'.\n\n'cons cells vs 9 nodes - so the answer to 1 is NO (but won't it always be off by 1, for the empty list?)'\n\n'What about question 2? Looks good'\n\n'Suggested Exercises: Is it true that any well-formed component of a list has fewer cons cells than the list itself? (2) Is the claim true? If so, then counting cons cells is the same as counting tree nodes.'"}


created_at: 2024-04-29 18:31:04
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: A handwritten note explaining a programming concept with diagrams7
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Let's look now at an example of a program which works for general s-expression inputs - Direct your attention to lecture9.scm (and to TLS).\n\nWe want a program subst* which replaces each occurrence of an atom 'old' by an atom 'new' in the input tree.\n\nWe use Tree-recursion - a standard pattern in which one issues recursive calls on both the car and the cdr, after dealing with the basis cases.\n\nThat is: The divide and conquer decision is that we will process the car and the cdr separately.\n\nWill pick up here next time."}


created_at: 2024-04-29 18:31:28
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Lecture notes on the distinction between recursion and iteration, including code examples and annotations.0

metadata:
{"source": "pdf", "chroma:document": "Class 05 February 6 and 8 2024\nRecursion & Iteration\n1. The Visual Distinction Between Recursion and Iteration\n(define (fact x)\n(cond ((= x 0) 1)\n(else (* x (fact (- x 1))))))\nfunction calls itself,\nhence syntactically\nrecursive\nBoth are\nsyntactically\nrecursive\nThis mult. op. is said to\nguard the call to fact\nwrapper-only\n(define (new-fact x)\n(fact-iter x 0 1))\n(define (fact-iter x count result)\n(if (= count x)\nresult\n(fact-iter x (+ count 1) (* (count 1) result))))\nThe call to fact-iter\nis unguarded.\nWe need to talk about\nwhat constitutes a\nguard\n2. Looking more closely, however, you spot a\ndifference - the recursive call to fact is\nguarded\nThe guard in fact is pointed at-\nthe cond is NOT counted as a guard. similarly\nthe if in fact-iter is not a guard."}


created_at: 2024-04-29 18:31:55
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
Handwritten notes about the operational difference between recursion and iteration in programming, specifically discussing tail recursion.1

metadata:
{"source": "pdf", "chroma:document": "let me note that iterative processes are usually referred to as tail-recursive.\n\nWhy is this distinction important?\n\nOperational Difference Between Recursion and Iteration (Consequence of the guard or its absence)\n\n(define (fact x)\n  (cond ((= x 0) 1)\n    (else (* x (fact (- x 1))))))\n\nnecessary deferred\nuntil 'fact 5' is\nevaluated\neffective number\npattern of calls\nexpansion for\nfact 6\n(fact 6)\n(* 6 (fact 5))\n(* 6 (* 5 (fact 4)))\n(* 6 (* 5 (* 4 (fact 3))))\n(* 6 (* 5 (* 4 (* 3 (fact 2)))))\n(* 6 (* 5 (* 4 (* 3 (* 2 (fact 1))))))\n(* 6 (* 5 (* 4 (* 3 (* 2 (* 1 (fact 0)))))))\n(* 6 (* 5 (* 4 (* 3 (* 2 (* 1 1))))))\n(* 6 (* 5 (* 4 (* 3 (* 2 2)))))\n(* 6 (* 5 (* 4 (* 3 6))))\n(* 6 (* 5 (* 4 12)))\n(* 6 (* 5 24))\n(* 6 120)\n720\nThe stack contracts\nstack initially -> x6\nx6\nx5\nx4\nproc.\ncall\nstack\n'invlt.\npromise'\nOnce (fact 6) returns\nwithout any further calls, the\nsystem can unwind the stack\n Let's call\nthis the\n'purely recursive'\nversion"}


created_at: 2024-04-29 18:32:05
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten notes2
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "y carrying over - deferred multiplications - popping each in turn, sometimes I will use the phrases 'proper recursion' where the text uses just 'recursion'. From the pattern of calls expression, ones sees that factorial(n) requires O(n) time for n multiplications and also O(n) space (for the stack). Yes, we will be making use of your background in algorithms (CSE 220 of CUNY). In contrast, the iterative factorial requires O(n) time but only constant space."}


created_at: 2024-04-29 18:32:21
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
encoding: FLOAT32
id:
A handwritten explanation and code related to a recursive computing process in Scheme programming language3

metadata:
{"source": "pdf", "chroma:document": "(define (new-fact x)\n(fact-iter x 0 1))\n\n(define (fact-iter x count result)\n(if (= count x)\nresult\n(fact-iter x (+ count 1) (*(+ count 1) result))))\n\n;; here we see that the work is done by updating the values of count and result\n\n;; (new-fact 6)\n;; (fact-iter 6 0 1)\n;; (fact-iter 6 1 1)\n;; (fact-iter 6 2 2)\n;; (fact-iter 6 3 6)\n;; (fact-iter 6 4 24)\n;; (fact-iter 6 5 120)\n;; (fact-iter 6 6 720)\n\nHere, the recursive process is explained with annotations about the flow, specifically noting that this form of recursion does not involve stack expansion and contraction, emphasizing that it operates in constant space by just updating parameters."}


created_at: 2024-04-29 18:32:31
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Explanation of differences between proper recursion and tail recursion in computing.4
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Another way of understanding the difference between (proper), recursion and iteration (tail) recursion comes if you ask \"what data needs to be preserved if each process is to be interrupted and then resumed later?\" \nFor fact -- one would need to save not instruction pointer as well as the entire call stack.\nBut for fact-iter, the answer is just the instruction pointer and the current values of the parameters."}


created_at: 2024-04-29 18:32:42
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Transcription of handwritten text from the provided image5
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "So it is usually desirable to have iterative programs.\n\nBut you will soon discover that it is dramatically easier to write recursive programs than to write iterative programs.\n\nSince human time is almost always the really expensive part of software... one wants to understand recursion as well as iteration.\n\nThink: rapid prototyping\n\n(As an aside - gcc has a switch allowing users to optimize for tail recursion; smart enough to avoid using a stack when this is unnecessary)"}


created_at: 2024-04-29 18:32:51
topic: persistent://default/default/71054ee4-4471-4fe6-a521-830479038f85
id: Handwritten notes discussing differences between recursive and iterative programs.6
encoding: FLOAT32
metadata:
{"source": "pdf", "chroma:document": "Certification Difference Between Recursive and Iterative Programs\n\nBut wait / why bother with proofs/certifications?\nAfter all one can try fast on a few values, and see clearly that it works!\nRight?\n\nLet's have a look -> over to DrRacket. We can see in a minute that this simple program can compute some HUGE numbers - it's clearly NOT enough to say."}


