trying to use compojure, hiccup, and cljs together but while I was able to make hiccup and clojure work together, I couldn't figure out how clojurescript would work with hiccup... I don't even know very much of how clojurescript works and can anyone forward me to some resource?
There's also #clojurescript which might be a good place to ask more specific questions related to ClojureScript
Thanks @andy.fingerhut for the useful commentary. I'm taking a look at all the uses of resolve
in my program. There seem to be two cases. 1) where I'm trying to determine whether a given symbol names a class, and 2) where the given symbol names a type predicate such as list?
. I've refactored these two cases into their own functions. find-class
and callable-designator?
... this means if I discover later that I have a subtle bug in the either semantic, I can refactor it in one single place.
Have you looked through the official reference docs and guides yet? https://clojurescript.org/reference/documentation https://clojurescript.org/guides/quick-start
does anyone know of a clojure system named genus ? I need a clever and somewhat abstract name for a package which I intend to eventually publish. I dont want to take a name that already means something to someone. Naming is hard.
maybe u can search it on clojure toolbox?
@jimka.issy and no I couldn't find one named genus
I did a google search for clojure and genus and didn't find anything. I didn't specifically try clojure toolbox.
my other option is compositus not sure yet.
that's also unfound in clojure toolbox
I don't no too much but I think u can change the name afterwards? not sure tho depends on how you develop it but if it is not on google or clojure-toolbox, then I think you should be fine
For compojure, I am trying to use jetty webserver as I've seen in practicalli's tutorial, and when I use the default compojure lein template, it uses ring server. I want to change it to jetty, can someone help me? like a code snippet would be greatly appreciated. (I tried code myself but none of them really worked)..
clojure libraries often follow naming convention taken from java (e.g. org.clojure/clojure
)
this is the way how to make your library name unique
most recent version of clojure cli even start warn developers about using unqualified lib names
DEPRECATED: Libs must be qualified, change clj-http => clj-http/clj-http
I think if people want to be squeaky clean, and/or if you ask them how in Java and Clojure land to keep library/artifact names unique, they would agree that using reverse DNS names as a group, and a separate name as an artifact, is a good idea. There certainly are a heck of a lot of Clojure libraries that haven't bothered with the reverse DNS names, of course. I suspect that has more to do with expediency and/or lack of awareness than anyone advocating for the current state.
i suppose there are really two questions hidden in my question. 1) How do I conform to the correct semantics of naming so as to avoid name clashes? and 2) how to choose a name which is colloquially distinct?
as per #2, i could certainly name my library spec
with the appropriate reverse dns name. However, that would not be culturally compatible with clojure social community.
A part of DNS naming which I don't understand is where does the DNS path need to come from. If I use, for example, the name of my research institute, what should have if I change employer in the future? Would I need to fork and rename? Or do I really need to create a personal DNS independent from my location, employer etc?
a personal DNS is a bit hard to justify, being that I don't even have anything at the moment to publish
Yeah, spec
would be a poor choice, even with the reverse DNS name as a group. Google searches for "clojure genus", or whatever project name you are interested in using, is certainly one good filter, as well as asking here if you are worried about it. Very rarely, things fall through the cracks, and someone renames a project as a result. At least, I've heard of that happening for libraries in other languages.
Personal DNS names are about $10/year, if I recall correctly.
At least, the uncontested ones are.
you do not need personal DNS to name your library
Agreed that it isn't a requirement, but neither is it a requirement to make a group id that is different than the name of the library.
for instance I can use me.delaguardo
as a qualifier for my libs without actually paying for http://delaguardo.me
I just installed lein, Clojure and Cursive on Windows 10 and was able to launch REPL. All right but what I'm looking for is Clojurescript with figwheel-main.
I tried using the template but could not install cli and lein doesn't understand "lein fig:build". Pretty sure that somebody had thesame problem, Am I right? Any clue ? Thanks.
https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows for clojure cli you could try this guide and take a look at known issues here β https://clojure.atlassian.net/jira/software/c/projects/TDEPS/issues
Hi ! how can i optimize my clojure code for math operations or basically find out where type information can help ?
One good resource for Clojure performance in general is http://clojure-goes-fast.com/
If you are interested in arithmetic on Clojure on the JVM and want to use Java primitive types long
and/or double
wherever possible, this library might be helpful: https://github.com/ztellman/primitive-math
@shriyansbhatnagar Maybe also check this QA on SO: https://stackoverflow.com/questions/34153369/why-is-this-clojure-program-working-on-a-mutable-array-so-slow
This is a simple project that uses Leiningen and figwheel-main. The readme explains how the project was created and how to use it https://github.com/practicalli/practicalli-landing-page
Here is an example of using jetty as a web server https://practicalli.github.io/clojure-webapps/projects/leiningen/todo-app/create-a-webserver-with-ring/add-a-jetty-webserver.html
Itβs for a Leiningen project, but apart from dependencies it works the same for Clojure CLI tools. Feel free to @ mention me or use the #practicalli channel for help
thanks a lot π
@andy.fingerhut ahh primitive math looks great.
but this wonβt work with clojurescript right ?
i forgot mentioning a key detail, this code is intended to work with both clojure and clojurescript
basically this is the library
https://github.com/shrynx/circle-packing
i intended to use it with quil (processing wrapper) on both clj and cljs,
but the same algorithm when written in javascript is quite faster.
is there a way to optimise for both clj and cljs
@borkdude iβll go through the link, thank you.
(set! warn-on-reflection true)`` looks pretty useful and probably what i need
The compojure template does hide some details, I thought it did use jetty by default but the details are probably in one of the libraries its using.
I have a piece of code represented by class, not under my control and I want to give it a deref
capability, similar to how Futures are treated in core
. It seems that the only way to do it is write an adapter. There is no protocol to give it such capability adhoc. Is it a correct observation?
I know almost nothing about trying to optimize ClojureScript or JavaScript. You could try asking in the #clojurescript channel.
I notice that when running lein ring uberjar
to packing up a project created with lein new compojure todo-app
it downloads the ring/ring-jetty-adapter
library, so it seems that project its already using jetty, it just hides that fact under a few abstractions.
Hey folks! Need a little bit of beginner help with regads to sorting. I have the following structure {[2019 10] 21, [2020 9] 17}
where format of each item is "[year month] amount". How best to sort this structure such that I have the latest "month" last?
BTW. This how I'm forming this if it helps.
(->> data (map #(assoc % :grouping [(:year %) (:month %)]))
(group-by :grouping)
(map (fn [[g t]]
[g (->> t (map :amount) (reduce +))]))
(into {})))
I'm currently looking at sorted-map for this. Am I on the right track?
(group-by (juxt :year :month))
is shorter π
e.g. no need for the first map
Thanks @vlaaad. Does that help with ensuring the order in the end?
Nope π
what do you mean having latest month last?
sort by month, then by year?
you can use (into (sorted-map))
instead of (into {})
to sort by keys
By year then month. Sorry should have been more clear π
so just (into (sorted-map))
then?
Cool tried that earlier. Didn't seem to work unfortunatly
how so?
user=> (->> data
(group-by (juxt :year :month))
(map (juxt key #(->> % val (map :amount) (reduce +))))
(into (sorted-map)))
{[2019 10] 21, [2020 9] 17}
hmm let me try again.
so I should basically be fine with the default condition the template is in?
In a namespace named bdd
I'd like to define functions and, or, not. Externally, for users of the library, they'd :`require [clojure-rte.bdd :as bdd]` and then refer to the functions as bdd/and
, bdd/or
, and bdd/not
. The problem is that I cannot pass a qualified name to defn
it requires its first argument to be a simple symbol. What is the correct way to do this?
;; given
(ns foo
(:refer-clojure :exclude [and or]))
(def and :and)
;; then
foo/and
=> :and
then youβll need to be careful in foo
ns since there and
and or
mean different thing
Yes that's really tricky. currently I've named the functions bdd-and
, bdd-or
, and bdd-not
. And externally they're referred to as bdd/bdd-and
bdd/bdd-or
and bdd/bdd-not
which is ugly and inconsistent
how would I refer to the clojure.core/and etc from inside my bdd file?
You can do (alias 'c 'clojure.core)
and then you can use c/and
and c/or
to use clojureβs and
and or
this is how clojure.spec is writtern
e.g. https://github.com/clojure/spec.alpha/blob/master/src/main/clojure/clojure/spec/alpha.clj#L9-L22
Thanks. that example helps
OK, so now I'm getting to a part which I wrote and it works, but I really don't understand. What about this function: does the quoted and
need to be c/and
or just and
?
(defn dnf
"Serialize a Bdd to dnf disjunctive normal form.
This dnf form is cleaned up so that an (and ...) or (or ...) clause contains
no subtype/supertype pairs. This subtype relation is determined by
(gns/subtype? a b (constantly false)).
"
[bdd]
(letfn [(pretty-and [args]
(cond
(empty? args) :sigma
(empty? (rest args)) (first args)
:else (cons 'and args)))
(pretty-or [args]
(cond
(empty? args) :empty-set
(empty? (rest args)) (first args)
:else (cons 'or args)))
...]
...))
Fine in that it is using jetty and you are happy using the lein ring xxx commands to run the server externally.
I think the compojure template included wrap-reload as part of the wrap-defaults, so when running the server with lein ring server
it should automatically reload any code changes that are called from the defroutes
function and in the defroutes funciton itself.
And if you want to package up the application, then ensure lein ring uberjar
is used to generate the jar file, otherwise the jar file will not include the code that lein ring server automatically injects.
I moved away from lein ring plugin a while ago, but its convenient for getting started.
I.e., I don't really understand which symbols get name-space-ized by the reader/compiler and which ones don't
Correct, it needs to implement IDeref
It seems the system doesn't attach a namespace to a quoted and
like this.
(namespace 'and)
;; => nil
BTW this is a big difference between clojure an Common Lisp which trips me up often.
'and
is just a symbol not a var
@delaguardo can you explain to me how I can tell. I've tried to understand this, but it keeps tripping me up.
'
is a quotation mark in clojure reader β https://clojure.org/reference/reader#_quote
it expand into (quote foo)
from documentation https://clojuredocs.org/clojure.core/quote
it yields unevaluated form which is a symbol foo
yes I understand that the quotation mark reads as (quote foo)
that's the same as emacs lisp and Common Lisp. The difference is that Common Lisp reads the foo into a namespace regardless of the surrounding forms. The forms are constructed after the symbol is read in Common Lisp. Somehow, in clojure, the form is constructed before the namespace is assigned, or not-assigned in this case.
For example in a top level form such as the following (def xyzzy
(and or not))` in clojure the and
,`or`, and not
all get read into a namespace. likewise (def xyzzy
(and or not))` . To prevent this I have to use ~'
as follows g (def xyzzy
(~'and 'or 'not))` ...
perhaps my claim "read into a namespace" is wrong. I'm not sure what the reader does, but in the end result, the value xyzzy
is a list containing three symbols from clojure.core
in the first case, but in no namespace in the second case.
Syntax-quote, i.e. backquote, in Clojure by default namespace-qualifies all symbols inside of it, unless they are also explicitly namespace qualified. As you show above, that can be prevented using ~'
before such symbols inside of the syntax-quote expression.
The Common Lisp reader interns symbols into packages and creates value cells for them at read time. Clojure's reader does not put symbols into any package or namespace.
That is, reading a symbol does not automatically create a Clojure Var.
@andy.fingerhut that's a good explanation.
what does "all symbols inside it mean" ?
I got it, or something close to it, from Rich Hickey's 2008 talk Clojure: An Introduction for Lisp Programmers, where he makes an attempt to briefly explain this difference between Clojure and Common Lisp, and why he chose to make it different than Common Lisp. You might find it useful: https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/ClojureIntroForLispProgrammers.md
for example it seems that it somehow notices quote and prunes its search for symbols at that point.
`(a back quoted list of symbols in name spaces (even these in name spaces) '(but not these))
all symbols inside the syntax-quote, unless they are quoted with quote, would be at least one step closer to a full explanation. [edit: if anyone is following along later, this statement is incorrect -- later messages say things that are at least closer to correct]
@andy.fingerhut I've watched that video a couple of times when just starting out with clojure. But you're right, it might be a good idea to watch again after becoming familiar with clojure.
Regarding your original question about users doing :require [clojure-rte.bdd :as bdd]
, and then your users would refer to functions as bdd/and
, bdd/or
, etc., that is exactly what will happen if inside of namespace clojure-rte.bdd
, you do (defn and [ ...] ...)
etc.
Very interesting that the quote prunes the name spacing, but doesn't prune the ~
interpolation
(def xyzzy 100)
;; => #'clojure-rte.core/xyzzy
`(~xyzzy)
;; => (100)
`('(~xyzzy))
;; => ('(100))
anyone know how to run codox from deps.edn clojure command line ?
Inside of namespace clojure-rte.bdd
's ns
form, you would want to not import clojure.core
's and
, or
, etc. which can be done with a clause like (:refer-clojure :exclude [and or not])
, to avoid a warning (or error?) that your defn's for and
etc. collide with the ones in clojure.core
@andy.fingerhut yes that's what I'm doing now. Still running tests, but followed the model in https://github.com/clojure/spec.alpha/blob/master/src/main/clojure/clojure/spec/alpha.clj#L9-L22 suggested by @vlaaad
After doing such a :refer-clojure
clause, you can still explicitly name the and
in ns clojure.core
using clojure.core/and
, if you need to use it from inside of a namespace that has done (:refer-clojure :exclude [and])
Regarding your comment: "Very interesting that the quote prunes the name spacing, but doesn't prune theΒ `~`Β interpolation", syntax-quote is a read-time construct, as is replacing `'expr` with `(quote expr)`. `~` also performs its effect at read time.
Probably "performs its effect" is a poor choice of words there -- I do not mean in the sense of mutating a thing / side effects vs. pure function.
Actually, I still get different results again that I expect. Apparently the quote DOES NOT prune name spacing.
(first `('(and ~xyzzy or )))
;; => '(clojure.core/and 100 clojure.core/or)
(second (first `('(and ~xyzzy or ))))
;; => (clojure.core/and 100 clojure.core/or)
why do and
and or
get namespaces here?My apologies, I probably said some things that were incorrect earlier. I don't do syntax-quote terribly often, and so neglected to remind myself some of the details before speaking as if I did remember.
user=> (def x 5)
#'user/x
user=> `(and x or)
(clojure.core/and user/x clojure.core/or)
user=> `(and ~x or)
(clojure.core/and 5 clojure.core/or)
user=> `(~'and ~x or)
(and 5 clojure.core/or)
This reference is accurate: https://clojure.org/reference/reader#syntax-quote. A consequence of what it says there is that you can effectively use ~'something
inside of a syntax-quoted expression to mean the same thing (I think) as 'something
outside of a syntax-quoted expression.
If you want to see one extra intermediate step that is not shown above, which is what the reader reads for a syntax-quoted expression, without Clojure's eval
involved, put (quote ...)
around the syntax-quoted expression at the REPL, or precede it with a '
, e.g.
user=> (def x 5)
#'user/x
user=> `(and x or)
(clojure.core/and user/x clojure.core/or)
user=> `(and ~x or)
(clojure.core/and 5 clojure.core/or)
user=> `(~'and ~x or)
(and 5 clojure.core/or)
user=> '`(~'and ~x or)
(clojure.core/seq (clojure.core/concat (clojure.core/list (quote and)) (clojure.core/list x) (clojure.core/list (quote clojure.core/or))))
The last output is the result of only reading the syntax-quoted expression. The one just before that is the result of calling eval
on the last output.
And yes, the output from just the reader can be long and nasty-looking.
So my claim earlier was wrong:
`(a back quoted list of symbols in name spaces (even these in name spaces) '(but not these)) ;; this is wrong
should be the following
`(a back quoted list of symbols in name spaces (even these in name spaces) '(and even these))
@andy.fingerhut so according to your last experiment, the reader DID put the symbols into namespaces. notice the clojure.core/list
and clojure.core/or
. it's just that reading a backquote effects/modifies/changes/modalizes the behaviour of the reader.
It did fully qualify the symbols with namespaces. It did not intern them into those namespaces, nor create Vars, as a side effect of reading.
Clojure symbols, fully qualified with a namespace or not, do not automatically have mutable state associated with them, as they do in Common Lisp.
and the reader knew to fully qualify some of the symbols but not all of them.
But yes, if you want to avoid a symbol becoming fully qualified within a syntax-quote expression, one way is to prefix it with ~'some-symbol
is it simply the quote followed by a symbol which tells the reader to not qualify, or it is more subtle than that?
It is the ~
unquote that at least approximately means "for the following sub-expression, stop syntax-quoting"
You can follow the ~
with something like x
, and then x
will be read without becoming fully-qualified by the reader, but that x
will be eval
'd if you then eval the read result.
it seems you are right the only and
which doesn't get namespace-iced is the one after the tilde.
'`(and ~'and 'and '(and) (and) ('and))
;; =>
(clojure.core/seq
(clojure.core/concat
(clojure.core/list 'clojure.core/and)
(clojure.core/list 'and)
(clojure.core/list
(clojure.core/seq
(clojure.core/concat
(clojure.core/list 'quote)
(clojure.core/list 'clojure.core/and))))
(clojure.core/list
(clojure.core/seq
(clojure.core/concat
(clojure.core/list 'quote)
(clojure.core/list
(clojure.core/seq
(clojure.core/concat
(clojure.core/list 'clojure.core/and)))))))
(clojure.core/list
(clojure.core/seq
(clojure.core/concat (clojure.core/list 'clojure.core/and))))
(clojure.core/list
(clojure.core/seq
(clojure.core/concat
(clojure.core/list
(clojure.core/seq
(clojure.core/concat
(clojure.core/list 'quote)
(clojure.core/list 'clojure.core/and)))))))))
It gets even harder to keep straight if you nest syntax-quoted expressions within each other, which I highly anti-recommend π
Note that syntax-quoting is intended to be a convenience, most often when writing simple macros. You could remove syntax-quote from Clojure entirely, and still be able to write every macro that can be written today, albeit with more code.
e.g. the kind of code you see in your most recent comment above.
Yes, I think you are right. in clojure, backquote has been optimised for macros, thus unfortunately pessimizing it for non-macro use.
in Common Lisp it can equally usefully be used to construct lists by interpolation and splicing.
anyway, it seems the comment by @delaguardo was not actually correct. Or did I misread it claiming it was related to the quote. It's actually related to the tilde.
I certainly made an incorrect comment earlier, related to that. Not sure which statement by delaguardo you are referring to.
besides, even if the behaviour is pessimized for list interpolation, it is still good to better understand the semantics
I am not clear why you say Clojure's syntax-quote is pessimized for non-macro use, but if it is because of the fully-qualifying symbols, then no argument that is a significant difference between Clojure's and Common Lisp's syntax quote, by design.
Certainly outside of syntax quote those statements are true. The first is true inside of syntax quote, too.
The second expansion from 'foo
to (quote foo)
is true inside of syntax-quote, but inside of syntax-quote, the syntax-quote processing can still descend into foo
at read time.
Clearly macro use is by far the most common case of backquote, even in Common Lisp. So perhaps Clojure's decision to optimise for that is not such a bad decision. However, what I mean by the comment is that in CL I can use backquote to create list as if by normal quote, but just interpolate data into the otherwise quoted list using the , and ,@ (in clojure that's and @). Otherwise the behaviour of single quote and backquote are much the same. Another difference is that backquote is run-time allocating and normal quote is compile-time allocating.
It might be true that the only way to stop syntax quote from mucking with things is to preceded the subexpression that one wants to avoid its special behavior with ~
or ~@
in time I'll get used to ~'.
If it helps understand it at all (you probably already realize this), ~'
has no special meaning apart from their separate meanings as ~
followed by '
.
it is bizarre though that single quoted data inside a backquote has much different semantics than single quoted data outside the backquote.
(defmacro foo [x] `(~x '(and or not)))
vs
(defmacro foo [x] (list x '(and or not)))
Common Lisp also often requires one to make a clear distinction between read time, compile time, evaluation time, etc. This is an example where in Clojure it helps to make a clear distinction between them.
'
prevents eval
from evaluating. It doesn't stop syntax-quote from doing its read-time thing.
I think you can view the semantics of quote as identical in those two cases, as long as you define what ~
and '
and syntax-quote do at read time.
ah ha, just that the ~ prevents the reader from name spacing the symbols
it would be nice to have a non-namespacing backquote. π
I think that is something the application programmer cannot write himself. as it would require an enhancement to the parser
Agreed that adding such a feature would require modifying Clojure's reader implementation, written in Java.
aaakkkkk
And in case you are wondering, the developers of Clojure probably wouldn't want anything like that in the official Clojure release. I haven't asked them that particular question -- just my educated guess.
you're probably right, and it's a shame because interpolating lists is powerful.
BTW is there a syntax for a non-namespaced symbol? to distinguish it from a symbol whose namespace is implicit?
A symbol either has a namespace, or it doesn't.
exactly, but if you use the syntax such as abc/xyz
it refers to a symbol in a particular namespace. and if *ns*
is abc
and that namespace already contains the symbol xyz
, then typing xyz
at the prompt refers to that symbol. So I can specify which namespace I want, but I cannot specify that I want no namespace. If I understand correctly
syntax-quote adds a namespace at read time to most symbols inside of it, unless unquoted.
resolve
takes a symbol, which might have no namespace, a namespace alias, or a fully qualified namespace, and figures out which fully qualified namespace it should refer to, but resolve
is not called on symbols when used only as data (i.e. when the symbol is not used in code).
Outside of syntax-quote, and when used as data that is not compiled, symbol abc/xyz
is the symbol abc/xyz
, with no changes.
oh really, abc/xyz
is the symbol whose print-name has 7 characters? I wouldn't have guessed that
user=> (require '[<http://clojure.java.io|clojure.java.io> :as io])
nil
user=> io/resource
#object[<http://clojure.java.io|clojure.java.io>$resource 0x736caf7a "<http://clojure.java.io|clojure.java.io>$resource@736caf7a"]
user=> (println 'io/resource)
io/resource
nil
The last occurrence of io/resource is just data, with no reason to resolve it.
but the namespace
function says its namespace is "io"
There are calls you can make to ask for its 'namespace' part and its 'name' part, but that doesn't imply that there is a namespace named io
namespace
and name
are just getters for those two parts of a symbol.
now anyone must admit that that is confusing, if namespace
can return the name of a non-existent namespace.
especially if the symbol has a slot for namespace-name rather than a slot for namespace.
I agree it can be confusing.
doesn't sound very rich-like.
Ah that worked! Thanks @vlaaad :) appreciate the assistance.
No problem :)
Whatβs the idiomatic way to map a function into a nested collection? For example, in Haskell Iβd do:
=> (map . map) (+ 1) [[1, 2], [3, 4]]
[[2, 3], [4, 5]]
The best I could come up with in clojure was:
user=> (((comp #(partial map %) #(partial map %)) inc) [[1 2][3 4]])
but that seems pretty uglyI reach for Specter for these kind of things: (transform [ALL ALL] your-fn your-coll)
clojure.walk/post-replace is probably the best core option
Rich has been on record as saying something that I will paraphrase here, because I do not have a quote handy at the moment: It is OK to design programming languages intended for expert users, even if sometimes that means they are more difficult to learn.
How would you use that to apply a function to every element? AFAICT postwalk-replace
only does value replacements
If you want actual quotes of things he said, he goes into that in this talk: https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/DesignCompositionPerformance-mostly-text.md
it walks every element
that's the whole point
oh, you might need postwalk if you're applying a function, sorry if that's what you were asking
like (clojure.walk/postwalk #(if (number? %) (inc %) %) the-data)
aha, that does it
http://java.io.FileNotFoundException: I thought I knew how to load project-local .clj namespaces, but the errors tell me I'm missing something. https://pastebin.com/raw/s8ZLQEaM (It was ~40 lines, IDK etiqutte about posting long posts vs pastebin)
what are you doing when hitting this error?
lein ring server
Weird part to me is in REPL evaluating (auth.views.login/login-view) gives me the map I want. But running as server it claims to not know where it is, either in a ns :require or as a fully qualified ns/fn
what's the entry of :source-paths
in your project.clj?
Not present
(GET "/login" []
(auth.views.login/login))
It is not good practice to reference namespaces without requiring them. Depending on the path through the code, you may end up trying to use that symbol reference before the ns it lives in has been loaded.(I didn't see auth.views.login
in the :require
in auth.token
-- although you did omit some of that from the paste)
your error message complained about looking for views/login.clj
. How are you requiring that ns?
Required in ns declaration like so
(:require
[auth.views.login :as login] ...)
when I eval (ns ...) in repl I get
1. Unhandled java.io.FileNotFoundException
Could not locate auth/views/login__init.class, auth/views/login.clj
or auth/views/login.cljc on classpath.
whilst lein ring server
errors out and points to line containing (auth.views.login/login)
or (login/login)
`
Syntax error (FileNotFoundException) compiling at (/tmp/form-init7302222187445651419.clj:1:73).
Could not locate auth/token__init.class, auth/token.clj or auth/token.cljc on classpath.
avoid lein ringer server for now and just start a repl. then at the repl try (require '[auth.views.login :as login])
this would keep it as simple as possible. if that works you should be good to go. if not, then lein ring server will be just more machinery obscuring what is going on
and can you tell me how you're starting the repl and from what directory?
$PROJECT_DIR/src/auth is where I'm running lein ring server
and I start the repl from inside emacs daeomon with cider-jack-in
run it from the root directory
when using cider-jack-in
did you try (at a fresh repl) (require '[auth.views.login :as login])
?
Yes.
(require '[auth.views.login :as login])
1. Unhandled java.io.FileNotFoundException
Could not locate auth/views/login__init.class, auth/views/login.clj
or auth/views/login.cljc on classpath.
Run at $PROJECT_DIR has no difference afaict
Could not locate auth/token__init.class, auth/token.clj or auth/token.cljc on classpath.
Full report at:
/tmp/clojure-5505124517661228879.edn
Subprocess failed (exit code: 1)
the the login.clj file is located at PROJECT_ROOT/src/auth/views/login.clj
?
yes exactly
is this public?
I will make it so, brb
Uhh... In an effort to extract out the contentious parts I accidently fixed it. Dunno how. Thanks so much though!\
that's a good description of debugging