Fork me on GitHub

I'm trying to build an app with re-frame and shadow-cljs, but I need a backend server as well. What's the best way to have shadow-cljs running with a ring server running as well on the same url/process?


(To clarify, I'm just at the development stage, so just on localhost is fine)


@donyorm Perhaps ask in #shadow-cljs ?


@donyorm you simply need to serve the files built by shadow-cljs by your backend server. there’s nothing special to do


I wouldn’t try and have the build in the same process as your backend server, as you can end up with dependency conflicts and whatnot that you won’t get when you deploy your app


it’s easy to run shadow-cljs that builds your front-end in one process, and your backend server in another process. your backend can serve up the built JS files and everything will work


^ @donyorm The latter is what I would have recommended. I only suggested the #shadow-cljs channel in case they know of any easy way to run the backend process inside shadow itself...

Alexander Heldt07:10:21

Hello! Im planning to scrape a website and thought it could be a nice project to learn some clojure. Im just wondering how good of a fit it would be?


What did you end up using?

Alexander Heldt07:10:04

hi! i haven’t started yet, but i’m planning to use enlive and specter that was suggested. they both seem nice


Would be an excellent fit. Checkout the libraries enlive and specter(And JSoup through Java Interop).

Alexander Heldt07:10:49

ok thanks! 🙂 looking forward to it

💯 4

why dividing java.lang.Long like this (/ number 100) produces a fraction - I need integer number


you can cast it back to an integer using int


Or use quot (quot number 100)

Alexander Heldt12:10:02

is it allowed (and idiomatic) to have namespace segments with -? for example (ns example.with-dash.package)


Yes, you see it everywhere you'd normally have a space.


Just remember that it translates to _ in the directory or file name.

Alexander Heldt12:10:55

ok thanks! in this case my directory is with-dash, should i avoid such directory names?


You'll have to rename that directory to with_dash for it to work. I think it's perfectly fine, and you see it all the time when the project name has a dash in it.

Alexander Heldt12:10:00

ok, but is there a way to have a directory with a dash in it and still represent it in a namespace?


Not that I know of. I imagine it would be very hacky though, as the whole reason we need to use underscores instead is to play nice with Java.

Alexander Heldt12:10:15

ok, got it! thanks for clarifying that

👌 4
Cas Shun12:10:21

I would like to pass something like {:foo (func arg) to a macro, manipulate the func form, then have the value of that as the value of :foo. I'm getting stuck on how I would achieve this.

Cas Shun13:10:29

I suppose a simpler way to phrase it would be: I want to do (m {:foo (inc 1}) where m is the macro, and end up with {:foo 2}. I'm using a macro because I need to do a bit more than that, but this is where I'm stuck.


@auroraminor Where are you getting stuck? Maybe you could post a code snippet in a gist?

Cas Shun13:10:44

let me simplify my code as much as I can here

Cas Shun13:10:58

hopefully that's simple enough to explain my issue


Ok, how about this?

(defn update-value
  [m x]
  (reduce-kv (fn [m k v]
               (assoc m k (v x))) ; ??? results in the value of k applied to x
             {} m))
=> #'user/update-value
(update-value {:t inc :u dec} 1)
=> {:t 2, :u 0}


You can’t use a macro to work with values, because values won’t be available at macro expansion time. You can only use a macro to rewrite code.

Cas Shun13:10:51

right, there's more to it because what I'm doing is trying to reconstruct parts of xml zippers

Cas Shun13:10:08

but for some silly reason I got stuck on this

Cas Shun13:10:35

(no clue why I forgot that v exists)


hi, wasn't sure which channel is best to ask this in, but it seems likely this is a good start! What's the current state of play for the various webui frameworks? If you were starting a new project tomorrow, which would you use? Did om-next arrive? Is it still reagent, reframe, something else?


You may get an answer here, but I wanted to suggest that the #clojurescript channel is perhaps a more target rich environment for that question.

👍 4

that is a great idea! thanks!


reagent is the most popular react wrapper in CLJS land. reframe and fulcro are more systemic libraries for SPA development. I'm sure there are lots of other options, but these are main ones (in terms of popularity, and probably maturity too)


I lean towards fulcro for SPA development. But I haven't used either in anger, so take this with a heap of salt.

Sam Ferrell18:10:28

I'm using rum for my personal project and enjoying it.

👍 12
David Pham17:10:01

I use react and re-frame and have ton of fun as well.