我是通过和Quil玩来学ClojureScript的。当我试图在这个Quil示例中实现ClojureScript时,我收到了错误消息:No such namespace: quil.helpers.seqs。
可以通过使用lein:lein new quil-cljs quil-helpers创建一个新项目并尝试在core.cljs文件中使用quil.helpers.seqs中的一个函数来再现此错误。
我为什么要犯这个错误?
下面是我尝试使用来自这个命名空间的函数的core.cljs文件:
(ns quil-helpers.core
(:require [quil.core :as q :include-macros true]
[quil.helpers.seqs :as s]
[quil.middleware :as m]))
(defn draw [state]
(s/range-incl 0 10)
(q/background 200)
(q/ellipse 200 200 100 100))
(defn ^:export run-sketch []
(q/defsketch quil-helpers
:host "quil-helpers"
:size [500 500]
:draw draw
:middleware [m/fun-mode]))下面是lein生成的project.clj文件:
(defproject quil-helpers "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.10.1"]
[quil "3.1.0"]
[org.clojure/clojurescript "1.10.520"]]
:plugins [[lein-cljsbuild "1.1.7"]
[lein-figwheel "0.5.19"]]
:hooks [leiningen.cljsbuild]
:clean-targets ^{:protect false} ["resources/public/js"]
:cljsbuild
{:builds [; development build with figwheel hot swap
{:id "development"
:source-paths ["src"]
:figwheel true
:compiler
{:main "quil_helpers.core"
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/development"
:asset-path "js/development"}}
; minified and bundled build for deployment
{:id "optimized"
:source-paths ["src"]
:compiler
{:main "quil_helpers.core"
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/optimized"
:asset-path "js/optimized"
:optimizations :advanced}}]})发布于 2022-10-14 21:06:44
如您所见,在回购中是一个CLJ名称空间--您不能像在CLJS中那样使用它。但是不知道为什么它是一个CLJ似乎没有什么JVM特定的,所以也许它是值得创建一个特性请求。
https://stackoverflow.com/questions/74074822
复制相似问题