This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-29
Channels
- # admin-announcements (2)
- # beginners (10)
- # boot (253)
- # cider (11)
- # cljs-dev (26)
- # cljsjs (21)
- # cljsrn (7)
- # clojure (87)
- # clojure-berlin (13)
- # clojure-dusseldorf (5)
- # clojure-greece (7)
- # clojure-poland (11)
- # clojure-russia (189)
- # clojure-spec (31)
- # clojure-uk (86)
- # clojurescript (89)
- # cursive (15)
- # datavis (2)
- # datomic (57)
- # devcards (3)
- # dirac (92)
- # editors-rus (3)
- # emacs (4)
- # events (1)
- # funcool (30)
- # hoplon (3)
- # jobs-rus (6)
- # leiningen (1)
- # luminus (12)
- # mount (25)
- # off-topic (5)
- # om (43)
- # onyx (41)
- # perun (1)
- # proton (2)
- # protorepl (7)
- # re-frame (17)
- # reagent (34)
- # ring (13)
- # specter (1)
- # spirituality-ethics (1)
Is there a public alternative to binding-conveyor-fn
? I’m wanting to capture all the bindings into another thread, in the same way future
does, without using future
(because I want to control the thread it runs on)
bound-fn will create a function that will have the bindings from the scope the function is created in in scope when the function is invoked
nice, thanks!
Yo dudes, why do I need do
because as far as I can see even side effecty functions will run in order
Oh I see the answer from the docs. Because I’m doing it in a function
";; fn
(`defn` by extension) and let
have an implicit do
"
there's a mistake in your snippets: it should be defn
, not def
@urbanslug: most language constructs and macros in clojure have implicit do
, the main exception being if
and cond
What would a forward slash as the first element in a form mean, kinda like this: (def thumb-size 150) (/ thumb-size (blah blah) (blah blah))
oh.. ty
Hi guys I'm stuck reading big files. The files are about 2 ~ 5G and my script always break with OutOfMemoryError Requested array size exceeds VM limit java.util.Arrays.copyOf (Arrays.java:3332)
I read each line, parse and map it and push it synchronously in a core async channel.
Any idea whats happening?
(with-open [rdr ( file)]
(doseq [line (line-seq rdr)
:let [event (try
(-> (parse-string line true)
(dissoc :page :referrer :ua :geo)
(assoc :collection (keyword collection))
(update :timestamp long))
(catch JsonParseException _ nil)
(catch Exception ex (error ex) nil))]
:when event]
(try
(when-let [enriched (enrich-event event)]
(a/>!! input-channel enriched))
(catch Exception ex (error ex)))))
@cyppan: does the channel have an unbounded buffer?
no I want to control the ingestion
(def input-channel (a/chan (a/buffer 1) (partition-all 500)))
what's the stack trace?
the async/chan is then a bit useless no? (if it's sized it'll just allow an initial burst to fill to capacity then go at same pace as db IO), asuming your db calls are blocking and you dont parallelise them you could just do it in the doseq
cyppan: based on the stack trace I'm wondering if your file is accidentally one giant line?
it looks like line-seq
is failing to return
@gfredericks I have some quite big lines indeed (5000 chars at least)
5000 isn't likely larger than the maximum array size
you could truncate the file to a few megabytes and confirm that it does what you'd expect in that case
Can one instruct Leiningen to only use one JVM across all :prep-task
tasks? I think it's booting up a new one each time.
does anybody use clj-refactor and know how to keep it from analyzing every *.clj file it can find?
I'd be happy with being able to specify subdirectories (`["src" "test"]`)
I was under the impression you could call a function in a different namespace by using the fully qualified name, without the need to require it. But it doesn't seem to work? Must you always require everything ?
didibus: that only works if another namespace has already required it. Also, generally not recommended
@michaeldrogalis: (most) lein plugins have their own deps so they need separate classpaths and lein solves this by launching separate jvms
Or if the plugin needs to run with project classpath it needs separate jvm
@juhoteperi: Makes sense. I think I was in the weeds, anyway.
@arohner I see, so the vars need to be interned, and I guess there's a global intern map where the keys are fully qualified. Is there another way to quickly intern and call at the same time? Mostly for REPL use case, where I don't want to bother doing a full on require?
@arohner: How is the code loaded when running without a repl? Is it all loaded at once based on the class path ? Or does it load it as it encounters them through a require?
@arohner: ok thanks, I understand now why it's a bad idea. REPL could actually trick you into thinking it works, which is probably what happened to me and where I had the vague memory this was possible.
this is cool:
(let [bisect-by (juxt filter remove)]
(bisect-by odd? [1 2 3 4 5]))
[(1 3 5) (2 4)]
what's the right way to join the results of a 'for into a single vector? Basically, flatten one layer
are there versions that return vectors or preserve collection type? Or is the best solution (apply vector ...)?
Did anything get added in 1.9.0 to make :keys
destructuring of maps with ns’d keys easier?
@lvh:
boot.user=> (let [{:a/keys [b c]} {:a/b 1 :a/c 2}] b)
1
more info in this commit’s tests: https://github.com/clojure/clojure/commit/d274b2b96588b100c70be065f949e1fdc9e7e14d