This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-07-06
Channels
- # beginners (20)
- # boot (221)
- # cider (16)
- # clojure (140)
- # clojure-berlin (2)
- # clojure-dev (2)
- # clojure-germany (2)
- # clojure-japan (4)
- # clojure-korea (44)
- # clojure-russia (2)
- # clojure-uk (6)
- # clojurescript (202)
- # core-async (7)
- # datomic (9)
- # editors (1)
- # euroclojure (3)
- # ldnclj (21)
- # liberator (4)
- # off-topic (4)
- # om (8)
- # reagent (17)
Running into (what I assume is) a basic issue with cljc files, and any help would be appreciated.
I currently have a file called src/cljc/calculations.cljc
, with a ns of:
(ns ef.calculations)
And a file called src/cljs/view.cljs
which requires it.
In my project.clj:
:cljsbuild {:builds {:app {:source-paths ["src/cljs"
"src/cljc"]
:compiler {:output-to "resources/public/js/app.js"
:output-dir "resources/public/js/out"
:asset-path "js/out"
:optimizations :none
:pretty-print true}}}}
But, when I run lein cljsbuild once app
I get the following error
Caused by: clojure.lang.ExceptionInfo: No such namespace: ef.calculations, could not locate ef/calculations.cljs, ef/calculations.cljc, or Closure namespace “ef.calculations" at line 1 src/cljs/ef/view.cljs {:file "src/cljs/ef/view.cljs", :line 1, :column 1, :tag :cljs/analysis-error}
Any ideas?
shouldn't the file be at src/cljc/ef/calculations.cljc ?
I knew it’d be stupidly simple Thanks @alexmiller
I'm trying to wrap my head around two functions that I'm seeing a lot of in my cljs'ing
Is there any analogy that could be drawn to some imperative OO-style concept with regards to these fn's and their use?
You can think of defprotocol
sort of like an interface in Java, if that helps.
Then reify
creates an "object instance" on the fly (at runtime) that implements the interface.
A bit like making an anonymous class object I guess…?
Thanks @seancorfield! You're in here an awful lot helping people out with silly questions like this, I greatly appreciate your generosity
I’m in eight Slack teams (including one for work) — and I know what it’s like to be a beginner in a language (as I try to learn a new one every year)