Can I clean the replica?

I played with a lot of code in the replix console, how can I clear it? I would like a new one without restarting it. It can be done?

+44
clojure read-eval-print-loop
Sep 03 '10 at 13:47
source share
7 answers

If you want to clear the current namespace of all temporary variables and functions that you specified, you can use this one liner (or execute its function):

(map #(ns-unmap *ns* %) (keys (ns-interns *ns*))) 

or

 (ns myutil) (defn ns-clean "Remove all internal mappings from a given name space or the current one if no parameter given." ([] (ns-clean *ns*)) ([ns] (map #(ns-unmap ns %) (keys (ns-interns ns))))) (ns mytest) ... make loads of junk ... (myutil/ns-clean) ... great!!! I can now make all new junk ... 

It does not pretend to give you a squeaky clean namespace, only one with less junk that typically accumulates in a typical replication session.

Use with caution: do not pull the mat from under your feet!

+46
Sep 03 '10 at 17:42
source share

In EMACS / slime REPLs, Cc Co clears the last result (if you typed something that gave a very long answer) Cc Mo clears it all

In GNOME terminals, you have the Terminal / Reset and Clear menu options

+18
Sep 06 2018-10-06T00:
source share

If you use a replica through a terminal window (for example: Terminal.app on MacOS or xterm / aterm / urxvt, etc. on linux), you can enter Control-L and it should clear the terminal window and give you a new replacement prompt . However, all the macros / atoms that you previously defined will still be in memory, so this is just "cosmetic."

+17
Sep 03 '10 at 15:19
source share

Trimming to clear the entire buffer: C - u C - C C - o

Shortcut to clear the last output: C - C C - o

Please note that the old way: C - C M - o

+4
Dec 16 '15 at 12:44
source share

If you are using Emacs + nREPL , you can:

  • Run M x nrepl-clear-buffer or
  • Run C C M o

If key binding is not enabled, run M x nrepl-interaction-mode to enable it. You can find other useful shortcuts in nrepl.el and / or customize key bindings to suit your needs.

Note. You can find all the nREPL key nREPL on your system by running Mx v nrepl-mode-map and following the link nrepl.el .

+3
May 25 '13 at 21:51
source share

I am using the Emacs cider-repl-clear-buffer command through Mx . You can also use cider-repl-clear-output with the prefix argument: Cu Cc Co.

+2
Mar 23 '16 at 12:43
source share

It depends on what you mean by "clean." To remove all namespaces in a package, you can use:

 (mapv remove-ns (map symbol (filter #(.startsWith % "org.mycompany") (map str (all-ns))))) 
0
Feb 08 '17 at 10:21
source share



All Articles