如何测试require是否在clojure中工作.REPL中的要求返回nil.我不知道零是否意味着它有效.oauth的命名空间似乎没有设置.
错误
引起:java.lang.RuntimeException:没有这样的命名空间:oauth
(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))
Run Code Online (Sandbox Code Playgroud)
它不适合require
你的-main
功能; 在评估文件时必须对其进行评估,以便识别命名空间别名.你应该把它放在你的ns
表格中:
(ns hello.core
(:require [oauth.client :as oauth]
[twitter]))
Run Code Online (Sandbox Code Playgroud)