clojure需要isn';t设置名称空间oauth
如何测试require是否在clojure中工作。REPL中的Require返回nil。我不知道零是否意味着它起作用了。oauth的名称空间似乎未设置 错误 原因:java.lang.RuntimeException:没有这样的命名空间:oauthclojure需要isn';t设置名称空间oauth,clojure,Clojure,如何测试require是否在clojure中工作。REPL中的Require返回nil。我不知道零是否意味着它起作用了。oauth的名称空间似乎未设置 错误 原因:java.lang.RuntimeException:没有这样的命名空间:oauth (ns hello.core) (defn -main [] (require 'twitter '[oauth.client :as oauth]) ;; Make a OAuth consumer (def oauth-con
(ns hello.core)
(defn -main
[]
(require 'twitter '[oauth.client :as oauth])
;; Make a OAuth consumer
(def oauth-consumer (oauth/make-consumer <key>
<secret>
"https://api.twitter.com/oauth/request_token"
"https://api.twitter.com/oauth/access_token"
"https://api.twitter.com/oauth/authorize"
:hmac-sha1))
(ns hello.core)
(defn-main)
[]
(需要“twitter”[oauth.client:作为oauth])
做一个真正的消费者
(def oauth耗电元件(oauth/make耗电元件
"https://api.twitter.com/oauth/request_token"
"https://api.twitter.com/oauth/access_token"
"https://api.twitter.com/oauth/authorize"
:hmac-sha1)
将require
放在-main
函数中不起作用;必须在文件求值时求值,才能识别名称空间别名。您应该将其放在ns
表单中:
(ns hello.core
(:require [oauth.client :as oauth]
[twitter]))
将
require
放在-main
函数中不起作用;必须在文件求值时求值,才能识别名称空间别名。您应该将其放在ns
表单中:
(ns hello.core
(:require [oauth.client :as oauth]
[twitter]))
要添加到Sam的答案中,请注意repl环境和.clj文件中的不同
要添加到Sam的答案中,请注意repl环境和.clj文件中的差异 (ns hello.core)(需要文档中的“twitter”[oauth.client:as oauth])@glochild:“在
ns
宏中使用:需要,而不是直接调用它。”(ns hello.core)(需要文档中的“twitter”[oauth.client:as oauth])@glochild:“使用:在ns
宏中要求,而不是直接调用此宏。”