#clojure log - Jul 10 2015

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

2:13 elvis4526: I'm sure someone here is using emacs & cider to run tests, right ?

2:14 I can't get cider to detect my tests :|

2:19 Reefersleep: (ince justin_smith)

2:19 (inc justin_smith)

2:19 lazybot: ⇒ 274

2:19 Reefersleep: (inc oddcully)

2:19 lazybot: ⇒ 12

2:19 Reefersleep: (inc oddcully)

2:19 lazybot: ⇒ 13

2:19 Reefersleep: Didn’t know what this meant until just now, figure I owe some :)

2:19 (inc oddcully)

2:19 lazybot: ⇒ 14

2:22 ddellacosta: elvis4526: what do you mean by "can't get cider to detect my tests?"

2:22 also, you may have luck in #clojure-emacs too, check it out

2:25 elvis4526: ddellacosta: Well, the typical functions to run tests from cider "C-c ," for example always returned "0 tests - 0 errors - 0 failures [...]"

2:25 ddellacosta: elvis4526: oh, I see...yeah, I'm always running them manually in the cider repl

2:26 elvis4526: but then I noticed that I had (?) multiple repl open, so I think cider was connected to an old and dirty repl

2:26 ddellacosta: ah, that would make sense

2:26 if the ns wasn't loaded up properly there

2:26 elvis4526: yep, now its working

2:26 yeah exactly

4:07 Derander: Hi all! I'm trying to track down why my project is importing cider-nrepl 0.8.2 instead of 0.9.1. Attached is the output of `lein deps-tree`, along with profiles.clj and project.clj. https://gist.github.com/AndyMoreland/b1f5a3bf055fd14f4edc

4:08 When I execute cider-jack-in in emacs I see https://gist.github.com/AndyMoreland/36c4362ce5ffa3d77d00 .

4:10 H4ns: Derander: i had that problem on monday but i was so aggravated when i finally solved it that i forgot the solution. you've certainly checked your ~/.lein/profiles.clj already?

4:11 Derander: H4ns: yar -- it's in that gist if it's interesting. Changing the version number of the cider-nrepl plugin in it doesn't seem to be having an effect though

4:11 I've noticed that if I kill my maven cache it'll download both the correct version and, unfortunately, 0.8.2. `lein repl` *seems* to be using 0.8.2 but I'm not sure how to verify this aside from the cider error message.

4:12 H4ns: Derander: found it: it was a bad tools.nrepl dependency that caused the issue

4:12 Derander: H4ns: `:dependencies [[org.clojure/tools.nrepl "0.2.7"]]` that guy?

4:12 H4ns: Derander: I added ":dependencies ^:replace [[org.clojure/tools.nrepl "0.2.10"]]" to get rid of it.

4:12 Derander: right

4:13 Derander: I'll try the metadata

4:13 hadn't used ^:replace

4:15 H4ns: well, I'm getting a whole new world of errors now so I'll explore these. Thanks for helping me make progress :-)

4:15 H4ns: Derander: "enjoy"

6:21 dstockton: is running custom code inside a query still possible when running a peer as a separate process and using the REST api?

6:22 (datomic)

6:43 jonathanj_: if i have a situation where i create a connection (an irc connection) and i want to send messages over that when i get some HTTP request (via a ring handler), what's an idiomatic way of doing that?

6:44 obviously i could (def connection ...) in some namespace and just use that, but that doesn't seem particularly idiomatic to me

6:44 dstockton: jonathanj_: sounds like a use case for component

6:45 jonathanj_: dstockton: what's component?

6:45 dstockton: https://github.com/stuartsierra/component

6:45 it can help you avoid defining globals or singletons

6:47 jonathanj_: thanks, that looks interesting, i'll take a look

6:48 although, let's say without the help of a library providing some kind of protocol, what would another possible approach be?

6:55 dstockton: defing it globally is a possible approach

6:56 component is a pretty small library

6:56 you could do something similar yourself should you wish

7:23 wombawomba: So clojurescript is supposed to have pprint now: http://dev.clojure.org/jira/browse/CLJS-710

7:23 However, requiring clojure.pprint from cljs gives me "No such namespace: clojure.pprint, could not locate clojure/pprint.cljs..."

7:23 What am I doing wrong?

7:24 tahmid: This code is taken from sente example. https://gist.github.com/tahmidsadik112/d70d15284bedea82f07f

7:24 Bronsa: wombawomba: apparently the ns is cls.pprint

7:24 cljs*

7:24 tahmid: I am having a hard time trying to understand what is happening in the function parameter.

7:24 wombawomba: ah, okay

7:24 thanks

7:25 tahmid: Can anyone explain, please

7:53 chomwitt: ,(pr-str [\u2620])

7:53 clojurebot: "[\\☠]"

7:53 chomwitt: is that logical?

7:54 the string representation of a vector with one character is a vector with 3 characters??

7:54 lazybot: chomwitt: What are you, crazy? Of course not!

7:55 chomwitt: lazybot: ?

7:55 hyPiRion: chomwitt: lazybot is a bot, just replies to things that ends with ??? or ??. Isn't that right??

7:55 lazybot: hyPiRion: Definitely not.

7:56 chomwitt: :-)

7:56 cool ??

7:56 lazybot: chomwitt: Definitely not.

7:57 chomwitt: so is that logical?

7:57 oddcully: havent you asked that yesterday?

7:57 or some mutation?

7:58 chomwitt: oddcully: yep!

7:58 oddcully: about str, now i ask about pr-str

8:55 hellofunk: chomwitt: why do you need to know that ??

8:55 lazybot: hellofunk: What are you, crazy? Of course not!

9:03 noncom: chomwitt: yes, an interesting issue. i'd like to know too.

9:08 hyPiRion: "By default, pr and prn print in a way that objects can be read by the reader"

9:08 ,(pr [\u2620])

9:08 clojurebot: [\☠]

9:09 hyPiRion: ,(let [v [\u2620]] (= (read-string (pr-str v)) v))

9:09 clojurebot: true

9:10 hyPiRion: Which means that pr-str (when possible) prints something that the reader can read back in.

9:15 noncom: i see...

9:16 oddcully: ,(pr-str (java.util.Date.))

9:16 clojurebot: "#inst \"2015-07-10T13:16:25.827-00:00\""

9:20 dnolen: Bronsa: cljs.tools.reader is now only 1.5X slower than clojure.tools.reader in Safari, Chrome & Firefox :)

9:38 namra: hm is there a clojure autocomplete plugin for vim?

9:39 oddcully: namra: vim-fireplace

9:41 namra: hm than im missing something, whats the shortcut?

9:41 varaindemian: Can anyone help me fix this syntax?

9:41 http://pastebin.com/k1ckYRZX

9:45 dstockton: not sure if vim-fireplace has autocomplete

9:45 vim-clojure-static does

9:45 namra: oddcully: thanks, connecting to repl and then ctrl-x followed by ctrl-o works

9:46 dstockton: fair enough

9:46 aha https://github.com/tpope/vim-fireplace#omnicomplete

9:48 namra: dstockton: thanks

9:49 dstockton: no info there namra, just confirming to myself that it has it

9:49 i use YouCompleteMe so im not familiar with the shortcuts

9:49 varaindemian: nobody? :(

9:54 justin_smith: varaindemian: it's kind of hard to tell what you are trying to do there

9:54 varaindemian: x=y is a valid parameter name, but it isn't a binding syntax

9:55 ,(def x=y true)

9:55 clojurebot: #'sandbox/x=y

9:55 justin_smith: ,x=y

9:55 clojurebot: true

9:56 justin_smith: varaindemian: the second or third argument to defn must be the parameter binding vector

9:56 varaindemian: what are those if calls supposed to be doing?

9:59 varaindemian: justin_smith: My friend asked me to take a look, but I have no guess about lisp/clojure. Thouht in this place I can get help

10:00 justin_smith: varaindemian: OK, there's enough problems in that code that it's hard to tell what the programmer is actually trying to do

10:02 dstockton: there's enough problems in that code, i thought you were trolling

10:02 varaindemian: justin_smith: trying to make a prisoners dilema code

10:03 justin_smith: thnak you anyway

10:06 justin_smith: maybe something like ... (defn strategy [x] (let [p1 (RandomMove) p2 (RandomMove)] ...) as a start

10:06 I'm not sure what's supposed to be happening, but that might be the first few lines

10:11 csd_: Does anyone know if Avout is a dead project? And if so what might be an actively developed successor?

10:11 chomwitt: ,(rest (pr-str [\k]))

10:12 clojurebot: (\\ \k \])

10:12 chomwitt: does that make sense?

10:18 oddcully: ,(seq (pr-str [\k]))

10:18 clojurebot: (\[ \\ \k \])

10:23 justin_smith: csd_: the issue with avout is that watches are pretty much totally broken

10:23 csd_: I don't know if anyone plans on working on it

10:23 clojurebot: I don't understand.

10:34 jhn: here's some scala: def b(n: Int) = (1 to n) flatMap (1 to _)

10:34 b(5) => Vector(1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5)

10:34 here's the clojure i came up with

10:35 justin_smith: ,(defn b [x] (map #(range 1 %) (range 1 x)))

10:35 clojurebot: #'sandbox/b

10:35 jhn: (defn a [n] (mapcat #(range 1 %) (range 1 (+ 2 n))))

10:35 justin_smith: ahh, the mapcat part

10:35 jhn: nah, that does not produce the same

10:35 you have to add 2

10:36 so I'm wondering if there's a more elegant way to do this in clojure?

10:36 justin_smith: and I think you need (inc %)

10:36 jhn: I doubt it

11:04 csd_: justin_smith: is there an actively developed library for handling distributed consensus?

11:04 ops, kick bioogir for spamming

11:10 Bronsa: csd_: is it spamming in private messages?

11:11 oh yeah, there he goes. puredanger please kickban bioogir

11:26 chouser: I don't see the spam. Where is it?

11:26 xemdetia: the spam is an illusion

11:26 chouser: ah. I don't know if I can do anything about that.

11:26 xemdetia: maybe there is a netsplit going

11:28 chouser: oh, I guess if the spammer isn't in here, won't know who to privately spam. I'll try.

11:30 csd_: chouser: for me it was on channel join

11:31 Bronsa: chouser bioogir spams users in private message when they talk/join

11:32 chouser: yeah, I figured that out. looks like my attempt to use the ban feature is incorrect.

11:32 Bronsa: chouser you just need to kick him

11:33 cool, thanks

11:33 oddcully: woohoo

11:33 Bronsa: (inc chouser)

11:33 lazybot: ⇒ 22

11:33 chouser: yay. happy to help.

11:37 justin_smith: csd_: just got to work. if the distributed consensus stuff is all you need, avout should be good, or you could directly use zookeeper

11:37 csd_: it's just the watcher abstraction in avout is broken

12:05 mmeix: would this be considered ok style or not:

12:06 ,(filter :draw [{:note 1 :draw true} {:note 2 :draw false} {:note 3 :draw true}])

12:06 clojurebot: ({:note 1, :draw true} {:note 3, :draw true})

12:06 mmeix: ?

12:07 (instead of: (filter #(:draw %) ...) )

12:11 justin_smith: mmeix: definitely use :draw instead of #(:draw %)

12:11 mmeix: I guess yes than ...

12:11 thanks

12:11 justin_smith: but you still might want #(:draw % :default) sometimes

12:11 mmeix: *then

12:11 justin_smith: mmeix: yeah, I'd consider #(:draw %) bad style

12:12 mmeix: aha, defaults would be a case, yes

12:12 OTOH I think defaults should maybe taken care of more upstrem

12:12 upstream

12:12 hellofunk: #((get get get get) % :draw) is another option mmeix justin_smith

12:12 justin_smith: mmeix: you wouldn't want :default in a filter anyway :)

12:13 hellofunk: lol

12:13 hellofunk: hey if it works, why change it?

12:13 mmeix: and not (get get get ...)

12:14 justin_smith: ,(((get get get get) (get get get get) (get get get get) (get get get get)) nil get)

12:14 clojurebot: nil

12:14 mmeix: urx

12:14 justin_smith: wait

12:14 ,(((get get get get) (get get get get) (get get get get) (get get get get)) nil nil get)

12:14 clojurebot: #object[clojure.core$get 0x9ca2636 "clojure.core$get@9ca2636"]

12:14 justin_smith: there we go!

12:14 hellofunk: i almost did that one myself but i didn't want to get banned

12:14 justin_smith: hahaq

12:14 hellofunk: I don't think anyone would get banned for stupid clojure tricks

12:15 unless they are really spammy or something

12:15 mmeix: for multiple gets I would consider a macro then ... :)

12:15 justin_smith: mmeix: it's just one get

12:15 it's just a really awkward (stupid) way to do it

12:15 mmeix: yeah understood that ...

12:16 justin_smith: ,(= (get get get get) get)

12:16 clojurebot: true

12:17 mmeix: I changed from leiningen to boot BTW, and so far it has been a pleasure

12:18 with a little help from martinklepsch/tenzing

12:18 justin_smith: interesting

12:18 I might have to try it one of these days

12:18 mmeix: I like the fact, that all of live-reload etc is now under one single umbrella

12:19 tmtwd: is it feasible to use clojure with a java textbook?

12:19 clojurebot: No entiendo

12:19 mmeix: feels right to this beginner's mind :)

12:19 why a JAVA textbook?

12:20 I would prefer a clojure text book

12:20 tmtwd: theres not a clojure textbook that is as comprehensive as this one?

12:20 most clojure books are general programming books

12:20 mmeix: The Joy of Clojure

12:21 there are some cookbooks

12:21 oddcully: clojure applied is finished

12:21 justin_smith: tmtwd: I think a big problem with using a java textbook would be how much of the book is going to be about things like inheritance or mutable fields, which even when we do them in clojure it's awkward to do them java style and we have our own version...

12:22 tmtwd: yes, that is certainly true

12:22 justin_smith: tmtwd: you'd have better luck with eg. SICP (a scheme textbook)

12:22 tmtwd: already reading scheme

12:22 mmeix: (I do like my safaribooksonline plan ...)

12:23 tmtwd: does joy of clojure have programming exercises?

12:23 edw: Hey folks, if you live in the NYC area and are looking for a Clojure/Unix or Devops engineering position, please check out the jobs section of <http://actionx.com/&gt;; I'm hiring for three positions. Feel free to private message me or email me at my personal e-mail <edw@poseur.com> if you have questions.

12:24 mmeix: http://www.4clojure.com is a well known source of programming exercises

12:24 and http://clojurekoans.com

12:27 {blake}: Welp, after over a year of no problems with lein, I can no longer install it. That's a pretty good run.

12:27 And the problem is github.com's SSL certificate?

12:28 mmeix: tmtwd also "Living Clojure" by Carin Meier is friendly, and with exercises

12:29 tmtwd: does living clojure have web stuff (ie cljs)?

12:30 mmeix: a bit

12:30 one chapter, IIRC

12:31 but there is really nearly no difference between clojure and clojurescript, learningwise

12:32 (if this word exists in English ;)

12:32 TEttinger: {blake}: I had the same issue, oddly

12:32 it was a quick fix

12:33 {blake}: TEttinger: I'm on tenterhooks...

12:33 (You don't see a lot of tenterhooks these days.)

12:33 mmeix: tmtwd another tip: http://www.braveclojure.com

12:33 TEttinger: heh

12:33 my computer is slow as molasses right now

12:34 {blake}: That's fine. It heightens the suspense.

12:35 TEttinger: (You are gonna clue me in, right? This isn't another of life's cruel jokes...)

12:36 tmtwd: oh yeah, brave clojure is awesome

12:37 TEttinger: are you using wget, {blake}?

12:38 line 146 of lein.bat , I needed to find it in there

12:38 it can use wget, curl, or one other

12:38 call wget --no-check-certificate -O %1 %2

12:38 that is what should replace line 146 in what I believe is the newest lein.bat (it did change at some point)

12:38 {blake}: Oh! Okay, yeah, I was looking at that. Let me give that a shot.

12:39 TEttinger: AH! Thank you! That seems to have...

12:39 TEttinger: woo!

12:39 I think!

12:39 {blake}: ...done it!

12:39 TEttinger: huzzah

12:39 {blake}: (Just adding to the suspense.)

12:40 (inc TEttinger)

12:40 lazybot: ⇒ 58

12:40 {blake}: (inc TEttinger)

12:40 lazybot: ⇒ 59

12:40 {blake}: 'cause why not.

12:40 TEttinger: yay

12:40 I hope that gets fixed soon, it's going to be annoying for new users

12:41 {blake}: I wonder what the deal is with that. Yeah, no kidding, I always hype how easy Clojure is to install and how great lein is.

12:41 TEttinger: is hyPiRion the current maintainer?

12:42 $google leiningen

12:42 lazybot: [Leiningen] http://leiningen.org/

12:42 TEttinger: there's an existing bug report for it, that's where I found that people fixed it by doing that. they didn't say what lineto change...

12:43 I'll add that now

12:43 {blake}: I don't know vis a vis hyPiRion

12:43 I thought I'd seen his name attached but I can't find it now.

12:43 TimMc: There are a number of folks with commit access but I don't know who does releases.

12:44 maybe ato

12:44 {blake}: Looks like he has the most.

12:45 TimMc: TEttinger, {blake}: What's wrong with github's ssl cert?

12:45 {blake}: TimMc: "ERROR: cannot verify github.com's certificate, issued by `/C=US/O=DigiCert Inc/O

12:45 U=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA':

12:45 Unable to locally verify the issuer's authority."

12:46 TEttinger: there's an error on github's issues

12:46 wget errors out on windows, I think is the name

12:46 TimMc: Are yo uon an old Windows with an old SSL truststore?

12:47 {blake}: I'm currently running Windows 7 in a controlled corporate environment. I haven't checked my Linux boot yet.

12:48 TEttinger: TimMc: Windows 7, no idea what my truststore is

12:48 it's worked fine until I needed to update java

12:49 (I was using like jdk 1.7_025)

12:51 {blake}: TEttinger: Oh, me, too, for lein.

13:02 TEttinger: hm, what does this mean in lein's CONTRIBUTING file?

13:02 Please use topic branches when sending pull requests rather than committing directly to master in order to minimize unnecessary merge commit clutter. Direct pull requests towards the master branch, not the stable branch.

13:02 this is a one-line change

13:04 TimMc: Size of the changeset isn't really important.

13:04 TEttinger: what is a topic branch?

13:05 the two sentences there conflict for me

13:07 TimMc?

13:07 clojurebot: TimMc is the other gfredericks

13:07 TEttinger: I see

13:07 gfredericks?

13:07 clojurebot: gfredericks is gfredricks

13:07 TEttinger: heh

13:09 hyPiRion: TEttinger: On your own fork, do git checkout -b my-pr, then when you issue a PR, direct it towards the master branch.

13:10 TEttinger: yep, that would have been nice to know before I made the commit.

13:11 gfredericks: me?

13:11 clojurebot: me is greek to it

13:11 gfredericks: oh that's how I came up

13:12 TimMc: TEttinger: Create a branch where you are now, then reset master to origin/master or whatever.

13:12 actually no, tht's not really necessary if you're working from a fork

13:15 TEttinger: ok, it appears to be working

13:16 hyPiRion: is this configured correctly and sound for contributing? https://github.com/technomancy/leiningen/pull/1931

13:22 hyPiRion: TEttinger: It looks fine, but we don't want to skip certificate checks for Windows; https://github.com/technomancy/leiningen/issues/1800#issuecomment-70041223

13:23 The fix for #1800 ships with 2.5.2, which has been in limbo for far longer than I'd like to

13:23 TEttinger: ok

13:23 thanks

13:24 close whenever or I can

13:24 hyPiRion: Np, and sorry for not responding immediately to those issues. I've been a bit busy, and will be until next week is over =/

13:25 {blake}: OK, I'm chaining a bunch of assocs. (-> (assoc :whatever "whatever") -> (assoc :more "more"))

13:25 hyPiRion: irl can be a bit shitty with you sometimes

13:27 {blake}: But now I want to conditionally assoc, like... (-> (if cond (assoc :thing "thing") (assoc :other "other")))

13:28 But I can't, of course, 'cause the if breaks the threading...

13:28 hyPiRion: {blake}: (-> foo (cond-> cond (assoc :thing "thing")) (assoc :other "other"))

13:29 {blake}: hyPiRion: Thanks! Back to reviewing the std functions again, I guess...

13:29 (inc hyPiRion)

13:29 lazybot: ⇒ 76

13:34 {blake}: hyPiRion: Well, almost. "Other" gets evaluated every time. =P But I can figure it out from there, I think.

13:35 hyPiRion: oh, right

13:35 {blake}: I don't suppose there's an "if->"?

13:36 hyPiRion: There's as->. You can do (as-> val x (assoc x foo bar) (if cond (assoc x :a "a") (assoc x :b "b")))

13:45 {blake}: hyPiRion: Yes! That's the ticket.

14:16 tmtwd: where do I put the js directory in a compojure project?

14:20 arrdem: {blake}: I have an if-> implementation kicking around but it is just an as-> shorthand like amalloy said

14:20 oops hyPiRion not amalloy

14:24 danielpcox: does anyone here have any experience with Scala/Clojure interop? I get "Exception Incompatible return types" when I do (proxy [SomeScalaAbstractClass] []), but not when I do, e.g., (proxy [java.io.InputStream] [])

14:31 tmtwd: which clojure book would be the best for web dev?

14:32 joy of clojure?

14:35 katratxo: tmtwd: the joy of clojure tries to explain the "why?" ... "clojure programming" the o'reilly one has some chapter on web development

14:36 i don't have an opinion on this one, but the name suggests that is focused on web development https://pragprog.com/book/dswdcloj/web-development-with-clojure

14:39 scgilardi: fair witness

14:40 tmtwd: the latest one is 2012....

14:41 I feel things have changed a lot since then

14:53 TEttinger: danielpcox: how would you extend or implement SomeScalaAbstractClass in Java, and is it different from how you would java.io.InputStream? I have no experience with scala anything interop, though I have written some scala and a lot of clojure

14:54 csd_: I'm trying to use sorted-set-by to sort hashmaps that have a :time element. But, sorted-set doesn't include maps with identical times but which are different values otherwise. Is there an alternative implementation for sorted set / an easy way around this?

14:54 tmtwd: for tcp sockets, you just use the java core library sockets?

14:54 csd_: i know i could sort on secondary keys but i just don't care where they go at that point

14:54 TEttinger: csd_: ##(doc sort-by)

14:54 lazybot: ⇒ "([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. If coll is a Java array, it w... https://www.refheap.com/105958

14:55 Bronsa: csd_: just never return 0 on the comparator

14:55 justin_smith: csd_: (juxt :time identity)

14:55 Bronsa: csd_: if they're equal and you don't care which one comes first, return 1 or -1 rather than 0 on =

14:55 justin_smith: csd_: that way the :time value is the primary sort, but it also compares the entire object

14:56 csd_: ah thank you

14:56 katratxo: tmtwd: try https://github.com/ztellman/aleph

14:59 justin_smith: is there a pattern and/or lib for stuartsierra/component that simplifies starting a subset of a system? for example "start my app, but don't start the http server" - it seems like this should be a thing I can do, but it seems like it would involve a lot of messy conditionals or repeating myself...

14:59 gfredericks: justin_smith: dissoc?

15:00 justin_smith: gfredericks: OK, but what about the nested stuff in system-using?

15:01 maybe it just won't care and the nested keys that don't exist will be ignored (have not tried it that way yet)

15:02 {blake}: arrdem: I mostly thought of it in terms of symmetry. "as->" is fine for now.

15:03 gfredericks: justin_smith: you want to turn off the http server but still have things running that depend on it?

15:03 justin_smith: gfredericks: luckily the http server is a "top of the stack" element

15:04 I would also manually dissoc other things if they depended on it, but automating that would be nice too

15:04 nooga: I just wrote a fn that takes a string and returns all used characters formatted neatly inside a rectangle and then fed its source to itself: https://goo.gl/GOZ1uh

15:04 gfredericks: justin_smith: seems like something that's best left manual imo

15:04 justin_smith: so like a (system-without system-parts :http-server) is what I want

15:05 gfredericks: hmm, yeah, but a way to specify it without a lot of repeating myself would still be nice (expressing it as a simple dissoc / tree prune)

15:09 tmtwd: http://pastebin.com/3bU9PYhb How would I do this java code in clojure

15:09 ie, how do I override a class from java and implement methods in it?

15:09 csd_: If I use this as a comparator function to two maps, without the tick before the vector at the end, I get a ClassCastException with a missing stack trace. (apply compare (map (juxt :time identity) '[a b]))

15:09 weird

15:10 chrisfjones: tmtwd: https://clojuredocs.org/clojure.core/extend should get you there

15:11 tmtwd: chrisfjones, thanks

15:12 chrisfjones: tmtwd: actually, I just looked at your pastebin extend may not be what you want

15:14 tmtwd: you'll more likely want to go through the whole gen-class dance: https://clojuredocs.org/clojure.core/gen-class

15:19 gfredericks: justin_smith: I guess I just have a hard time imagining the scenario where you want to do anything besides remove a top-level thing

15:26 justin_smith: gfredericks: start up a repl where I can access the db config and manually use my db code, but don't start any servers listening for connections

15:27 I guess those servers are all top-level things, come to think of it, maybe I a over-generalizing my need here

15:29 gfredericks: does that thing in cheshire still need debugging?

15:46 dasik: Hello, is anyone willing to answer some basic questions about clojurescript?

15:47 justin_smith: dasik: you might have better luck on #clojurescript, but the general rule is you don't have to ask to ask, you can just ask

15:47 dasik: Thanks, I'll check there.

15:48 bja: can component destructure dependencies yet?

15:48 err, com.stuartsierra.component/using

15:48 gfredericks: justin_smith: sure does

15:51 justin_smith: gfredericks: cool, taking a look

15:52 bja: I want to say something like {:postgres (new-pg-pool) :foo (component/using (new-foo) {{:keys [foo-service-uri] :settings :db :postgres}}

15:54 gfredericks: justin_smith: I'm 80% sure it has something to do with "wholeness", whatever that is

16:24 xemdetia: justin_smith, I wonder for your late start http server it would be worth seeing if modeling your http server as a delay would work

16:24 It wouldn't work as defined in component right now though

16:25 justin_smith: xemdetia: it's not about late-start, but rather only creating a subsystem

16:25 xemdetia: ah

16:25 justin_smith: xemdetia: for dev purposes

16:26 I figured out a way to do it, by first filtering all keys that are not present in the initial system map, or referring to deps not present in the initial map

16:26 then coming back again and removing from the system map those keys that were already pruned from the deps (because they depended on things now removed)

16:26 so now I can specify a set of keys to be removed, and they and everything that used them will not be present in the started system

16:26 which works pretty well for me

16:28 so a tree-prune of the final dep tree basically

16:30 devn: i tried the clojurians Slack

16:30 but I miss you all too much

16:30 bucketh3ad: I have :aot :all set in my lein project. Is there a way to recompile the code from inside the repl or do I need to start a new repl?

16:30 Bronsa: <3

16:35 xemdetia: ah that makes sense

16:46 justin_smith: bucketh3ad: (require 'some.ns :reload) or (require 'some.ns :reload-all) should reload, and recompile as apropriate

16:47 Bronsa: justin_smith: only if you set *compile-files* IIRC

16:47 justin_smith: Bronsa: oh, interesting

16:48 Bronsa: oh yeah, I assumed he meant effectively recompile for the repl, but if you also need it to compile to disk you would need *compile-files* too right?

16:48 arrdem: devn: it is possible to lurk both :P

16:49 Bronsa: justin_smith: yeah, he talked about :aot so I assume he was indeed talking about compiling to disk

16:53 bucketh3ad: What's that about *compile-files* ? How do I use that?

16:56 arrdem: bucketh3ad: Compiler.java only writes generated classes to disk if *compile-files* is truthy

16:56 Bronsa: $doc *compile-files*

16:57 uhm

16:57 arrdem: bucketh3ad: if you read the source for clojure.core/compile all it does is load (which runs Compiler.java over a file) with *compile-files* bound to true

16:57 Bronsa: &doc *compile-files*

16:57 lazybot: java.lang.RuntimeException: Can't take value of a macro: #'sandbox6330/doc

16:57 arrdem: ,(doc *compile-files*)

16:57 clojurebot: eval service is offline

16:57 arrdem: Bronsa: ^

16:57 Bronsa: (╯°□°)╯︵ ┻━┻

16:57 arrdem: I'm pretty sure clojurebot had a command

16:57 arrdem: because hiredman is a dick I can't do it myself

16:57 Bronsa: ,(doc *compile-files*)

16:57 arrdem: $grim clj::clojure.core/*compile-files*

16:57 clojurebot: "; Set to true when compiling files, false otherwise."

16:57 Bronsa: ah, lazybot is offline.

16:57 *sigh*

16:57 arrdem: well lazybot still doesn't have my grim plugin months later

16:58 in addition to being dead

16:58 Bronsa: lazybot: $ping

16:58 I apparentely forgot how lazybot works

16:59 bucketh3ad: Bronsa: Oh, I see. So how would I set that to true in the REPL?

16:59 just def over it?

16:59 Bronsa: bucketh3ad: (binding [*compile-files* true] (require ..))

16:59 arrdem: or set!

16:59 bucketh3ad: binding. Haven't used that before. cool.

16:59 Bronsa: don't think set! will work

16:59 arrdem: yeah it's not bound in the repl

16:59 arrdem: I mean binding is the right answer and what clojure.core/compile does..

17:00 weird

17:20 justin_smith: arrdem: (intern 'clojure.core '>>>>>>> (lazy-seq (cons (throw (Exception. "you fucked up the merge, dumbass")) nil)))

17:20 arrdem: justin_smith: ahaha

17:21 nooga: :D

17:21 justin_smith: putting it in clojure.core so it goes off no matter what file it's in, of course

17:21 arrdem: I'd vote for something similar on jira :P

17:21 justin_smith: it's a terrible abuse of lazy-seqs, but it works!

17:22 err wait, sometimes it doesn't work

17:22 arrdem: maybe there's a way to abuse thinks directly, so that even checking the value blows up

17:24 arrdem: justin_smith: can you def that to be the deref of something that will explode when touched?

17:24 no that'll be eagerly evaluated...

17:24 jefelante: hi -- silly beginner's question. I'm trying to work on testing a web app with clj-webdriver & need to define a list of elements (100+) along with their CSS selector in a central place to reference for every function. What's the suggested way to do this? One giant map in an EDN file? Namespaces with vars?

17:24 justin_smith: jefelante: yeah, I would put it in an edn file

17:25 jefelante: cool, thanks.

17:29 nooga: manifold, oh manifold, how do I manifold :F

18:00 gcganley: when I evalualte something in cider repl it prints exactly 20 newlines. Its insanely annoying

18:20 is everyone dead

18:24 hellofun`: gcganley: some people are

18:27 magnars: about 50% of people are dead

18:27 gcganley: does anyone know what could be wrong

18:28 arrdem: depends on your definition of people and the time domain that definition covers...

18:28 magnars: in that case, I define it in such a way that my statement is correct

18:28 arrdem: No. I'd try the #clojure-emacs channel

18:28 Bozhidar and the other cider guys lurk over there a little more actively

18:29 magnars: gcganley: the quickest way to the cider people is https://gitter.im/clojure-emacs/cider

18:29 gcganley: arrdem: thank you love

18:29 arrdem: If you're on the clojurians slack, the #cider channel there is really really active

18:30 gcganley: I'm moving back to clojure from Haskell for funsies and I've forgotn everything

18:30 magnars: they have a slack too? such channels

18:31 arrdem: the clojurians slack is pretty poppin' in general but IRC has its advantages

18:34 gcganley: slack?\

18:35 atomi: slack blows, don't use it

18:35 gcganley: what is it though

18:35 atomi: wannabe irc

18:35 except ran by one company for profit

18:35 hellofun`: now come on atomi... cut it some slack

18:35 gcganley: HA

18:35 atomi: yeah

18:36 gcganley: puns of damage

18:37 arrdem: Slack has its advantages too... a decent web interface, support for attachments, emojis, embeds, rich formatting..

18:38 atomi: "decent"

18:38 haha

18:38 arrdem: compared to existing web IRC clients it's more than decent

18:39 atomi: arrdem: enjoy your emojis

18:40 yeah

18:41 Epichero: slack is a phenomena, the use case is usually different than irc though

18:41 arrdem: I mean.. I run a slack for my fraternity. the meme and emoji density beggars belief

18:41 neither of which would be reasonably conveyed on IRC even if our members were willing to deal with IRC

18:41 anyway

18:42 atomi: yeah we get it. it's a private for profit company running your chat server with emojis and embedded images/files all on someone elses computer

18:42 Epichero: i mean if for profit means bathe in VC money then yes

18:43 arrdem: and this is evil/bad how

18:43 Epichero: otherwise, idek how they think it's going to monetize

18:43 gcganley: whats wrong with for-profit

18:43 atomi: gcganley: nothing is wrong with making money off your customers

18:44 yeah

18:44 Epichero: they provide plenty for free though as well

18:44 atomi: well yeah I bet

19:22 tmtwd: compared to rails, supposing it uses postgrel, what would I use for clojure?

19:23 could I use something like Datomic for example?

19:28 chrisfjones: datomic and clojure go to gather beautifully imo ;)

19:29 queries are expressed directly as clojure data, results are clojure data

19:29 the (significant) design thinking behind both is consistent

19:52 zacts: the joyful joy that is that super happy clojure

20:26 justin_smith: zacts: super happy immutable persistent fun times

20:33 zacts: indeed

20:33 my sentence has never been said on irc before in history

20:33 :-D

20:34 justin_smith: we are making history

20:34 TEttinger: I'm having a really nice time writing java for things that are specifically highly mutable, and clojure for things that don't need mutable performance but do not persistence for purposes of tracking history versions

20:35 *but do need persistence

20:35 being able to interop so easily is nice.

20:36 subtle_bugs: mic checl

20:37 arrdem: channel's open

21:54 justin_smith: https://i.imgur.com/bdx88D9.jpg

22:31 elvis4526: What's the reader macro to do a lambda ?

22:31 justin_smith: #()

22:32 ,(#())

22:32 clojurebot: ()

22:32 justin_smith: ,(#(* % % % %) 2)

22:32 clojurebot: 16

22:33 elvis4526: can you have args with it ?

22:34 justin_smith: elvis4526: yes, % or %1, and %2 %3 %4 etc.

22:34 or %& for varargs

22:40 elvis4526: ,(#(%1 %2) "l" "l")

22:40 clojurebot: #error {\n :cause "java.lang.String cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.String cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval80$fn__81 invoke "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval80$fn__81 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval80 invoke "NO_SOURCE_FILE" 0]\n [clojure.lang.Compiler eval "Compiler.java" ...

22:40 elvis4526: i'm not sure I understand

22:40 Why it doesn't return "l" "l" ?

22:41 amalloy: elvis4526: what should ("l" "l") return?

22:42 elvis4526: it's evaluated as ("l" "l") ? That's confusing

22:42 amalloy: why is that confusing?

22:43 elvis4526: I'm trying understand the reasoning behind it compared to (fn [param1 param2] (blabla))

22:43 amalloy: elvis4526: what would ((fn [a b] (a b)) "l" "l") return?

22:44 elvis4526: I would expect the error I got below

22:45 I don't see why the args are between parenthese when using the reader macro

22:45 Wild_Cat: elvis4526: they're not.

22:45 elvis4526: perhaps you're looking for #([%1 %2]) ?

22:46 elvis4526: in the reader macro the arguments are defined implicitly. #(%1 %2) is a function that takes 2 arguments, and calls its first argument with the second as its argument.

22:46 IOW, it's *exactly* the function amalloy posted

22:47 amalloy: Wild_Cat: the thing you said elvis4526 might be looking for will never work

22:47 for exactly the reasons you are explaining to him

22:47 Wild_Cat: ,(#([%1 %2]) "a" "b")

22:47 clojurebot: #error {\n :cause "Wrong number of args (0) passed to: PersistentVector"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (0) passed to: PersistentVector"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 28]\n [sandbox$eval27$fn__28 invoke "NO_SOURCE_FILE" 0]\n [sa...

22:48 Wild_Cat: OK, looks like I'm misunderstanding it too.

22:50 what would an actual anonymous function that takes 2 args and returns a vector of [%1 %2] look like?

22:50 (except for the obvious one called "vec" :p )

22:51 elvis4526: ,(macroexpand '#([%1 %2]))

22:51 clojurebot: (fn* [p1__53# p2__54#] ([p1__53# p2__54#]))

22:51 elvis4526: what i don't understand is why the vector is getting called ?

22:51 amalloy: there is a ( right before the vector

22:51 ( means call as function

22:51 Wild_Cat: ,(#[%1 %2] "a" "b")

22:51 clojurebot: #<RuntimeException java.lang.RuntimeException: Reader tag must be a symbol>

22:52 amalloy: #(f x %) always calls f as a function, which is not surprising to you

22:52 #([f] x %) calls [f] as a function

22:52 #([x]) calls [x] as a function

22:52 Wild_Cat: oh.

22:52 elvis4526: the parentheses after the hashbang isn't to delimit the body of the lambda ?

22:52 Wild_Cat: of course.

22:53 ...so really, the only solution is ,(#(vec %1 %2) "a" "b")

22:53 (pointless though it is :p )

22:53 ,(#(vec %1 %2) "a" "b")

22:53 clojurebot: #error {\n :cause "Wrong number of args (2) passed to: core/vec"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (2) passed to: core/vec"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 36]\n [sandbox$eval103$fn__104 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval103 ...

22:54 Wild_Cat: oh, so I *really* suck at this.

22:54 amalloy: Wild_Cat: you mean vector

22:54 Wild_Cat: I do.

22:54 ,(#(vector %1 %2) "a" "b")

22:54 clojurebot: ["a" "b"]

22:55 Wild_Cat: vec takes one collection, right?

22:55 amalloy: yes

23:09 TEttinger: ,(#(vec %&) "a" "b")

23:09 clojurebot: ["a" "b"]

23:09 TEttinger: aw wildcat left

23:53 gcganley: could anyone help me with a CIDER issue? whenever I eval something in the repl 20 newlines appear above the output. its not breaking anything its just really annoying

Logging service provided by n01se.net