This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-14
Channels
- # aleph (2)
- # atlanta-clojurians (5)
- # beginners (38)
- # boot (2)
- # bristol-clojurians (1)
- # cider (31)
- # clara (8)
- # cljs-dev (136)
- # cljsrn (4)
- # clojure (86)
- # clojure-china (1)
- # clojure-greece (1)
- # clojure-italy (24)
- # clojure-nl (1)
- # clojure-spec (21)
- # clojure-uk (19)
- # clojurescript (68)
- # community-development (28)
- # core-async (35)
- # core-logic (4)
- # cursive (1)
- # data-science (1)
- # datascript (1)
- # datomic (46)
- # events (1)
- # figwheel (6)
- # fulcro (11)
- # graphql (3)
- # hoplon (1)
- # jobs (6)
- # jobs-discuss (94)
- # keechma (3)
- # luminus (4)
- # lumo (7)
- # mount (6)
- # off-topic (24)
- # onyx (6)
- # parinfer (31)
- # portkey (3)
- # programming-beginners (16)
- # re-frame (20)
- # reagent (69)
- # remote-jobs (4)
- # ring-swagger (25)
- # schema (1)
- # shadow-cljs (151)
- # spacemacs (2)
- # sql (14)
- # tools-deps (16)
- # uncomplicate (5)
- # unrepl (35)
- # vim (1)
- # yada (72)
@tkjone Thanks for trying out 1.10.x. You can tell the browser REPL to look for static content in your resources
directory by passing :static-dir
as a REPL option:
clj --main cljs.main --output-dir out --repl-opts '{:static-dir ["." "out" "resources"]}' --repl -h
This is currently not documented on http://clojurescript.org, but we have a PR in flight to document the browser REPL options https://github.com/mfikes/clojurescript-site/blob/issue-187/content/reference/repl-options.adoc#static-dir
Awesome. I was just looking for that piece of documentation haha
Notice that I also passed --output-dir
because in resources/index.html
it has
<script src="out/main.js" type="text/javascript"></script>
Yeah, I trying to understand that.
Is it possible to define '{:static-dir ["." "out" "resources"]}'
in the deps.edn
file...or maybe I am misunderstanding the relationship between the cli tool and the deps.edn
Is braveclojure a good place to start if one is already very familiar with Lisp?
@mfiano: if you already know lisp well, you might like "Joy of Clojure" - one of the best books out there
@noisesmith Thanks. I've been using Common Lisp daily for the past 10 years. I am totally new to Clojure and even the JVM though.
they are very different books though - brave and true is cute and fun, joc is difficult and accurate
that is pretty much who joc is for I think - an experienced lisper learning a new lisp offshoot
I spent all day setting up emacs/cider/lein after some snags. ready to start learning now
Thanks for the advice. I'll check it out
@mfikes is it planned that when one wants to add to --repl-opts
one should specify it inline, or is there an alternative?
It also seems like I can omit the --output-dir out
part of the command. I tested with clj --main cljs.main --repl-opts '{:static-dir ["." "out" "resources"]}' --watch src --compile drumkit.core --repl
and that works. Seems like --output-dir
is defaulting to out
If I wrote a ui like above, then I would expect MyComponent
to be a component, like in react. But when I use (om/component? MyComponent)
, the result is false
.
right, MyComponent is not a prototype, it's a class you can instantiate
(if I recall correctly)
@tkjone I'm not aware of a plan to support REPL opts outside of the --repl-opts
flag.
Since you are passing --compile
without also specifying --output-dir
, it is defaulting to out
I also have <audio data-key="65" src="sounds/clap.wav"></audio>
files inside of the resources dir. Seems like they are not being found by the index.html
which is odd because my css
files are being found
@noisesmith and (om/component? MyComponent)
is false, is it expected?
the structure of the resources
looks like this:
├── resources
│ ├── css
│ └── sounds
that’s what I’d expect, as it’s not a component, it’s a class, of which an instance would be a component
@tkjone This might be a consequence of .wav
not being listed here https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/repl/browser.clj#L31
But I don't have much experience using the browser REPL for actual work.
If you are curious, making a change to add that and building the compiler isn't too difficult: https://clojurescript.org/community/building
On it.
You could even add some print statements to the sent-static
function in that file to try to sort out what it is doing for your .wav
files
Can someone explain this? If all the references are removed, why is it “hard to clean up” what is hard to clean? > There’s s a pitfall to hot code reloading however— any thread alive at the time of reloading will keep references to the old code until terminated. The problem is amplified by the fact that all references to these threads are wiped by the time reloading is complete, making it really tricky to clean the messed state up. Fortunately, Stuart Sierra came up with what has been dubbed Reloaded Workflow.
@drewverlee If all the references are actually cleaned up, then the Java garbage collector can do its thing and remove the object. Unfortunately, ensuring that you aren't retaining any references can be difficult. The "Reloaded Workflow" is a set of patterns for ensuring that you always have layers of indirection between your application code and its configuration state which makes it easy to "reload" your configuration without restarting the application (or just your REPL) entirely.
Hi, how do you actually use clojure.spec
to validate input and output of a function without actually touching the function? AFAIK, I should use fdef
but unfortunately it only validates the args
key (not sure about this). So is currently the best way, for pure validation, is using :pre
and :post
?
I've used https://github.com/jeaye/orchestra for that
@christian767 This looks great. Thanks!
Hi, I don't understand this syntax, could someone explain why there is a (
before the get and the send?
(. app (get "/hello"
(fn [req res] (. res (send "Hello world")))))
source: https://medium.com/front-end-hacking/node-js-to-clojure-in-60-seconds-a996e0969471
@vincent.cantin it's interop syntax: https://clojure.org/reference/java_interop#_the_dot_special_form
Thank you. I was looking at another reference page which did not show that form, probably an outdated one.