我在 Clojurescript 命名空间中键入以下内容。
cljs.user> (use '[clojure.zip :only [insert-child]])
WARNING: Use of undeclared Var cljs.user/use at line 1
"Error evaluating:" (use (quote [clojure.zip :only [insert-child]])) :as "cljs.user.use.call(null,cljs.core.vec([\"\\uFDD1'clojure.zip\",\"\\uFDD0'only\",cljs.core.vec([\"\\uFDD1'insert-child\"])]));\n"
#<TypeError: Cannot call method 'call' of undefined>
TypeError: Cannot call method 'call' of undefined
at eval (eval at <anonymous> (http://localhost:3000/main.js:32728:147), <anonymous>:1:85)
at eval (eval at <anonymous> (http://localhost:3000/main.js:32728:147), <anonymous>:6:3)
at http://localhost:3000/main.js:32728:142
at evaluate_javascript (http://localhost:3000/main.js:32741:4)
at Object.callback (http://localhost:3000/main.js:32806:138)
at goog.messaging.AbstractChannel.deliver (http://localhost:3000/main.js:31059:13)
at goog.net.xpc.CrossPageChannel.deliver_ (http://localhost:3000/main.js:32164:14)
at Function.goog.net.xpc.NativeMessagingTransport.messageReceived_ (http://localhost:3000/main.js:31732:13)
at goog.events.Listener.handleEvent (http://localhost:3000/main.js:22590:26)
at Object.goog.events.fireListener (http://localhost:3000/main.js:22924:21)
nil
似乎是在说明 cljs.user 命名空间中不存在“使用”方法。这对我来说很有意义,因为 Clojurescript 本身无法评估 Clojure 表达式。但是,我知道 Clojurescript 有一个 clojure.zip 命名空间,我在命名空间声明中使用了 clojure.zip 作为(:use [clojure.zip :only [insert-child]])
.
如何在 Clojurescript repl 中使用 Clojurescript 版本的 clojure.zip?