I am learning ClojureScript by playing around with Quil. When I attempted to implement this Quil example in ClojureScript, I got the error message: No such namespace: quil.helpers.seqs
.
The error can be reproduced by creating a new project with lein: lein new quil-cljs quil-helpers
and attempting to use a function from quil.helpers.seqs
in the core.cljs
file.
Why am I getting this error?
Here's the core.cljs
file where I attempt to use a function from this namespace:
(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]))
Here's the project.clj file generated by lein:
(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}}]})
As you can see in the repo, quil.helpers.seqs
is a CLJ namespace - you can't use it just like that in CLJS. But no idea why it's a CLJ NS - doesn't seem like there's anything JVM-specific, so maybe it's worth creating a feature request.