timothy235 icon

sicp-4-1-1-the-core-of-the-evaluator

timothy235 | PRO | 12/19/24 01:09:23 AM UTC (Edited) | 0 ⭐ | 7106 👁️ | Never ⏰ | []
Racket |

730 B

|

None

|

0 👍

/

0 👎

#lang racket
 
;; This will not run due to undefined terms.
 
;;;;;;;;;
;; 4.1 ;;
;;;;;;;;;
 
(define (list-of-values1 exprs env)
  ; Like list-of-values but always evaluates left to right.
  (cond [(no-operands? exprs) empty]
        [else
          (define lov-car (my-eval (first-operand exprs) env))
          (define lov-cdr (list-of-values (rest-operands exprs) env))
          (cons lov-car lov-cdr)]))
 
(define (list-of-values2 exprs env)
  ; Like list-of-values but always evaluates right to left.
  (cond [(no-operands? exprs) empty]
        [else
          (define lov-cdr (list-of-values (rest-operands exprs) env))
          (define lov-car (my-eval (first-operand exprs) env))
          (cons lov-car lov-cdr)]))

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎