This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-20
Channels
- # ai (1)
- # beginners (17)
- # boot (27)
- # cider (2)
- # cljs-dev (64)
- # clojure (131)
- # clojure-austin (13)
- # clojure-dev (15)
- # clojure-dusseldorf (11)
- # clojure-france (45)
- # clojure-russia (19)
- # clojure-spec (66)
- # clojure-uk (22)
- # clojurescript (97)
- # core-logic (7)
- # cursive (5)
- # data-science (1)
- # datomic (92)
- # dirac (49)
- # emacs (1)
- # events (5)
- # funcool (10)
- # hoplon (79)
- # jobs (1)
- # jobs-rus (1)
- # lein-figwheel (1)
- # leiningen (3)
- # om (14)
- # onyx (35)
- # planck (2)
- # proton (1)
- # re-frame (21)
- # reagent (2)
- # ring-swagger (10)
- # spacemacs (10)
- # specter (18)
- # untangled (7)
- # vim (23)
@jey what would you be missing if you made several independent leiningen projects?
I tend to have one project.clj with multiple :profiles
, if needed I use ^:replace trick to clear possible settings declared at the root level
also I tend to write a bunch of aliases, which wrap my “with-profile” combos, to make it palatable when using from cmdline
@lockdown you can put multiple leiningen projects in one repo
one problem with multiple projects are dependencies, I personally don’t want to dance around updating multiple files when libraries get updated, but maybe there are some tools to automate that
https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
cehckouts are the canonical way to work on several projects at the same time
with interdependencies
with checkout deps you start hitting issues like this one: https://github.com/emezeske/lein-cljsbuild/issues/413
for me checkouts are good ad-hoc solution when I need to fork 3rd party library and want to develop a patch in the context of my project
ah, k
the boot’s approach is much better, they watch the other repo with file watcher, and auto-install the dependency into maven on change, and update your project somehow
for example my most-monstrous project.clj using that profiles+aliases approach: https://github.com/binaryage/dirac/blob/master/project.clj note that is uses a some ugly tricks, e.g. Cursive/IntelliJ does not understand profiles, so I have to use the root level as instructions for Cursive and then negate it in profiles, sometimes I want to overload standard lein commands like”test” or “install”, so I have to :nuke-aliases, sometimes I have to do weird things to work around cljsbuild issues, etc.
@darwin BTW Cursive should understand profiles, it didn’t previously but it has for a long time now. If it doesn’t it’s a bug I’d like to know about.
@cfleming well, what bothered me is Cursive’s auto-setup of source/resource/test folders after reading project.clj, even if I set it up manually via IntelliJ project settings, next time Cursive opens project.clj it overwrites my setup with stuff found in :source-paths and similar from root level
Right, if you want a different setup there you should configure it in your project.clj
what I have to do is to do union of my needs on root level and then reset it in profiles to subsets
Hmm, I don’t understand that. I actually have to go now, but I’m interested to know more about what you need and why it doesn’t work.
is there a way to test for LazySeq vs other things that impl ISeq? I am using transit and encoding a persistent list (list? x) ;;=> true
and want to turn those back into list on the other side.
Hi all I'm having some problems with lein uberjar inside of docker. Lein jar works, as does lein run. It's just hanging up on creation of the uberjar right after creation of the standar jar. The same project can be uberjar'd outside of docker no problems. Has anyone else encountered this? (Also tried disabling AOT and no difference)
A quick update for those that use docker for mac and may run into this issue... it's a docker bug that causes high cpu usage on disk access. The actual uberjar was successful it just took over 8 minutes to generate.
A question about reader conditionals: I’m looking for a way to receive a .cljc
file and returns the .cljs
branch - but without actually reading the file, but leaving the content of the branch as is
Yesterday @alexmiller proposed to use read
from tools.reader
- I came up with this gist: http://app.klipse.tech/?eval_only=1&cljs_in.gist=viebel/39988943fc537b51704b9fdd3de86c90
But my problem is that the forms are read by the clojure reader - so for instance ::abx
becomes :my.tag/abx
What I want is to leave the branched forms as they are
Any idea how to do that?
My use case is for dev time when you use reader conditionals and you want to see the branches :clj
or :cljs
@viebel: maybe cljsee might have some hints?
It's a cljc preprocessor
thx @danielcompton this is exactly what I was looking for
You can also use the :preserve mode of :read-cond to preserve both branches in the reader
I finished the proof-of-concept for a how-to-ns lein-plugin-linter-thing: https://github.com/gfredericks/how-to-ns
(defn my-func! [in-chan] (+ 1 (<!! in-chan))) ; <- function returns result
(let [sample-chan (chan)]
(>!! sample-chan 1)
(alts!! [(timeout 1000)
(go (my-func! sample-chan))])) ; things that use it put it in a channel
(defn my-func! [in-chan] (go (+ 1 (<! in-chan)))) ; <- function returns a channel
(let [sample-chan (chan)]
(>!! sample-chan 1)
(alts!! [(timeout 1000)
(my-func! sample-chan)])) ; <- things that use it treat it like a channel
hopefully you understand what I'm getting at. I come across this choice all the time and have no real reason for favoring one over the other
the latter one seems obviously better if I definitely want to use it in an alts!! block, but the former one seems more general for cases where I just want the result
the second one will be easier to port to ClojureScript if that could be a task in future
if you used just go and single excamation version of things, all your code would run on single thread “cooperatively”, I believe
which is different, because a blocked go-block thread can be re-purposed to other go-blocks
not sure about that, (go … <!! …) from the first example, that still looks like a blocking go block, so it won’t “park” to release the thread to other go blocks
but you have a thread pool powering all go blocks, so blocking one of them is not that big deal
huh, interesting. But youve given me some key vocab. you say "parking" means "release the thread to other go blocks"?
but you should not be doing blocking stuff systematically, you could run out of worker threads
right, parking happens on commands like <!
, core.async will “save” state of the go “thread” and release the worker thread to do other work for other go blocks
and when it getd signal that it can continue, it restores state of the go “thread” and runs with it until next parking
I have a situation where i’m trying to construct a collection that looks like [1 2 3] but i have a vec that looks like [1 [2 3]] essentially. is there a way to “dump” a list into its containing form? flatten
won’t work because it flattens multiple levels
you know what here’s the whole example, it’s for forming hiccup:
[:ul {:class "collection"}
(mapv (fn [c] [:li {:class "collection-item"} c]) config-vec)]
by which I mean, I think it will generate the same html fore [:ul foo]
and [:ul [foo]]
so the issue is you are using mapv, not map, and hiccup treats vectors and seqs differently
I have an expression (get-special x)
that should only be called if at some point in the call chain it was wrapped with (prepare-special x (get-special x)
.
So (prepare-special (several-levels (get-special x)))
should work but (get-special x)
should not
it depends on if you want to check in the static or dynamic extant, it is in theory possible in the static extant, but it is going to suck to write that macro
dynamic extant meaning something like
(defn foo [] (get-special x))
(prepare-special (foo))
you aren't going to be able to do the dynamic extent version without doing whole program analysis
thank you @hiredman and @jr if I come up with some specific hack I’ll post it back here
I just saw a #’
in a code and it reminds me something about being deprecated recently, can someone confirms it or tells me if there is something new about it ?
So I just had a need for this little helper:
(defn n-times [f input n]
(if (= n 0)
input
(recur f (f input) (dec n))))
And although it's simple, it seems like something that would already be possible with the core library. Suggestions?
Specifically, I'm trying to do just a few steps of an iteration as part of a unit test.
Ah, iterate
is what I was missing. It must give a lazy sequence?
Also, clojure.spec is nice, but I just gave ::grid/grid grid
as one key/value in a map and it reminded me of Thing thing = new Thing()
. Some things never change.
Thanks for the help, @jr!