Fork me on GitHub

(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 🙂 🙂


damn you got me there lol


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 🙂


i guess that’s why i haven’t written a single one yet


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


thanks for the help all 🙂


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.


You could trivially change that code to do the same for doc and friends.


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


Yeah, I usually just (require '[cljs.repl :refer [doc source]]) etc


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 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")


hi guys, I'm trying to use hiccup as a templating engine to generate HTML


any tip on how I can inject raw html into hiccup?


never mind the above, seems like hiccup 1.0.5 doesn't escape HTML by default


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: From my understanding there shouldn't be a problem, right?


@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?


you are supposed to just include them like a normal cljs library


alright, so it should work then? Because I did that and somehow this error still comes up...


it's only the geoJSON-function...others are working


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 Moneys, 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)

👍 4

Thank you Chris!


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 when I could just have, 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 have the same number of dots as in,, 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.

👍 4

@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 or (with a -main inside) is a matter of personal preference, when it’s not a matter of following the team or project style guide.

👍 4

those are two good reasons! thank you both


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:


@avfonarev shouldn’t be a problem


if it is, either make a ticket in jira or ask someone here to make one 🙂


@schmee thanks. A silly question: I've always installed JDK. What will I loose if I get just JRE?

Alex Miller (Clojure team)22:04:50

The javac compiler and the jar tool are the biggest things you are likely to need