Fork me on GitHub
#clojure
<
2016-05-06
>
puzzler01:05:09

Is there a transducer version of partition?

richiardiandrea02:05:28

Is there any particular reason why logging with log4j works in the uberjar and not in the repl?

richiardiandrea02:05:42

can't seem to see why

seancorfield02:05:31

Is the properties file not on the classpath perhaps @richiardiandrea ?

richiardiandrea02:05:48

I wish it was that easy...it reads it perfectly

seancorfield02:05:52

Then perhaps more details of what is "not working" in the REPL?

richiardiandrea02:05:29

all the things from com.zaxxer.hikari for instance, were printed out before, and they are if I launch the jar's main

richiardiandrea02:05:41

it's the db pool manager

seancorfield02:05:59

That sure sounds like it’s not finding the log4j.properties file to me...

richiardiandrea02:05:16

kk I will double/triple check that

richiardiandrea02:05:16

if I do (io/resource "file") it finds it...

richiardiandrea02:05:55

maybe I am missing some binding/adapter

richiardiandrea02:05:17

Very weird because if I log/info from the repl I see the trace, but the log completely ignores the one, for instance, on app bootstrap (it works with the jar!)

borkdude09:05:06

Is this still the canonical page for clojure success stories? http://dev.clojure.org/display/community/Clojure+Success+Stories

borkdude09:05:36

I'm looking for the talk about Boeing using Clojure

borkdude09:05:14

ok, found it

kul11:05:22

so what is the easiest way of changing a xml node content in clojure?

kul11:05:33

something along the lines of xml-> in data.zip?

lewix12:05:24

@kul I like your avatar

kul12:05:43

It is strange that xml manipulation is so hard in clojure

kul12:05:51

I find this easier

kul12:05:50

more over zippers are also hard to use if the xml does not guarantee order

hans12:05:04

@kul: i agree. and then, there is no good story for when you're dealing with large xml files. if you find something that makes things easier, i'd be interested as well.

borkdude12:05:25

@kul: FWIF, I believe "Programming Clojure" has an entire chapter of a Sax Parser or something, maybe you can use it as inspiration

kul12:05:20

Thanks will take a look

kul12:05:46

something like cheshire for xml would be a instant hit!

kul12:05:49

i guess no one is doing xml these days, i am forced to deal with it due to a legacy third party application

kul12:05:35

if you look at it, It does not feel like a clojure library even remotely

borkdude12:05:31

not all things in clojure are easier than their java counterparts unfortunately

kul12:05:37

traversing is actually quite nice https://github.com/clojure/data.zip/

borkdude12:05:37

@kul There is nothing against using a bit of Java in your project if that makes life easier. You can then call the Java function from Clojure

kul12:05:10

Yep, i agree but i guess for something as horrible as SAX Parser we must do better

kul12:05:21

like what seesaw does for swing

rauh12:05:09

@kul You might like this with XML + data.zip: https://github.com/akhudek/zip-visit

kul12:05:48

cool will have a look

kul13:05:00

I think the way to update xml is quite elegant already but its a shame that its spread across a dozen internal and external ns

kul13:05:11

i will paste a snipper

kul13:05:01

zx/zml1-> can be threaded through tag= and attr= also

kul13:05:09

making it convenient enough i guess

crimeminister13:05:43

@kul: I have used hickory to convert XML and zippers for extracting data; I plan to try using spectre for data extraction next time to see how that combo works (I imagine it being powerful)

agile_geek15:05:54

@alexmiller: noticed MixRadio is still on there. They were shut down by their new buyer. Nothing to do with Clojure and all to do with the business model but not sure if you still want to reference them.

bronsa15:05:51

prismatic aswell

Alex Miller (Clojure team)15:05:31

Well I'd still treat Prismatic as quite a success story :). Don't know the mix radio history as well

magnus16:05:10

Quick question. I see myself doing this a lot to get the value of the first logical true: (some #(when (= % 3) %) [1 2 3 4 5])

magnus16:05:42

Is there a native Clojure construct that can do something like this: (some-cond #(= % 3) [1 2 3 4 5])

bronsa16:05:10

I just use (comp first filter)

bronsa16:05:16

usually aliased to ffilter

ghadi16:05:16

given a reducing function that just aborts on any value...

(defn yield-first
  ([result] result)
  ([result input]
     (when input
       (reduced input))))
... some and first/filter become:
(defn some [pred coll]
  (transduce (map pred) yield-first nil coll))
(defn ffilter [pred coll]
  (transduce (filter pred) yield-first nil coll))

ghadi16:05:48

I kinda like the symmetry of the map/filter

exupero16:05:36

@magnus: Can you use (some #{3} [1 2 3 4 5])?

lwhorton16:05:31

i have a conceptual question regarding clojure … nearly all the operations operating on sequences return the list-form, not the vector… but vectors are used much more frequently overall in user-land. Is there a reason for this? E.g. why do I keep having to (vec (some operation returns ‘()))?

jr16:05:34

Most core functions produce a lazy seq printed as (items)

jr16:05:18

vectors are common in userland because the syntax is convenient

jr16:05:14

normally you don’t want to wrap a lazy seq with vec because that will realize the sequence and lose the benefits of laziness

lwhorton16:05:04

interesting, i did not know vec realizes

lwhorton16:05:29

so it seems the best strategy is to keep everything and at the edges and convert to a vector (if needed)?

jr16:05:29

yeah convert to a vector only if you need different lookup performance/semantics

lwhorton17:05:01

i should have a closer look at this. i’m curious the performance implications of ‘lazy everywhere’ versus ‘make it a vec for better lookup’ and where/when that matters.

jr17:05:29

It depends if you desire random access or not

hiredman17:05:57

if you are not aware that vectors are not lazy, then it is very likely you are doing lots of things that are not lazy

lwhorton17:05:03

^ true that hiredman.

hiredman17:05:06

the default stance in clojure is, unless you know it is lazy, it isn't

lwhorton17:05:28

but luckily i’m in clojurescript land where my folley is less penalizing

magnus17:05:55

Thanks all

magnus17:05:28

@exupero: nope, the collection of integers was just an example

fasiha18:05:54

@lwhorton: it was really helpful for me to read the two answers at http://clojure.org/guides/faq#conj

blueberry18:05:13

@xfcjscn: @thiagofm Fluokitten supports reduce with multiple arguments with it's fold and/or foldmap functions http://fluokitten.uncomplicate.org/codox/uncomplicate.fluokitten.core.html#var-fold

parrellav19:05:53

@mpenet: do you have time for a hayt question?

dww20:05:42

I'm trying to use plumatic/schema's abstract-map-schema--is there a way to specify a default dispatch value?

nkraft21:05:18

Have a Hayt question? I might be able to help.

ghadi21:05:45

Anyone here connect to Prometheus for monitoring?

ghadi21:05:04

wondering how the client lib experience is for that