Eliminate lambda in circuit?

I need to eliminate this lambda circuit diagram for my school assignment.

Any ideas how to do this?

(define (foo x)
(letrec
  ((h 
    (lambda (y z)
      (cond
        ((null? y) 'undefined)
        ((null? (cdr y)) (car z))
        (else (h (cddr y) (cdr z)))
        ))))
  (h x x))
)
+3
source share
1 answer

Well, you can replace the expression lambdain letrecwith an internal definition:

(define (foo x)
  (define (h y z)
    (cond
      ((null? y) 'undefined)
      ((null? (cdr y)) (car z))
      (else (h (cddr y) (cdr z)))))
  (h x x))

... Or you can extract the procedure hout fooas an auxiliary procedure. In any case, the result will be the same.

+3
source

All Articles