On Sep 19, 2010, at 11:45 AM, Steven E. Harris wrote: > Moritz Ulrich <ulrich.mor...@googlemail.com> writes: > >> I think this would be a very nice extension for the repl - Saving the >> forms for later-retrieval. > > As precedent, the Common Lisp reader uses the +, ++, and +++ variables¹ > to store the last three forms read.
An early draft of the current clojure repl included a feature like that. At the time it was judged not sufficiently useful to keep. The clojure repl is very customizable. It's possible to add this feature in a custom repl to experiment with the idea: (declare r1 r2 r3) (defn saving-repl-read [request-prompt request-exit] (let [r (clojure.main/repl-read request-prompt request-exit)] (cond (#{request-prompt request-exit} r) r (#{'+ '++ '+++} r) `(quote ~({'+ r1 '++ r2 '+++ r3} r)) :else (do (set! r3 r2) (set! r2 r1) (set! r1 r) r)))) (binding [r1 nil r2 nil r3 nil] (clojure.main/repl :read saving-repl-read)) ------------- user=> 1 1 user=> (/ 22 7) 22/7 user=> (java.util.UUID/randomUUID) #<UUID fd91090a-8336-4a32-91e2-2c49e114177a> user=> ++ (/ 22 7) user=> ------------- Following the clojure repl's precedent of *1 *2 and *3, these might be better named +1 +2 and +3 if the idea gets any traction. --Steve -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en