Fork me on GitHub
#clojure
<
2016-01-14
>
lvh00:01:24

What does a stateful transducer that merges incoming maps look like?

lvh00:01:32

And produces a map each merge, of course.

lvh00:01:22

I’m looking for (into [] xf [{:a 1} {:b 2} {:c 3}]) ;; => [{:a 1} {:a 1 :b 2 :c 3}] or similar

lvh01:01:47

woo, I got it:

(defn merging
  [rf]
  (let [prev (volatile! {})]
    (fn merging-reducer
      ([] {})
      ([final] (rf final))
      ([acc x]
       (let [merged (vswap! prev merge x)]
         (rf acc merged))))))

jtackett02:01:54

anyone know how to set up proxy authentication when using clj-http ?

jtackett02:01:22

@codefinger: got the quoteaguard static set up, thank you

jtackett02:01:29

but need to figure out proxy auth

codefinger02:01:02

jtackett: ah yea. i was actually looking at it again and couldn't figure that part out

jtackett02:01:12

ya it looks tricky

codefinger02:01:18

seems clj-http doesn't support proxy auth?

jtackett02:01:21

that’s all I have to work with

jtackett02:01:29

but I could probably specify in a header param

codefinger02:01:42

but the underlying Apache HTTP Client does, so must be possible

jtackett02:01:39

any idea how it is done normally in a header param?

jtackett02:01:03

Anyone else have any ideas?

jtackett02:01:56

looks like clj http does support it

jtackett02:01:58

yep jsut found that haha

jtackett02:01:12

worked on it for over a year it looks like

donaldball02:01:15

np I was just researching the connection pooling the other day

jtackett03:01:25

Figured it all out

jtackett03:01:42

@codefinger: and @donaldball ball if you’re interested I can walk you through it

jtackett03:01:14

I used 


and obvs heroku and env vars

codefinger03:01:38

Yea would love to see a code example

kul06:01:08

Hi i am having problem with following `(rs/swagger-json {:paths {"/foo" {:post {:parameters {:body {(s/enum :a :b) s/Num}}}}}})`

kul06:01:43

schema itself has no problem with {(s/enum :a :b) s/Num}

kul06:01:01

i doubt ring-swagger does not like it

danielgrosse08:01:56

Somehow the title is nil, but shouldn't. Also my own code always results into nil, when xml-> is used.

korny10:01:40

@danielgrosse: the trouble is your zipper is pointing at the :page root element already, so you don’t need to specify a :page selection.

danielgrosse10:01:48

@korny thank you. I already found this out by trying. Now your explanation makes sense.

ikitommi10:01:27

@kul: did you try with the latest version? 0.22.2 came out yesterday, had a fix to handle the additionalProperties. btw, there is a #C06GSN6R2 channel

korny10:01:02

Hmm - I’m at work right now, when I get a sec I’ll take a look.

shem11:01:12

i used that to extract parts of the Finnish Meteorological Institute weather forecast data from a humongous XML file and thought it was quite elegant

asolovyov13:01:11

riemann/send-event dies for me with Class com.google.protobuf.UnmodifiableLazyStringList does not implement the requested interface com.google.protobuf.ProtocolStringList, though protobuf is version 2.6.1 as requested by riemann client. Any ideas what can I do?

ragge13:01:06

@asolovyov: have you checked the deps actually on your classpath? lein deps :tree or similar?

asolovyov13:01:22

@ragge: yeah, I did (System/getProperty "java.class.path") and protobuf is 2.6.1...

ragge13:01:46

@asolovyov: can you provide a stacktrace?

asolovyov13:01:17

when I add riemann-client to an empty project, everything works like a charm... 😞

ragge13:01:36

ah, in that case i'd suspect your dependencies

asolovyov13:01:49

user> (filter #(.contains % "protobuf") (.split (System/getProperty "java.class.path") ":"))
("/Users/piranha/.m2/repository/com/google/protobuf/protobuf-java/2.6.1/protobuf-java-2.6.1.jar")

ragge13:01:19

i'd try to make a mininal reproducing case then

asolovyov14:01:54

that's clojurescript... but I have it specified as [org.clojure/clojurescript "1.7.228" :classifier "aot" :exclusions [com.google.protobuf/protobuf-java]], so I really have no ideas what to do...

akiva15:01:54

Looks really good.

Alex Miller (Clojure team)15:01:56

still lots to do there of course, but nice to have it live

gfredericks15:01:07

alexmiller: why does the front page have the typo "Pogramming" but the entire git history of the repo doesn't have it?

Lambda/Sierra15:01:33

Blame mutability.

gfredericks15:01:56

I blame mutability.

Alex Miller (Clojure team)15:01:12

the home page is the only page sourced out of a separate style repo

Alex Miller (Clojure team)15:01:27

I have fixed the typo and will redeploy in a bit - thanks!

Alex Miller (Clojure team)15:01:12

it's up (pending cache invalidations on your path to the content)

martinklepsch16:01:38

is there a nicer way than (some identity [false nil false "x"]) to detect if there's any truthy value in a collection?

ghadi16:01:29

do you want the truthy value?

martinklepsch16:01:17

actually was doing (not-any? true? ..) until I noticed that true? means what it says 😛

ghadi16:01:57

I like some more than i like the mental overhead of two question marks. My mind is feeble in the morning...

docent17:01:44

@alexmiller: Nice. Not sure tho if "downloads" wouldn't look better than "releases"

Alex Miller (Clojure team)17:01:59

we're going to stay with releases for now, but we've gone back and forth on it

be917:01:00

@alexmiller: a typo, "Concurrent Progrmming", in the left sidebar on this page http://clojure.org/about/rationale

Alex Miller (Clojure team)17:01:21

that's in the private style repo

hans18:01:54

if a java method returns a Map<String,Object>, what is the easiest way to access that from Clojure like a map? Can I just treat the Java Map like a Clojure map? into?

ghadi18:01:30

for the most part you can just call (get ...) on it

ghadi18:01:09

if you really need it to have the exact same semantics as clojure maps, then yeah pour it into one with into

hans18:01:21

@ghadi: okay, then that is what i'll do, thanks!

ghadi18:01:22

you won't be able to assoc on it otherwise

ghadi18:01:37

but get should work

jcromartie18:01:54

is this a good place for questions about Cursive?

statonjr18:01:34

@jcromartie: You probably want the #C0744GXCJ channel

borkdude18:01:38

@alexmiller: Is there some kind of roadmap for Clojure or should we look into Jira for that?

borkdude18:01:58

@alexmiller: or is Clojure finished? simple_smile

jcromartie18:01:58

I like the return of the easy to browse API reference material.

Alex Miller (Clojure team)18:01:24

I don't think it's finished :)

borkdude18:01:55

@alexmiller: The site is looking beautiful, congrats

Alex Miller (Clojure team)18:01:31

now we just need the same for clojurescript :)

mike_ananev19:01:48

hello all! I need to work with Apache Spark using Java API. In Java tutorials for Spark there are a lot of examples of using foreach function or other lambdas. How I can call foreach fn from Clojure? I can't use clojure seq or map because foreach in Spark has special meaning (it is an action function). So I must call foreach fn and I can't find any examples of interop between Java 8 and Clojure for new J8 features.

lvh20:01:35

alexmiller: I’m also available here if you’re interested in the TLS thing.

lvh20:01:56

alexmiller: I’m sorry; I thought you just replied saying you didn’t care so much because it’s a static site.

lvh20:01:19

I’m not sure I understand that argument, since, sure, it’s a static site, with a big green call to action button to install some software simple_smile

lvh20:01:59

I am volunteering to fix this, not just complaining.

lvh20:01:08

Although obviously that means access to some systems simple_smile

Alex Miller (Clojure team)20:01:14

ah, sorry I am watching like 19 communications channels and that was like 100 communications ago for me

lvh20:01:22

alexmiller: sorry simple_smile

Alex Miller (Clojure team)20:01:05

I will take a look at it

kamn20:01:47

@alexmiller: I am watched on the clojure-site repo and you are getting swarmed. Good luck with the next few days and great job with the site

lvh20:01:55

I don’t know if convincing people that it’s realistic is important, but I’m also volunteering for that part. I do security for a living, this is super trivial, with off the shelf software and zero config.

lvh20:01:08

alexmiller: thank you for all your hard work though; the website looks gorgeous simple_smile

Alex Miller (Clojure team)20:01:22

@kamn thx! love that people can help.

lvh20:01:59

OK, cool. Let me know if there’s anything I can do to help.