不能;使用「;在clojurescript repl中
我在Clojurescript命名空间中键入以下内容不能;使用「;在clojurescript repl中,clojure,clojurescript,Clojure,Clojurescript,我在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.ve
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>(使用“[clojure.zip:only[insert child]”)
警告:在第1行使用未声明的Var cljs.user/Use
“计算错误:”(引用[clojure.zip:only[insert child]]):作为“cljs.user.use.call(null,cljs.core.vec([\”\\uFDD1'clojure.zip\,\“\\uFDD0'only\”,cljs.core.vec([\”\\uFDD1'insert-child\]));\n”
#
TypeError:无法调用未定义的方法“call”
在评估时(评估时)(http://localhost:3000/main.js:32728:147), :1:85)
在评估时(评估时)(http://localhost:3000/main.js:32728:147), :6:3)
在http://localhost:3000/main.js:32728:142
至少(http://localhost:3000/main.js:32741:4)
在Object.callback(http://localhost:3000/main.js:32806:138)
在goog.messaging.AbstractChannel.deliver(http://localhost:3000/main.js:31059:13)
在goog.net.xpc.CrossPageChannel.deliver\u(http://localhost:3000/main.js:32164:14)
在Function.goog.net.xpc.NativeMessagingTransport.messageReceived\u(http://localhost:3000/main.js:31732:13)
在goog.events.Listener.handleEvent(http://localhost:3000/main.js:22590:26)
在Object.goog.events.fireListener(http://localhost:3000/main.js:22924:21)
无
它似乎在说明cljs.user命名空间中不存在“use”方法。这对我来说很有意义,因为Clojurescript本身无法计算Clojure表达式。但是,我知道Clojurescript有一个clojure.zip名称空间,我在名称空间声明中使用了clojure.zip作为(:使用[clojure.zip:only[insert child]])
如何在Clojurescript repl中使用Clojurescript版本的clojure.zip 因为ClojureScript命名空间的实现方式与Clojure完全不同,所以ClojureScript不支持直接使用
或require
表单
相反,必须使用ns
宏。要在cljs.user
命名空间中使用clojure.zip
,只需执行以下操作:
(ns cljs.user (:use [clojure.zip :only [insert-child]]))
请注意,ClojureScript版本的ns
中支持的表单是Clojure中支持的表单的子集;具体来说,<代码>:使用子句必须指定< <代码> >,并且<代码>:要求< /Cord>子句必须指定<代码>:作为< /代码>窗体。只需一个抬头,我就在2016中碰到这个问题,尝试<代码>(要求…)>代码>在我的代码中间的一些调试工具。