Skip to content
Open
Open
4.4#24
@INotWant

Description

(define (eval-or exp env)
  (if (null? exp)
    true
    (or (eval (car exp) env)
        (eval-or (cdr exp) env))))

应该为

(define (eval-or exp env)
  (if (null? exp)
    false
    (or (eval (car exp) env)
        (eval-or (cdr exp) env))))

后面实现为派生表达式,我认为应该为

(define (eval-and exp env)
    (make-if (null? exp)
        true
        (make-if (car exp)
            (eval-add (cdr exp) env)
            false)))

但是,我感觉用派生表示式的话,就没有短路效果了!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions