Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 2a9dba2f9e
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (21 sloc) 0.83 kB
#lang racket
;; Example 4.5
;; Need testing.
(define (cond=>clause? exp)
(eq? (cadr exp) '=>))
(define (expand-clauses clauses)
(if (null? clauses)
'false
(let ((first (car clauses))
(rest (cdr clauses)))
(cond ((cond=>clause? first)
(make-if (car first) ;; (if (test?) (list recipient test) ..)
(list (caddr first) (car first))
(expand-clauses rest)))
((cond-else-clause? first)
(if (null? rest)
(sequence->exp (cond-actions first))
(error "Clause else not the last" clauses)))
(else (make-if (cond-predicate first)
(sequence->exp (cond-actions first))
(expand-clauses rest)))))))
Jump to Line
Something went wrong with that request. Please try again.