+1(805) 568 7317

this is done in racket scheme an environment can be represented by a list of associa 5187957

This is done in racket/scheme.

An environment can be represented by a list of association lists (i.e., a list of symbol tables), where the first element in the list is the nearest scope, the second the next surrounding scope, and the last the outermost scope.

Write a recursive function, lookup-env, which returns the binding with the specified name in the nearest scope. If no such binding is found, return nil.


define l1
ben “short”) (
cara “walking”) (
dan “bald”))) (
define l2
albert “is not”) (
ski “skinny”) (
kim “cook”) (
cara “injured”))) (
define e (list l1 l2) ) (
lookup-env 'ben e)
=> (
ben “short”) (
lookup-env 'albert e)
=> ('albert “is not”) (
lookup-env 'cara e)
=> (
cara “walking”) (
lookup-env 'eggbert e)
=> ()

(define (lookup-env name env)

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon

Order Now