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 ?

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...

me124307: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?

mishamykhaylov1307:10:19

What did you end up using?

me124307: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).

me124307:10:49

ok thanks! 🙂 looking forward to it

pikat10: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

mail99210:10:56

Or use quot (quot number 100)

me124312:10:02

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

regen12:10:00

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

regen12:10:26

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

me124312:10:55

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

regen12: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.

me124312:10:00

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

regen12: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.

me124312:10:15

ok, got it! thanks for clarifying that

auroraminor12: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.

auroraminor13: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?

auroraminor13:10:44

let me simplify my code as much as I can here

auroraminor13: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.

auroraminor13:10:51

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

auroraminor13:10:08

but for some silly reason I got stuck on this

auroraminor13:10:29

thank you @manutter51!

auroraminor13: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.

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.

samcferrell18:10:28

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

neo255117:10:01

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