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

Clojure Repl-有没有办法查看在REPL会话中定义了哪些变量(因此可用)?

(Clojure Repl - 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

如果我一直在玩Clojure REPL(可能一直在尝试(assoc)或(seq)或(reduce)并创建了一些临时映射作为示例),但想打印该会话中定义的变量列表,有没有办法做到这一点?像(println def)之类的东西?

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

(dir user)如果你在user名称空间中,则可以使用或你感兴趣的任何其他ns。这将显示所有def-ed内容。如果不存在(通常use在REPL中自动获得ed,你可以在中找到它clojure.repl/dir)。