Fork me on GitHub
#clojure
<
2018-08-26
>
cfleming03:08:59

@dottedmag Cursive currently uses Tern’s builtins but I’m planning to switch that to Google Closure’s at some point soon, which are more complete.

eskos07:08:48

These are "Java with tooling" distributions, not the JDK itself. And while I'm sure there's lots of enterprises which use those to enhance their end user (as in office worker) experience, generally you don't see these distributions in the wild.

eskos07:08:56

That said, I've been looking into OpenJDK as I don't really use the fancypants features of HotSpot.

mexisme10:08:34

I'd argue, judging by how Oracle has played with pricing for other products, that this is just their testing the water

andrea.crotti11:08:21

silly problem probably but I can't figure it out, I have semi-spa app (so the home rendered completely server side and another page rendered with Re-frame)

andrea.crotti11:08:00

the re-frame part works fine if it's uses as index, but if I move to a different route then this [:script {:src (cache-buster "js/compiled/app.js")}] doesn't work anymore, because it prepends the current path it's on

andrea.crotti11:08:39

if instead I write it as [:script {:src (cache-buster "/js/compiled/app.js")}] it finds that fie, but not the other files needed (like base.js and co)

benzap17:08:20

I think i've had this issue before. You might need to change the :asset-path option in the clojurescript compiler

andrea.crotti17:08:53

I'm using these options

:output-to "resources/public/js/compiled/app.js"
                    :output-dir "resources/public/js/compiled/out"
                    :asset-path "js/compiled/out"

andrea.crotti18:08:26

for now I solved in horrible way just by using query arguments instead of the routing I wanted to use

benzap18:08:29

yeah nvm, that shouldn't be an issue then

andrea.crotti18:08:38

but would be nice to fix it properly

benzap18:08:22

try :asset-path "/js/compiled/out"

benzap18:08:40

the extra slash '/'

andrea.crotti18:08:37

mm no it still prefixes the current url

henrik12:08:29

What would be the best way to traverse a Hiccup vector-of-all-kinds-of-stuff-like data structure and transforming keywords based on some condition?

sundarj18:08:02

there's also the built-in clojure.walk ns, just as an fyi

andrea.crotti12:08:21

@henrik update-in might be enough?

henrik12:08:56

@andrea.crotti Doesn’t update-in presume that I know the exact path to the keywords? I need something that goes deep into an (almost) arbitrarily nested vector-of-vectors-keywords-strings-and-maps, and does stuff depending on a predicate. I’ve solved this temporarily with a self-referential function, but I presume it to be inefficient and potentially build up a giant heap/stack.

andrea.crotti12:08:15

tree-seq & co might help with the traversal?

andrea.crotti12:08:32

you could first extract the paths and do the updates as separate steps maybe @henrik?

henrik12:08:03

Well, it’s good for taking it apart, but putting it back together again?

henrik12:08:14

Let’s see, a loop that produces paths. That could work.

henrik12:08:36

Then another loop with update-in over those paths.

henrik12:08:32

I’ll give it a shot, thanks!

henrik12:08:21

Maybe the first bit is a job for Specter: https://github.com/nathanmarz/specter

andrea.crotti12:08:40

Sure it can surely help

henrik12:08:50

Heh, look at that.

henrik13:08:49

@andrea.crotti It works fine with a small modification

andrea.crotti17:08:15

I moved some code from core.clj to other-namespace.cljc and changed all the various imports, and the settings in project.clj are already:

:source-paths ["src/cljc" "src/clj"]
  :test-paths ["test/clj"]

andrea.crotti17:08:42

but it now fails to compile, it can't find the cljc namespace

andrea.crotti17:08:04

any idea what could be missing, I've done it before in other projects and it just worked

Chris O’Donnell18:08:40

Does the filename have a - instead of a _?

andrea.crotti18:08:28

mm no it doesn't have either

andrea.crotti18:08:45

if I build the uberjar it gets packaged in

andrea.crotti18:08:57

but lein test or anything that triggers the compilation fails

andrea.crotti18:08:07

api.clj can't find that namespace it requires

benzap19:08:18

if it hasn't been mentioned yet, be sure to clean out old compilations, the left over artifacts might be confusing the compiler. so delete js/compiled and try re-running it

benzap19:08:14

I've been caught a few times with incorrect namespacing

andrea.crotti19:08:06

mm that was it, I always forget that sometimes I have to do a lein clean, thanks @benzap

andrea.crotti20:08:57

I wonder also if there is a way to write the tests in cljc files as well

andrea.crotti20:08:10

and running the same tests both with Clojure and Clojurescript

andrea.crotti20:08:19

is anyone doing that?

gklijs06:08:01

I've read of someone, can't remember who, who put as much as possible in cljc to be able to test it in clojure. Haven't any cljs test experience myself.

mauricio.szabo22:08:49

I tried in a project to do exactly this, but it's better said than done. There are differences in :require from CLJ and CLJS, and it's not that easy to make reader conditionals to require things correctly. There are some semantic differences too, but it's doable - just not simple.

andrea.crotti22:08:35

For the couple of namespaces I try it works quite well

andrea.crotti22:08:27

But sure it's probably only worth if you are actually calling those functions from both clojure and Clojurescript

colinkahn21:08:25

If I run clj, is there a way to get the directory that process is running in?

colinkahn21:08:13

I found (System/getProperty "user.dir"), which seems to work

benzap22:08:06

@andrea.crotti yep, most of my tests in my libraries are running in both clojure and clojurescript. I use the doo library for the clojurescript side, which compiles down and runs a node instance for my tests