This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-01
Channels
- # admin-announcements (3)
- # beginners (25)
- # boot (21)
- # cider (39)
- # cljs-dev (86)
- # cljsrn (20)
- # clojars (4)
- # clojure (70)
- # clojure-canada (1)
- # clojure-greece (101)
- # clojure-poland (16)
- # clojure-russia (35)
- # clojure-spec (202)
- # clojure-uk (24)
- # clojurescript (69)
- # cursive (23)
- # datomic (34)
- # devcards (7)
- # dirac (5)
- # editors (3)
- # emacs (6)
- # events (1)
- # hoplon (52)
- # instaparse (1)
- # jobs (4)
- # jvm (2)
- # lein-figwheel (2)
- # leiningen (10)
- # luminus (2)
- # mount (1)
- # off-topic (12)
- # om (55)
- # om-next (8)
- # onyx (19)
- # pedestal (4)
- # planck (1)
- # re-frame (27)
- # reagent (5)
- # remote-jobs (1)
- # spirituality-ethics (14)
- # tmp-json-parsing (6)
- # untangled (121)
- # yada (32)
ok, given 5 different sequences of the same length L, how do i build a single sequence of objects out of this, with 5 different keys? so, for example, a function that does something like this:
(combine-sequences :a [1 2 3] :b [3 2 1]) -> [{:a 1 :b 3} {:a 2 :b 2} {:a 3 :b 1}]
I want to populate a database (sqlite) with some test data (few million records) and I want to print the progress of the insertion. So I have the following code which is run at compile time:
(let [lines (get-lines "filtered.txt")
linec (count lines)]
(reduce (fn [i line]
(when (= (mod i 1000) 0)
(println "Lines left: " i))
(process-message line)
(dec i))
linec
lines))
For some reason, if I don’t put a (println “inserting”)
in a method that is called in process-message
I get an almost instant printout of Lines left: xxxx
That’s kind of odd, since it does show the side effect from the println in the reduce, but not the side-effects of the process-message
function 😛
@m1dnight: I am a complete noob, so im probably wrong - but maybe get-lines is returning a lazy sequence and you need something like doall or dorun?
Hmm, I took care of that in get-lines
:
(defn get-lines [fname]
(with-open [r (reader fname)]
(doall (line-seq r))))
I forgot to keep spaces and therefore my algorithm figured all my inputs were single words and ignored them..
> Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems. <cite>Jamie Zawinski
Uberjar aborting because jar failed: clojure.lang.MapEntry cannot be cast to clojure.lang.IPersistentMap
Has anyone else encountered this?
Could be, I've got absolutely no idea where this is coming from. Development works just fine
I'll look into my project.clj
Nothing just that one line
you have a source file that isn't valid somewhere in your project, an you are doing aot compile all or something that is causing all source files to be loaded with a jar is created
go through the source files in your project, loading them, and one of them will throw that error with a real stacktrace
@hiredman: Excellent, I think I found the file. Thanks
Does anyone know how to catch errors in a loop, but make sure they don’t prevent the loop from finishing?
would be good to print them out
@bja any ideas?
Would need to see code to be more specific @josh_tackett
It’s alright I’ll just handle with a try catch
the code is side effecting, so I don’t need the return structure
try/catch was going to be my suggestion anyway 🙂
@seancorfield: Hmmm the try catch still get’s stopped:
(mapv #(try (eval (% {:1 (prn (+ 1 1))
:2 (/ 1 0)
:3 (prn (+ 2 2))}))
(catch Exception e (str "caught exception: " (.getMessage e))))
[:1 :2 :3])
here is some example code
just discovered that if I use transit with kinesis that I need to exclude jackson.core due to a version conflict - I wasted a shitload of time on this … just wondering where the best place is to post this so that it’s not me blowing it into the wind 😉
Does it barf earlier or in a more obvious fashion if you use :pedantic? :abort
in your project.clj?
@josh_tackett: shouldn’t you quote those forms inside the map?
Hey #C03S1KBA2, I just hit a problem with upgrading a lein plugin/clojars that I didn't think or expect could happen and which has left me a bit confused and concerned.
The lein-release
artifact id corresponds to two different projects, lein-release the release plugin https://github.com/relaynetwork/lein-release and lein-release the bundle everything into a tarball plugin https://github.com/technomancy/lein-release (now renamed to lein-tar since ~6 years ago)
We were using version 1.0.9 of the former. Running lein-ancient suggested upgrade to 1.1.3 since it's a later version. So I did that and then tried to release my project but got left with a tar file instead
@hiredman @plexus: solved it, there was a {
misplaced in project.clj
, thanks for the guidelines
@danmidwood: version 1.0.9 of lein-release on clojars is still the relaynetwork version. Are you sure the technomancy version you were using was ever on clojars?
Yeah. Up to 1.0.9 is relaynetwork, on to 1.1.3 is technomancy https://clojars.org/lein-release/versions
I guess that Clojars understands that 1.0.9 was released later by timestamp
I don't know the history there, but it looks like @kyle.burton may have had rights to the lein-release project, and pushed versions that were older than what was there?
I'd file an issue on lein-release and ask for a release higher than 1.1.3 to appease lein-ancient
They're not older versions really, just two distinct projects that happen to share the same group/artifact ids
Yep. Sorry, I misunderstood what you intended before
Np. I'll raise an issue on the relaynetwork github about it
Hi, regarding lein-release, I'm no longer with relaynetwork
so I don't know that I can perform releases of that project at this point.
@josh_tackett: Because you are always evaluating (/ 1 0)
boot.user=> (mapv #(try (eval (% {:1 '(prn (+ 1 1))
#_=> :2 '(/ 1 0)
#_=> :3 '(prn (+ 2 2))}))
#_=> (catch Exception e (str "caught exception: " (.getMessage e))))
#_=> [:1 :2 :3])
2
4
[nil "caught exception: Divide by zero" nil]
Note that the forms in the map are quoted — so this selects the map entry first, then eval
s it, and now only the one evaluation fails, and it side-effects to print 2
and 4
as expected and returns nil
for those expressions (`prn` returns nil
).