--- /dev/null
+#lang racket
+
+;; left to right
+(define (list-of-values exps env)
+ (define (iter valuelist expressions)
+ (if (no-operands? exps)
+ valuelist
+ (let ((value (eval (first-operand expressions) env)))
+ (iter (append valuelist (list value))
+ (rest-operands expressions)))))
+ (iter '() exps))
+
+;; right to left
+(define (list-of-values exps env)
+ (if (no-operands? exps)
+ '()
+ (let ((right (list-of-values (rest-exps exps) env)))
+ (cons (eval (first-exp exps) env)
+ right))))
--- /dev/null
+#lang racket
+
+#|
+
+a. application? only checks whether the given expression is a pair. It assumes that the rest of
+ the built in language clauses are already handled. So this will upset all other classes like
+ define, let where Louis's eval would think define is a procedure and would proceed to evaluate
+ the operands, which is wrong.
+
+|#
+
+#|
+
+b.
+
+We only change the selectors and the predicate procedures, everything else remain the same to
+implement the new proposal.
+
+|#
+
+(define (application? exp)
+ (if (pair? exp)
+ (tagged-list? expr 'call)
+ #f))
+
+(define (operator exp) (car (cdr exp)))
+(define (operands exp) (cdr (cdr exp)))
+
--- /dev/null
+#lang racket
+
+(define (eval exp env)
+ (cond ((self-evaluating? exp) exp)
+ ((variable? exp) (lookup-variable-value exp env))
+ ((get (type exp)) ((get (type exp)) exp env))))
+
+(define (type expr) (car expr))
+
+(put 'quote
+ (lambda (expr env)
+ (text-of-quotation expr)))
+
+(put 'set!
+ (lambda (expr env)
+ (eval-assignment expr env)))
+
+
+
+
\ No newline at end of file
--- /dev/null
+#lang racket
+
+(define (tagged-list? exp tag)
+ (if (pair? exp)
+ (eq? (car exp) tag)
+ #f))
+
+(define (make-if predicate consequent alternative)
+ (list 'if predicate consequent alternative))
+
+;; and
+(define (and? expr) (tagged-list? expr 'and))
+(define (eval-and expr env) (eval-and-predicates (cdr expr) env))
+
+(define (eval-and-predicates expr env)
+ (cond ((null? expr) #t)
+ ((eval (car expr) env) (eval-and-predicates (cdr expr) env))
+ (else #f)))
+
+;; or
+(define (or? expr) (tagged-list? expr 'or))
+(define (eval-or expr env) (eval-or-predicates (cdr expr) env))
+
+(define (eval-or-predicates expr env)
+ (cond ((null? expr) #f)
+ ((eval (car expr) env) #t)
+ (else (eval-or-predicates (cdr expr) env))))
+
+;; derived expressions
+(define (and->if expr)
+ (expand-and-predicates (cdr expr)))
+
+(define (expand-and-predicates expr)
+ (cond ((null? expr) '#t)
+ (else (make-if (car expr)
+ (expand-and-predicates (cdr expr))
+ '#f))))
+
+(define (or->if expr)
+ (expand-or-predicates expr))
+
+(define (expand-or-predicates expr)
+ (cond ((null? expr) '#f)
+ (else (make-if (car expr)
+ '#t
+ (expand-or-predicates (cdr expr))))))
\ No newline at end of file