Fork me on GitHub
#clojure
<
2016-04-09
>
escherize00:04:50

I don't think I've seen this before. lein repl and lein run both are failing with the same problem:

$ lein run
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See  for further details.
Exception in thread "main" java.lang.ExceptionInInitializerError, compiling:(/private/var/folders/0x/tkfh3v953r9gwfdnxzlncnvh0000gn/T/form-init4880099928816078715.clj:1:125)
	at clojure.lang.Compiler.load(Compiler.java:7391)
	at clojure.lang.Compiler.loadFile(Compiler.java:7317)
	at clojure.main$load_script.invokeStatic(main.clj:275)
	at clojure.main$init_opt.invokeStatic(main.clj:277)
	at clojure.main$init_opt.invoke(main.clj:277)
	at clojure.main$initialize.invokeStatic(main.clj:308)
	at clojure.main$null_opt.invokeStatic(main.clj:342)
	at clojure.main$null_opt.invoke(main.clj:339)
	at clojure.main$main.invokeStatic(main.clj:421)
	at clojure.main$main.doInvoke(main.clj:384)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at clojure.lang.Var.invoke(Var.java:383)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.main.main(main.java:37)
Caused by: java.lang.ExceptionInInitializerError

hiredman00:04:50

you are sure lein repl is throwing the same error?

hiredman00:04:50

lein repl doesn't load your code, so that error must becoming from lein, likely a lein plugin

hiredman00:04:15

there should be more to the stacktrace

escherize00:04:13

yeah, the stacktrace was super long

escherize00:04:25

upgrading to clojure 1.8.0 fixed it (??)

escherize00:04:36

didn't mean to cry wolf

hiredman00:04:39

so is war and peace, but people still find it worthwhile to read it

Alex Miller (Clojure team)04:04:59

escherize: not sure what you upgraded from but there were some changes in 1.7 to avoid loading classes on import

sveri11:04:04

@plexus: Hi, I tried to include tracer-gui into my web app. For this I added [tracer-gui "0.1.0-SNAPSHOT"] to my dev dependencies and added the trace-ring call around my handler. Restarting my application then will throw an error:

plexus11:04:41

interesting, can you add (clojure.core/compile 'tracer-gui.gui) before calling trace-ring?

plexus11:04:58

I thought the jar would contain the compiled classes but guess not

sveri11:04:19

@plexus: That is not helping either. The error still occurs. It happens as soon as I add [tracer-gui.core :as tg] to my :require function

plexus11:04:38

yeah ok, just a minute let me push a new version

sveri11:04:47

Ok, cool simple_smile

plexus11:04:59

ok, try to upgrade, I added :aot [tracer-gui.gui] to the project.clj, it should be able to find the generated class now

sveri12:04:43

Hm, did you push another 0.1.0-SNAPSHOT to clojars?

sveri12:04:14

Ok, let's see if leiningen picks up the new version

plexus12:04:19

Sending tracer-gui/tracer-gui/0.1.0-SNAPSHOT/tracer-gui-0.1.0-20160409.115917-2.jar (40k)
    to 

sveri12:04:02

Seems not so, I go delete it from my cache and try again

plexus12:04:21

lein deps doesn't help?

sveri12:04:49

I did not try it

plexus12:04:56

ah apparently there's a -U flag to lein

plexus12:04:18

to upgrade dependencies, normally it only checks for new snapshots once a day (dixit stackoverflow ;))

sveri12:04:23

Ok, Now there is a different error: :message java.lang.NoClassDefFoundError: clojure/lang/Tuple, compiling:(tracer_gui/core.clj:1:1)

plexus12:04:13

hmmm... bit stumped by that one. I guess I could AOT tracer_gui.core as well

plexus12:04:08

try upgrading again ...

plexus12:04:42

it's working?

sveri12:04:05

nope: :message java.lang.NoClassDefFoundError: clojure/lang/Tuple, compiling:(foo/barrr/middleware.clj:1:1)

plexus12:04:36

that is really bizarre... seems somehow clojure isn't on the classpath

sveri12:04:54

Yea, that looks strange

plexus12:04:29

what version of clojure are you on?

plexus12:04:24

that's most likely it. These classes are now AOT compiled against 1.8, you might have issues using < 1.8

lmergen13:04:45

what would be the best way to 'split' a map, where a specific set of keys go into one map, and the "rest" go into another?

lmergen13:04:12

(if it needs to be, "rest" could also be a set of keys, but i prefer not to)

lmergen13:04:49

i think i need something like select-keys, but then with a little tweak

sveri14:04:09

Hi, how would I convert a map to a vec? {:foo :bar} -> [:foo :bar]... (into [] puts it into a second vec like this (into [] {:foo :bar}) => [[:foo :bar]]

bronsa14:04:51

(into [] (mapcat identity) the-map)

sveri14:04:12

@bronsa: Thanks, that does it. I think I will never remember this one.

tgoossens14:04:47

Is there any serious project working on a c++ implementation of clojure ? Got myself into a c++ project and wondered whether it exists .

escherize14:04:39

@hiredman: after looking through the stacktrace with your guidance, I've concluded that probably the stacktrace was from an older version of cljfmt.

abhishekamralkar16:04:36

Hi Guys! I am beginner to Clojure and really wanted to learn serious stuff about it. Currenlty going through Clojure for the Brave and True!

sveri18:04:52

Hi @abhishekamralkar nice to meet you here. We have a dedicated #C053AK3F9 channel if you have questions. Good Lück 😄

adamkowalski18:04:38

@sveri: if you wanted to make something simpler just flatten your result

adamkowalski18:04:57

[[:foo :bar]] is just a nested vector so flatten seems like the perfect tool for the job

sveri19:04:37

@adamkowalski: That was my first approach too, but then I get back a seq when I want a vec so I have to wrap it into a (into [] ... again and it just blows up the code

adamkowalski19:04:18

what about this then? (reduce #(into %1 %2) [] {:a 1 :b 2})

adamkowalski19:04:42

then you can choose the data structure you would like by just changing the accumulator default

adamkowalski19:04:41

but mapcat also allows you to do that

curlyfry19:04:46

@lmergen: Maybe something like (defn split-map [m keyset] (map flatten (split-with (fn [[k _]] (keyset k)) m)))? Will return a seq of seqs but it should be trivial to make them maps if needed

curlyfry19:04:44

Where keyset is a set, #{:foo :bar :baz}

sveri20:04:21

Ah, thats nice, looks good, thank you too simple_smile

hiredman20:04:41

never, ever, ever, use flatten

sveri20:04:09

@hiredman: why? cause its slow?

hiredman20:04:23

no, because it is terrible

sveri20:04:31

In which regard?

hiredman20:04:37

(it may be slow, I never use it, so I wouldn't know)

bronsa20:04:25

(it's not particularly slow)

hiredman20:04:30

flatten is only useful when you don't know the structure of what you are operating on, which you should always know, and flatten is indiscriminate about what it flattens

bronsa20:04:03

if you ever find yourself needing to use flatten, consider mapcat instead

hiredman20:04:15

yes, or use for

sveri20:04:51

ok, thank you simple_smile

hiredman20:04:16

04:07 < hiredman> ~flatten
04:07 < clojurebot> flatten is rarely the right answer. Suppose you need to use a list as your "base type", for 
                    example. Usually you only want to flatten a single level, and in that case you're better off with 
                    concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

ghadi20:04:44

I miss IRC

hiredman20:04:52

it never left

ghadi20:04:02

we have a bot here too

ghadi20:04:11

(I left it)

bronsa20:04:31

I miss /ignore

bronsa20:04:01

@hiredman: are you using the slack irc bridge?

hiredman20:04:09

no, the webui

hiredman20:04:17

I should, then I would get real logs

bronsa20:04:34

I tried it a while ago and it was just too painful

arrdem20:04:03

I used to run both, so that I had real logs. The webui is definitely enough better to be worth using IMO.

hiredman20:04:31

better than what?

arrdem20:04:31

But I use slack for several groups that go crazy with formatting, emojis and inline images so the IRC bridge isn't very useful for that.

hiredman20:04:08

oh, better than the irc bridge, sure

curlyfry20:04:13

@lmergen: flatten-less version returning maps: (defn split-map [m keyset] (map (partial into {}) (split-with (fn [[k _]] (keyset k)) m)))