apply

(define (m-apply function actualargs env)
  (if (and (pair? function)
           (eq? (car function) 'lambda))
      (m-begin (cddr function)
               (m-bind
                 (cadr function)
                 actualargs
                 env)
               #f)
      (m-error "Illegal form " function)) )

(define (m-define s env) (set! *environment* (cons (if (symbol? (cadr s)) (cons (cadr s) (m-eval (caddr s) env)) (cons (caadr s) ; fn def (cons 'lambda (cons (cdadr s) (cddr s))))) *environment*)) )

(define (m-getdef var env) (let ((pair (assoc var env))) (and pair (cdr pair)) ))

Contents    Page-10    Prev    Next    Page+10    Index