This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-19
Channels
- # admin-announcements (14)
- # architecture (1)
- # beginners (21)
- # boot (301)
- # clojure (93)
- # clojure-brasil (56)
- # clojure-india (4)
- # clojure-italy (11)
- # clojure-japan (25)
- # clojure-russia (16)
- # clojure-sg (1)
- # clojure-uk (5)
- # clojurescript (64)
- # clojurex (4)
- # clojutre (7)
- # cursive (18)
- # datascript (35)
- # datomic (212)
- # editors (27)
- # emacs (38)
- # events (9)
- # funcool (21)
- # hoplon (105)
- # jobs (2)
- # ldnclj (41)
- # ldnproclodo (4)
- # liberator (89)
- # luminus (5)
- # off-topic (32)
- # om (39)
- # onyx (1)
- # re-frame (9)
- # reactive (1)
- # reagent (34)
- # testing (42)
- # yada (4)
Anyone have a more aesthetically-pleasing way to conditionally assoc items into a map than this?
(merge {:a :b} (when condition {:foo :bar}) (when other-cond {:spam :eggs}))
(I’m not worried about merge conflicts, the keys are unique)
When working with a reloaded workflow, how do you keep your global system variable from getting clobbered?
@tel: how do you mean clobbered?
I have (defonce system nil)
at the top of the file where things like start
and reset
are defined
hmm.. do you have a code snippet?
(btw im just learning about the whole reloaded workflow)
I think i've been using the system library. which gives you some helper methods (go) and (refresh) that sort this out for you.
(defonce system nil)
(defn init! [] (alter-var-root #'system (constantly (lc/start (core/init)))))
(defn start! [] (alter-var-root #'system lc/start))
(defn stop! [] (alter-var-root #'system #(when % (lc/stop %))))
(defn refresh! []
(stop!)
(repl/refresh :after 'reify.fisher.backend.system/start!))
yeah. I think given this snippet here /code (reloaded.repl/set-init! dev-system)
(reloaded.repl/set-init! dev-system)
I think basically does your defonce for your, kind
well we all have our windmills
@timgilbert check out cond->
Are there any good articles/books/talks on how to architect clojure code. Specifically around namespaces, writing modular & DRY code? I understand Component is one approach, anything on the topic would be appreciated.
@afhammad: there was a talk by walmart labs last year at clojure conj that goes over component pretty well (like, how it feels to actually use it)
@afhammad: there's also an approach similar to component, using Prismatic's graph library: http://www.infoq.com/presentations/Graph-Clojure-Prismatic
Thanks guys, will check them out. Example repo recommendations welcome too. @greywolve @tcrayford @mpenet
Anyone knows how you can get leiningen to copy dotfiles from the resources folder?
https://github.com/technomancy/leiningen/blob/master/src/leiningen/jar.clj#L87 looks like it's not possible... 😞
No one knows how to get a dotfile in my jar 😞
What's a stupefying technique for getting the first element in an infinite sequence that satisfies a condition and stopping at that point, returning the satisfying element?
@timgilbert: (cond-> {:a :b} condition (assoc :foo :bar) other-cond (assoc :baz :biff))
I can't explain why, I just know it's bad practice to write anything redundant and especially in a custom function like this.
I have practically no #()
-style functions in all my code, because usually it means I'm not using some built-in function.
In this case, (some #(when (f %) %) coll)
should really be (->> coll (filter f) (first))
i just tried it on http://clojurescript.net/
cljs is not strict about argument count the way clj is
i always thought multiple non-numbered %
s in anonymous funcs would get assigned to additional args
what's the best way to remove all nils from a nested data structure of maps and vectors?
@greywolve: : postwalk + filter / reduce for things that are map? or vector?
@solussd: i've tried this, which works for my use case, but blows up if a map has a value that is nil (luckily i shouldn't have any nil values there), ie [{:a 1 :x nil}] blows up , but [{:a 1 x: [nil]] is fine.
do you want to remove mapentries where the value is nil?
ah, you’ll need to prewalk, so you can identify mapentries
that would return {:a 3, :b [1 2 {:c 5}]}
wish there was a less verbose way to do it, but you’re welcome
I asked this over in #C053AK3F9, but didn't get any bites... is there a simple library for handling tcp client duties? I was looking at aleph, but I don't need codecs. Just send and receive a string, hopefully dealing with chunking behind the scenes.
if you give it nothing it should just default to handing you byte arrays as soon as they're available
curtosis: actually it looks like that's the only thing you can do now, aleph doesn't directly force use of gloss on you in the latest version, so you just get back the channels that accept/receive byte arrays
Anyone doing backend APIs for webapps/smartphones: What server platforms do you prefer? (e.g., immutant, tomcat, nginx, etc.)
immutant++