Warm tip: This article is reproduced from serverfault.com, please click

Is there a way to see what variables have been defined (and are thus available) in a REPL session?

发布于 2020-12-01 18:04:30

If I've been playing around in a clojure REPL (might have been experimenting with (assoc) or (seq) or (reduce) and created some temporary maps for examples), but wanted to print a listing of variables defined in that session, is there a way to do this? Something like (println def) or something?

Questioner
mrjbj
Viewed
0
cfrick 2020-12-02 02:18:59

You can use (dir user) if you are in the user namespace. Or any other ns you are interested into. This shows you all the def-ed things. If it's not there (it usually gets useed automatically in the REPL, you can find it in clojure.repl/dir).