Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
566 views
in Technique[技术] by (71.8m points)

emacs - How to use clojure doc function?

I'm just starting with Clojure and can't access to the doc function.

I'm using clojure 1.3 with emacs24 and swank-clojure.

user> *clojure-version*
{:major 1, :minor 3, :incremental 0, :qualifier nil}

But when I try:

(doc doc)

I get:

Unable to resolve symbol: doc in this context
[Thrown class java.lang.RuntimeException]

I've read Why does REPL treat clojure.core/doc as a var? and as suggested:

(clojure.repl/doc doc)

But then, I receive:

clojure.repl
[Thrown class java.lang.ClassNotFoundException]

It seems I am not "importing" the usual namespaces, but really doesn't know how to do it.

Thanks.

UPDATE

Using clojure from java (java -jar ...) it works well, so it's a problem with the emacs setup.

question from:https://stackoverflow.com/questions/8332611/how-to-use-clojure-doc-function

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to grab the clojure.repl namespace one way or another:

From the REPL

user> (use 'clojure.repl)
user> (doc doc)

or in your program

(ns foobar
  (:use [clojure.repl]))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...