; xscheme.ini - initialization code for XScheme version 0.16

(load "macros.s")
(load "qquote.s")

; this version of EVAL knows about the optional enviroment parameter
(define (eval x #!optional env)
  ((if (default-object? env)
     (compile x)
     (compile x env))))

(define (autoload-from-file file syms #!optional env)
  (map (lambda (sym) (put sym '%autoload file)) syms)
  '())
  
(define (*unbound-handler* sym cont)
  (let ((file (get sym '%autoload)))
    (if file (load file))
    (if (not (bound? sym))
      (error "unbound variable" sym))
    (cont '())))

(define head car)
(define (tail x) (force (cdr x)))
(define empty-stream? null?)
(define the-empty-stream '())

(macro cons-stream
  (lambda (x)
    (list 'cons (cadr x) (list 'delay (caddr x)))))

(macro make-environment
  (lambda (x)
    (append '(let ()) (cdr x) '((the-environment)))))

(define initial-user-environment (the-environment))
