This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-10
Channels
- # aleph (4)
- # architecture (4)
- # aws (1)
- # beginners (64)
- # cider (26)
- # clara (9)
- # cljs-dev (45)
- # cljsrn (1)
- # clojars (8)
- # clojure (31)
- # clojure-finland (3)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-poland (9)
- # clojure-spec (1)
- # clojure-uk (81)
- # clojurescript (35)
- # core-async (1)
- # cursive (33)
- # datomic (29)
- # editors (4)
- # emacs (2)
- # fulcro (22)
- # jobs (4)
- # leiningen (2)
- # off-topic (20)
- # onyx (1)
- # portkey (17)
- # proton (2)
- # re-frame (20)
- # reagent (36)
- # remote-jobs (1)
- # ring-swagger (1)
- # rum (2)
- # shadow-cljs (179)
- # slack-help (1)
- # spacemacs (1)
- # test-check (20)
(this is yet another case where I would just caution beginners to completely avoid ClojureScript until they're really comfortable with Clojure!)
@seancorfield but i don’t need clojure!
@lee.justin.m You do if you're using macros 🙂 🙂
Well, there's self-hosted cljs right? I have no idea what state that is in...
Macros work fine in self-hosted.
I submit the port of core.async
a couple years back as evidence 🙂
there is but you still have to do the same macro shenanigans even though the macros are actually cljs, from what i’ve read
confirming that that was the issue--i moved the macro into a clj
file with an identical ns and used require-macros
from the cljs file
I'll continue using cljs without a solid knowledge of clojure at my own risk... sometimes there's not enough time for best practices eh?
hey guys, I am trying to send out a enviroment variable to my clojure app, but it wont recognize it..can anyone see a problem with the following approach?
CLJ_ENV=production lein ring server
(get (System/getenv) "CLJ_ENV")
-> nil
@brnbraga95: lein ring server starts two jvms - try using export so the child process sees the var
also it's better to avoid using lein in production - it's a build tool
yes, I am just testing, my plan is to write a script to test my apis, and send a enviroment variable so that I will know when I am testing and I can point my apis to a mocked database kind of thing (create a local datomic database)
and hit it with posts and gets
this script would also add all the schemas and delete the database after
i'm a big fan of an edn or properties file that specifies all of this. and then your build infrastructure can swap out the correct one for production
easy to read all necessary environment variables and the prod ones are never seen by people who don't have access to the build environment
i know jenkins has a notion of a secrets file. i'd be surprised if most build tools did not as well
Does anyone know if there's a figwheel config option that would cause the REPL utils to be available in all namespaces? Right now (doc my-func) doesn't work, I need to call (cljs.doc my-ns/my-func) Which is a bit tedious. Ideas?
@jrbrodie77 It would be interesting if doc
, source
, etc. could be optionally enabled as REPL specials (like in-ns
) so they work everywhere. (They actually are REPL specials in Replete, which is really handy when messing around on an iOS device—but that’s nonstandard.)
There was a talk in which Stu Halloway discussed simply writing your own REPL features when you wanted them. I suspect this wouldn’t be too hard to do with Figwheel if you really wanted them to be REPL specials for your own use.
If you are curious, there are 4 REPL specials defined here https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/repl.cljc#L763
Thanks @mfikes. This had got to catch a lot of beginners. It’s part of the ipython workflow (dir, help etc)
I’ll check that out
hey guys, so I am trying to automate my tests, and I am using the following function to mock my api: (mock/request :post (v :endpoint)
.. the second parameter can also be :get
..do you guys know if can send this second param from another value ? just like I am doing with the third one
I know that (mock/request "post" (v :endpoint)
therefore using it as a string wont work
@brnbraga95 assuming mock/request
is a function (rather than a macro) then, yeah, sure you can pass the keyword dynamically.
You can convert the "post"
string to a keyword with (keyword "post")
struggling with a particular div
that I want injected raw HTML into. this stack overflown answer doesn't work for me https://stackoverflow.com/questions/39622473/how-to-prevent-html-escaping-in-clojure-reagent-hiccup-like?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
Hi there, do I have to specify externs for every lib I get via cljsjs? Because I am getting an error that a function is not recognised when compiling with :advanced
. This is the only extern that is specified in my luminus-project: :externs ["react/externs/react.js"]
Thing is: I am using leaflet from cljsjs and it runs fine in dev but in prod it tells me that Uncaught TypeError: L.$geoJSON$ is not a function
. I activate debugging options. And in the supposed externs-file I was able to track down the corresponding function: https://github.com/cljsjs/packages/blob/master/leaflet/resources/cljsjs/leaflet/common/leaflet.ext.js#L811. From my understanding there shouldn't be a problem, right?
And here is the doc of the function: http://leafletjs.com/reference-1.3.0.html#geojson
@U4GEXTNGZ the cljsjs builds are supposed to have externs
hey @lee.justin.m thanks so far. Is there a good manual on how to implement the libs from cljsjs into the build?
alright, so it should work then? Because I did that and somehow this error still comes up...
let’s jump back into #clojurescript because someone might be able to track this down.
Hello Clojurians, I’m working through Clojure Applied and can someone please help me figure out this small snippet of code?
so defrecord
is defining, well, a “record”, which is storage for the described data elements and then implementations for any protocols you want to conform to
so, you would instantiate a Money
with one of two convenience fns that are created by the defrecord
macro: ->Money
or map->Money
, like so: (def fat-stack (->Money 25 usd)) ;; assume that usd was defined as a Currency earlier
or (def fatter-stack (map->Money {:amount 99 :currency eur})) ;; again, definition of eur is assumed
and since the Money
record conforms to Comparable
you can do things like (sort [fatter-stack fat-stack])
and inside sort
somewhere is code that calls (compareTo fatter-stack fat-stack)
to figure out their ordering, and at that point m1
and m2
are each bound to an instance of Money
and finally, since m1
and m2
are Money
s, calling (:amount m1)
and (:amount m2)
fetches the amount
that you provided when you created that Money
record (in our example, calling (compareTo fatter-stack fat-stack)
those would be 99
and 25
, respectively)
Is there a reason why I shouldn't get rid of the core
after all my namespaces? For my purposes, at least, it seems like unnecessary clutter to have foo.bar.core
when I could just have foo.bar
, but I'm wondering if there's maybe something I hadn't considered.
As a minor matter of aesthetics I suppose it might be pleasing to have foo.bar.core
have the same number of dots as in foo.bar.utils
, foo.bar.baz
, etc., to reinforce the fact that these namespaces all ought to be considered as belonging to the same level of abstraction, but if that's all the matter is, then I think I could personally go the other way.
@lgessler One thing you want to at least do is ensure that your namespaces have 2 or more segments. So at least foo.core
but not foo
.
@lgessler I think it can also be convenient to have an explicitly-named namespace segment for just the stuff you need to AOT into .class
files, though whether that is foo.bar.core
or foo.bar.main
(with a -main
inside) is a matter of personal preference, when it’s not a matter of following the team or project style guide.
I've just got a clean system and have to install Java. Will the latest version of Clojure work with Java 10?
You'll likely have problems if you want to use it with Cider (especially refactor-nrepl: https://github.com/clojure-emacs/refactor-nrepl/issues/206)
@avfonarev shouldn’t be a problem
@schmee thanks. A silly question: I've always installed JDK. What will I loose if I get just JRE?
The javac compiler and the jar tool are the biggest things you are likely to need
@alexmiller thanks