Fork me on GitHub
#beginners
<
2019-10-18
>
donyorm01:10:25

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?

donyorm01:10:42

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

seancorfield02:10:51

@donyorm Perhaps ask in #shadow-cljs ?

4
lilactown04:10:38

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

lilactown04:10:13

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

lilactown04:10:39

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

seancorfield05:10:10

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

Misha07:10:19

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

jaihindhreddy07:10:35

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
Seubas10:10:52

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

bronsa10:10:49

you can cast it back to an integer using int

hansbugge10:10:56

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)

herald12:10:00

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

herald12:10:26

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?

herald12:10:52

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?

herald12:10:48

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.

manutter5113:10:19

@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

manutter5113:10:11

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}

manutter5113:10:48

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)

lance.paine16:10:43

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?

andy.fingerhut16:10:09

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
lance.paine16:10:25

that is a great idea! thanks!

jaihindhreddy17:10:07

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)

jaihindhreddy17:10:10

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.