Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Now supports *1, *2, and *3.

  • Loading branch information...
commit 4bcf274e9c675e6f99b413d8f146f3012f71e8ab 1 parent 7c535a7
@Raynes authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/tryclojure/core.clj
View
8 src/tryclojure/core.clj
@@ -102,6 +102,7 @@
(defn eval-form [form sbox]
(with-open [out (java.io.StringWriter.)]
(let [result (sbox form {#'*out* out})]
+ (sbox (list 'rebind-last-results result))
{:expr form
:result [out result]})))
@@ -121,7 +122,12 @@
:counter count
count (sandbox try-clojure-tester
:timeout 2000
- :namespace (symbol (str "sandbox" (rand-int Integer/MAX_VALUE)))))))
+ :namespace (symbol (str "sandbox" (rand-int Integer/MAX_VALUE)))
+ :init '(defn rebind-last-results [last]
+ (let [core (the-ns 'clojure.core)]
+ (when (find-var 'clojure.core/*2) (intern core '*3 *2))
+ (when (find-var 'clojure.core/*1) (intern core '*2 *1))
+ (intern core '*1 last)))))))
(defn eval-request [expr]
(try
Please sign in to comment.
Something went wrong with that request. Please try again.