Fork me on GitHub
#beginners
<
2017-10-30
>
alexisvincent08:10:29

Hi Guys 🙂 In a Clojure / Clojurescript project, with expected shared code, whats the best project structure? Different Projects, Joint project? For the moment theres going to be a mono repo

jumar08:10:06

If it's single deployable app I think the best approach is to keep everything in single repo under different source directories, let's say src/clj, src/cljc, src/cljs

alexisvincent08:10:14

@jumar Would cider be able to differentiate between the two projects?

jumar08:10:20

what do you mean by two projects? In that case, there'll be a single project with multiple source directories

alexisvincent08:10:10

i mean, would I be able to setup cider to interact with the clojurescript part separately from the clojure part?

jumar08:10:13

Some time ago I usec cider-jack-in-clojurescript which created two REPL buffers - one for clojure and one for clojurescript. And I think cider was more or less able to found proper repl buffer. Nowadays, I just run cider-jack-in and if I need to work on cljs part I run figwheel manually and then cljs-repl

alexisvincent08:10:42

Also, looking at the lein project config, it would seem deps are specified per project, how would this work with diffirent deps?

alexisvincent08:10:47

oh that makes sense

jumar08:10:47

If I need both repls at the same time I run cider-connect and use the new buffer for the other part

jumar08:10:35

especially http://www.luminusweb.net/docs/profiles.md - you can create a skeleton app, e.g. :

lein new luminus my-app +postgres +re-frame

alexisvincent08:10:00

ah, pretty cool! Thanks

rahadianmf09:10:29

hi guys. i got an issue on running 'lein repl' . it shows an error text "Could not find artifact clojure-complete:clojure-complete:jar:0.2.4 in central (https://repo1.maven.org/maven2/)". anyone got the same issue ? thanks in advance!

jumar10:10:26

@rahadianmf this works for me:

lein try clojure-complete/clojure-complete "0.2.4"

tdantas12:10:37

well, reading a clojure book I found one interesting statement ( couldn’t be able to understand ) > the lazy seq does not outlive the execution of the function in the form of a closure If I create a closure with some seq I could be in trouble ?

Empperi12:10:26

with lazy sequences you might run into troubles if you “keep the head” of the sequence

Empperi12:10:00

since lazy sequences can be by definition infinite, if you keep reference to any element of the sequence somewhere then the already processed elements cannot be garbage collected

Empperi12:10:26

and since it is a sequence that means that any elements after that element you are referring to cannot be GCd

Empperi12:10:23

so, if you are “keeping the head” - which means, storing the head element or the sequence itself somewhere - then none of the elements of the lazy sequence can be garbage collected and you’ll end up consuming memory for the whole sequence

Empperi12:10:51

not a problem if your sequence has only few elements, but for infinite or otherwise very large sequences that is obviously a huge problem

Empperi12:10:14

take for example (doseq [x (range)] (println x)) which will happily keep on printing numbers until the universe dies, your application can keep on going. But if you write it like this (let [y (range)] (doseq [x y] (println x))) you’ll end up killing your JVM due to out of memory error eventually

val_waeselynck13:10:27

@niklas.collin strange, I would have thought locals clearing takes care of that https://groups.google.com/forum/m/#!topic/clojure/FLrtjyYJdRU

Empperi13:10:42

I guess it does. Haven’t heard about that before but the lazy heads problem is still there even with that change. My example might actually not die to OOM after reading that part

Empperi13:10:58

but you can still get to that situation

tdantas13:10:44

let me digest your explication @niklas.collin, thanks in advance ! will be back as soon as I digest everything

tdantas16:10:25

@niklas.collin oh, you are talking about memory footprint, agree with you . no doubts regarding that. my concern was regarding the statement > the lazy seq does not outlive the execution of the function in the form of a closure we , somehow, lose the closure

rcustodio23:10:41

using schema (https://github.com/plumatic/schema) with json is better than protobuf?