Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

No such namespace: quil.helpers.seqs

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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}}]})

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading