Skip to content

Instantly share code, notes, and snippets.

@lojikil
Created March 12, 2012 16:26
Show Gist options
  • Select an option

  • Save lojikil/2023163 to your computer and use it in GitHub Desktop.

Select an option

Save lojikil/2023163 to your computer and use it in GitHub Desktop.

Revisions

  1. lojikil revised this gist Mar 30, 2012. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions load.ss
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,13 @@
    (if (eq? expr #e)
    #v
    (begin
    ;; (hydra@vm (list->vector (hydra@eval expr *tlenv*)) *tlenv*)
    ;; has become:
    ;; (hydra@eval expr *tlenv*)
    ;; the end user doesn't really care about the intricacies of
    ;; the VM or the compiler, so the old hydra@eval has become
    ;; hydra@compile, and the new hydra@eval is just a shell around
    ;; these two.
    (hydra@vm (list->vector (hydra@eval expr *tlenv*)) *tlenv*)
    (loop (read f)))))))
    (loop (read f)))
  2. lojikil revised this gist Mar 12, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions load.ss
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    (define (hydra@load f)
    (define (hydra@load src-file)
    "an implementation of the primitive procedure load"
    (with f (open f :read)
    (with f (open src-file :read)
    (with-exception-handler
    (fn (x) (display (format "An error occured while loading ~S: ~a\n" f x)) (close f))
    (fn (x) (display (format "An error occured while loading ~S: ~a\n" src-file x)) (close f))
    (fn ()
    (letrec ((loop (fn (expr)
    (if (eq? expr #e)
  3. lojikil created this gist Mar 12, 2012.
    14 changes: 14 additions & 0 deletions load.ss
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    (define (hydra@load f)
    "an implementation of the primitive procedure load"
    (with f (open f :read)
    (with-exception-handler
    (fn (x) (display (format "An error occured while loading ~S: ~a\n" f x)) (close f))
    (fn ()
    (letrec ((loop (fn (expr)
    (if (eq? expr #e)
    #v
    (begin
    (hydra@vm (list->vector (hydra@eval expr *tlenv*)) *tlenv*)
    (loop (read f)))))))
    (loop (read f)))
    (close f)))))