#clojure log - Feb 24 2015

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

0:02 dnolen: hiredman: thanks that was it, old version was package private, in new release isn't

0:11 rntz: is there any way to use leiningen *without* having a src/ directory?

0:23 seancorfield: rntz: you could configure :source-paths to be just ["."] if you wanted your source files relative to the current directory. Is that what you mean?

0:25 rntz: seancorfield: yes, I think so

0:28 ... anyone have a clue what this error message could mean?: "error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: java.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: java.lang.Character"

0:34 catern: rntz: make sure cider.el is up to date, cider-nrepl is up to date, and also restart emacs

0:35 rntz: catern: how do I make sure cider-nrepl is up to date?

0:35 (I know how to do the other two)

0:35 catern: rntz: run lein deps

0:36 rntz: you have a ~/.lein/profiles.clj that pulls it in, yes?

0:36 rntz: catern: no? I don't even know what ~/.lein/profiles.clj is.

0:37 catern: https://github.com/clojure-emacs/cider-nrepl

0:37 "A minimal profiles.clj for CIDER would be:"

0:37 rntz: I should probably read up on wth profiles.clj is first

0:38 catern: i wouldn't recommend it

0:38 rntz: okay, is there a good way to quit cider when something has gone wrong? (",cider-quit" produces the error message "Wrong type argument: commandp, nil")

0:40 catern: C-x k?

0:40 rntz: hm, I encountered some strange errors after trying that brute-force approach last time

0:40 maybe it was something else going wrong, though

0:44 where does leiningen actually install dependencies *to*? after fiddling with project.clj and lein dep-ing, cider-jack-in seems to be working, but `find` can't seem to find anything named "nrepl" in either the project dir or in ~/.lein.

0:47 ewemoa: rntz: somewhere under ~/.m2 perhaps?

0:48 rntz: ewemoa: aha, thanks

0:49 ewemoa: glad it worked out :)

0:49 rntz: hm. if the latest version of cider-nrepl is 0.8.2, why does CIDER warn me that it's not up-to-date with CIDER's version (0.9.0-snapshot)? is this just paranoia?

0:50 ewemoa: he he, never figured that one out :)

0:50 rntz: and ,cider-quit *still* doesn't work even now that I have cider-jack-in working

0:51 aha, it wants "0.9.0-SNAPSHOT", not "0.9.0-snapshot"

0:51 catern: rntz: because you're probably using cider.el from MELPA or something else that bilds straight from git, yes?

0:51 rntz: right :)

0:51 rntz: er, I mean, you want to put 0.9.0-SNAPSHOT in your profiles.clj, if you're using the latest CIDER

0:51 ewemoa: ahhh...the 'snapshot' should be in all-caps thing -- got bitten by that one recently :)

0:52 rntz: catern: thanks, I figured it out. now I have only *one* warning when jacking in...

0:52 "WARNING: CIDER requires nREPL 0.2.7 to work properly", which seems, uh, misplaced

0:53 but ,cider-quit still doesn't work

0:53 catern: huh

0:53 look at this

0:53 http://stackoverflow.com/questions/28688721/how-to-upgrade-nrepl-version-of-leiningen

0:53 someone across space and time

0:53 is doing exactly the same thing as you right now

0:56 rntz: oh, I see, cider-nrepl isn't the same thing as tools.nrepl

1:02 okay, nrepl all upgraded, no error messages. ,cider-quit still fails, though.

1:03 oh, I see, it's called "hasta la vista" for some silly reason and the error message is bad.

1:22 crocket: Does ClojureScript provide significant long-term advantages over javascript on the web?

1:35 justin_smith: crocket: it has namespaces and immutable datatypes, both of which are a bonus if you want software to be reliable

1:38 but of course it compiles to javascript, but these things are easy to use with the clojurescript semantics

1:48 Eremox1: When is the expected release date for 1.7.0?

1:51 raspasov: Eremox1: if I have to bet, around Clojure/west?

2:22 H4ns: does anyone know the cider failure more where it tells you "Connected." in the status line, but no cider repl buffer appears?

2:27 ah. nuking both ~/.m2/repository/ and ~/.emacs.d/ has helped. quite a large hammer, though.

3:46 hyPiRion: Has anyone taken a look at using transducers on trees? Could imagine it being useful for nanopasses over an AST.

3:47 AeroNotix: H4ns: which version of CIDER are you using?

3:50 H4ns: AeroNotix: i'm running 0.8.2, but i have tried using 0.9.0-snapshot a few times in the past and there probably were some remains of that left.

3:50 AeroNotix: ah right yeah, snapshots'll do it.

3:51 H4ns: AeroNotix: all is good now. i've learned that i'll stick with 0.8.2 until someone gives me a very convincing reason to switch to a newer version. cider snapshots have caused me ginormous grief with their dependencies.

4:05 devll: Hi,How to specify ssh port while connecting to remote REPL?

4:08 H4ns: devll: i've never used it myself, but maybe you want to look at ssh port forwarding (-L flag)

4:08 devll: yes

4:08 H4ns: devll: (i mean, i've never used remote cider repls so far)

4:08 devll: I am able to do that with port forwarding.

4:09 ssh -L 4343:localhost:4343 user@server

4:09 then connect local port

4:09 this works

4:09 H4ns: ... but?

4:10 devll: I thought maybe some option to spicify.

4:10 for cider.

4:14 thanks anyway H4ns

4:17 AeroNotix: H4ns: indeed, running snapshots of cider is really never a good idea.

4:17 devll: I use ssh tunnels daily to get a REPL on a remote instance.

4:17 devll: obligatory "messing with production" warning

4:23 samiswellcool: I've been having trouble getting vim-fireplace to connect to a REPL on a vagrant instance recently, that's not going well for me

4:33 devll: AeroNotix: that's beauty of Clojure. So easy to mess with prod env. :D

4:35 Guest37944: I have somethng like '[[something x]] and would like to resolve x within the quoted vector (x is defined as "abc" somewhere else)

4:36 `[[something ~x]]

4:36 is this what I'm looking for?

4:36 H4ns: does it not do what you want? try it in the repl.

4:41 ordnungswidrig: I guess it's '[[something ~x]] note the apostrophe

4:42 AeroNotix: Guest37944: TIAS

4:57 Guest37944: ordnungswidrig: I think `~` is not a thing in regular 'quote forms is it?

4:57 AeroNotix: TIAS?

4:58 ordnungswidrig: Guest37944: oh sure. that wil not work. if you want to resolve "x" somewhere else, you might do a treewalk and replace clojure.core/unquote x with whatever x is at tht place

4:59 AeroNotix: Guest37944: try it and see

4:59 ordnungswidrig: or is "x" available at the time the expression is defined?

4:59 AeroNotix: ,(let [x 10] `(inc ~x))

4:59 Guest37944: `[[something~(resolve x)]]

4:59 clojurebot: (clojure.core/inc 10)

4:59 Guest37944: ended up with this

4:59 AeroNotix: Guest37944: what's the problem you're trying to actually solve here?

5:00 ordnungswidrig: Oh sure, now the ` makes sense vs. '

5:01 mbac: how do people present clojure code with sweet syntax highlighting on arbitrary blog posts?

5:01 are they simply having emacs export the buffer to html?

5:02 AeroNotix: the works, sometimes.

5:02 that*

5:02 but I just use https://github.com/redline6561/coleslaw

5:02 drbobbeaty: mbac: Wordpress has plugins that do all manner of languages nicely.

5:03 mbac: hmm

5:03 drbobbeaty: GeSHi - is a PHP system that does the highlighting - have a look.

5:07 ordnungswidrig: mbac: I'm using a jekyll plugin that will download and link gists

5:20 bosky: how do i map over every line in the macro. eg (macro-count-prints (println “a”) (println “b”))

5:21 AeroNotix: bosky: you get the & body

5:21 which is a list

5:21 and then you just walk that tree

5:24 ,(defmacro count-printlns [& body]

5:24 (let [c (count (keep #(= % 'println) body))]

5:24 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

5:24 AeroNotix: `~c))

5:25 even something as primitive as this

5:25 could work

5:25 or no

5:25 bosky: AeroNotix: this is what i tried http://pastebin.com/cPmAgR1w

5:27 Kristien: Why does Clojars exist? As opposed to using Maven Central.

5:28 kaplan: Kristien, clojars is easier to use

5:28 Kristien: In what way?

5:28 Deployment?

5:28 H4ns: bosky: @args is not the same as ~@args

5:29 bosky: @ is deref, ~@ is splice

5:30 schaueho: mbac, I use a geshi plugin for my s9y blog that I derived from the Common Lisp geshi plugin.

5:38 AeroNotix: Kristien: deployment/search are much simpler.

5:38 also, it's focused on clojure.

5:38 Kristien: I see.

5:38 AeroNotix: instead of having a huge surface and baggage

5:40 mbac: Macros are really fun tools that allow you to code with fewer inhibitions. Using macros, you have a degree of freedom and expressivity that other languages simply don't allow.

5:40 __fewer inhibitions__

5:41 finally i can give up my sniffing glue habit

5:41 AeroNotix: bosky: dang I'm sure I saw a replace tool for macros

5:41 mbac: and sub in clojure

5:41 Kristien: sub in clojure? make clojure like Perl!

5:42 mbac: D:

5:42 Kristien: (defmacro sub [& args] `(defn ~@args))

5:44 AeroNotix: bosky: http://blog.fogus.me/2013/07/17/an-introduction-to-deep-code-walking-macros-with-clojure/

5:44 here is a good walkthrough

5:45 Kristien: I tend to like this: (defmacro proc [params body] `(fn ~params (do ~@body nil))) and similar for defproc

5:45 slipset: bosky: timbaldridge has two great videos on the subject as well.

5:46 https://www.youtube.com/watch?v=HXfDK1OYpco

5:47 https://www.youtube.com/watch?v=R3PZMIwXN_g

6:11 bosky: @AeroNotix & slipset . Thanks

6:11 clojurebot: Gabh mo leithscéal?

6:18 brkpnt_: hi, what is the meaning of ".foo" in (.foo arg)?

6:18 the dot in the start is my problem

6:18 TEttinger: brkpnt_, it accesses a java method called foo on the object arg

6:18 mbac: i think it means call the foo method in arg

6:19 arg.foo() in java

6:19 TEttinger: ,(.length "whee")

6:19 clojurebot: 4

6:19 kaplan: brkpnt_, http://clojure.org/java_interop#dot

6:19 TEttinger: ~punctuation

6:19 clojurebot: punctuation means kind of fun

6:19 TEttinger: hm

6:20 $google weird wonderful characters of clojure

6:20 lazybot: [The Weird and Wonderful Characters of Clojure - yobriefca.se] http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/

6:20 TEttinger: that guide covers pretty much all the unusual and hard to google characters you would find in clojure

6:20 brkpnt_: ohoo thanks

6:21 (:

6:21 TEttinger: # is interesting because it is only half of the macro, like #{} is a set and #() is an anonymous function

6:22 you'll probably see #() a lot, it's extremely convenient

6:22 * kaplan bookmarks the page

6:31 brkpnt_: another question. Working with non-static methods of a class, how can i have a list of candidates in emacs with cider? Beacuse cider only completes static methods like class/method but nothing like class.method.

6:32 shiranaihito: brkpnt_: not the answer you asked for, but you might want to check this out anyway: https://www.youtube.com/watch?v=vt1y2FbWQMg

7:50 dysfun: gosh, it's really nice being able to deploy just a jar and it having all the assets in for low-traffic sites

7:50 even if uploading a new jar is taking longer than i'd like

8:16 Kristien: TIL about seque. Why did nobody ever tell me! (╯°□°)╯︵ ┻━┻

8:21 wink: I hate how my font sucks for q and g

8:22 interesting, this seque :)

8:22 Kristien: seque, not segue!

8:27 hyPiRion: TIL Inconsolata has a pretty big difference between lowercase q and g

8:28 Kristien: merging seques is unfortunately not possible though

8:50 sg2002: Hey guys. What would be a proper way of writing something like this: (let [x 0]

8:50 (try (doseq [y [1]]

8:50 (set! x y)

8:50 (throw (Exception. "err:")))

8:50 (catch Exception e

8:50 (print e x))))

8:51 opqdonut: what?

8:51 sg2002: This would not interpret of course, but I need my exception and the object that caused it in doseq.

8:51 clojurebot: what is your favorite number

8:51 opqdonut: ah ok

8:52 sg2002: Just thinking of what would be an idiomatic solution.

8:53 opqdonut: well you can use (let [current (atom nil)] (try (doseq [y [1 2 3]] (reset! current y) (something)) (catch Exception e) (print e @current))))

8:53 hyPiRion: sg2002: Usually something using ex-info. Then the receiver uses ex-data

8:53 opqdonut: but ex-info is a better idea

8:53 justin_smith: sg2002: you are aware that set! on a let-bound value will always fail, right?

8:54 sg2002: Oh, cool, ex-info is totally something that I needed. Was just not aware how is it called.

8:54 justin_smith: yes, of course.

8:55 hyPiRion: ,(try (doseq [y [1]] (throw (ex-info "some-error" {:val y}))) (catch clojure.lang.ExceptionInfo ex (println (.getMessage ex) (-> ex ex-data :val))))

8:55 clojurebot: hyPiRion: Excuse me?

8:56 hyPiRion: Bots still doesn't like try/catch? :/

8:56 *don't

9:08 justin_smith: hyPiRion: it was some kind of exploit loophole

9:08 I'm forgetting how it worked...

9:09 hyPiRion: yeah, I'm not surprised

9:13 drbobbeaty: gfredericks: What's your favorite OAuth2 clojure library? I've tried several to get to Google, and none seem to really be working. I'm looking for a little "Gary pointer"... :)

9:15 hyPiRion: &gary

9:15 TEttinger: justin_smith may have a justin pointer

9:15 *justin

9:16 drbobbeaty: Hey... I'm open to any help, I've just tried several, and many seem based on clj-oauth2, but all seem to have not been touched in quite a while.

9:17 justin_smith: drbobbeaty: why would they need to be updated?

9:17 has Oauth2 changed significantly?

9:17 In my experience clj-oauth2 worked

9:18 drbobbeaty: justin_smith: Well... if they work, you're right - they don't need to have changed. But when I try one - see that it's missing a parameter from the Google-side of things, and then see it's not been touched in a year or two - then I suspect that Google changed something, and it's not "happily working" today.

9:18 justin_smith: oh, OK

9:18 drbobbeaty: justin_smith: Which one off clojars?

9:18 justin_smith: one moment, it was a while ago

9:19 drbobbeaty: justin_smith: thanks so much for looking...

9:20 gfredericks: drbobbeaty: I don't think I've ever used oauth at all, sorry

9:20 drbobbeaty: gfredericks: thanks, Gary.

9:21 justin_smith: drbobbeaty: it was the main clj-oauth2, from DerGuteMoritz

9:21 drbobbeaty: https://clojars.org/clj-oauth2

9:21 drbobbeaty: justin_smith: OK... his is at 0.2.0, so I'll try that.

9:22 justin_smith: that's the original version too

9:22 "only the client side is implemented and of that only the "Authorization Code" grant type" for what that's worth

9:22 drbobbeaty: justin_smith: Yeah, everyone seems to base theirs off his. I'll give it a go, and then assume that it's *me* if it's not working properly.

9:23 justin_smith: drbobbeaty: it may be the case that I was using it for one of the scenarios where it just worked (twitter / facebook) and that it needs fixing to work with google?

9:26 drbobbeaty: justin_smith: Yeah, that's what I'm thinking... which is why I think I need to take your advice that it works, and then assume that getting it to work with Google is "on me". I just didn't want to start with something that wasn't working.

9:26 fellipebrito: What type of projects are you guys working (in clojure) now? Desktop apps? Mobile? WebApps? Server Side robots? I see the clojure community growing fast, but I don't know that much people working with Clojure on "real life". How do you guys see it?

9:27 justin_smith: fellipebrito: I think a lot of it is "big data" and server side web stuff

9:27 I do server side web

9:27 by "big data" I mean machine learning with data sets that don't fit in ram

9:27 nicferrier: good definition.

9:28 glad I caught that.

9:28 justin_smith: I clarified because the term gets misused a lot

9:28 nicferrier: yy.

9:28 fellipebrito: Big Data is used for everything that has a varchar 255 in small companies :P

9:28 gfredericks: small data: https://twitter.com/gfredericks_/status/561191705052205058

9:29 justin_smith: I have a job offer I may just accept to do some intense graph algos with a huge dataset - it looks fun but outside my experience also...

9:29 drbobbeaty: fellipebrito: Do a lot of Storm - pseudo-real-time processing and analytics... web apps... data processing - Big Data (doesn't fit in RAM)

9:29 fellipebrito: Thank you drbobbeaty and justin_smith

9:31 justin_smith: a significant chunk of people are doing single page apps with clojurescript on the frontend

9:31 because cljs tends to scale better than raw js in terms of codebase

9:32 fellipebrito: I did a lot of server side things with Ruby lately. And some huge API's that connect to heavy database and return either json or html to the final client so I'm poking around to see where Clojure fits in this process. Of course the whole Lisp philosophy is helping me, but I'm still a bit lost about the application on real life.

9:33 justin_smith: fellipebrito: well, server side clojure can gain you (as compared to ruby) longer lived processes, and more work done in a smaller number of processes.

9:33 nicferrier: fellipebrito: clojure is great on the client and server side for doing CSP style architectures... go routines etc.

9:35 fellipebrito: justin_smith Dude, you have no idea. 2014 Last six months we were ***ed up with multi threading on the server side. I had to produce millions of videos from a media base, the code was beautiful, but ruby took me a lot of time in order to get fast and use cores and cpus... as far as I see, clojure would've saved me few weeks

9:36 TEttinger: clojure uses a lot of RAM, which thankfully servers have tons of compared to desktop machines

9:36 justin_smith: I wouldn't be surprised if it saved you more than just weeks in a six month span

9:37 TEttinger: but we're doing a comparison V. ruby here :)

9:37 TEttinger: that tradeoff would have been deeply in favor towards clojure I think

9:37 justin_smith: and yes, clojure is a ram hog - but not in an explosive must kill the process way

9:37 TEttinger: yeah

9:37 I have a 800 MB REPL running

9:38 looks like 385 but has a lot reserved

9:38 fellipebrito: Sure thing, and my target is not to think the Ruby way and compare it.

9:38 * the-kenny upgrade to 16GB ram because of Clojure

9:38 fellipebrito: There are good things in every single language. My main target is to figure out how you guys are "living" the day-to-day and using clojure to save your life.

9:38 justin_smith: the-kenny: I jumped straight to 32gb (but 16 would have sufficed)

9:38 TEttinger: I don't use clojure much, but when I do it's very handy

9:39 justin_smith: but hey, this way I can run firefox, chrome, and opera too

9:39 the-kenny: My laptop doesn't 32 :(

9:39 And the x240 only supports 8, that's the worst.

9:39 justin_smith: the-kenny: I had to search for a while to find one that did

9:39 TEttinger: I primarily use it for complex data handling stuff, small datasets, like a spreadsheet

9:39 justin_smith: TEttinger: graph stuff?

9:39 TEttinger: just getting stuff into the format I want it

9:39 in lots of different small applications

9:40 the latest thing I wrote clojure for is just something that reads a large spreadsheet (TSV) in as big map of maps

9:42 https://dl.dropboxusercontent.com/u/11914692/DungeonVanguards.clj tiny, but it would be much larger if I was using, say, Java or C#

9:43 it's actually using read-string after formatting the TSV as a vector

9:43 or map?

9:43 can't remember

9:56 H4ns: when constructing a map, what is an idiomatic way to not include some keys based on conditions? i would like to avoid having nil values in the map returned.

9:58 justin_smith: H4ns: how tight of a bottleneck in it perf wise? if not at all you can do - (into {} (for [[k v] m :when (some? v)] [k v]))

9:58 and that will remove nil keys from a map

9:59 ,(into {} (for [[k v] {:a nil :b false :c 1} :when (some? v)] [k v]))

9:59 clojurebot: {:c 1, :b false}

9:59 H4ns: not critical at all. it is a common problem though. common enough that my coworker had it at the exact moment when i asked across the table what he'd suggest :)

9:59 justin_smith: I suggest the above. It probably exists with some sensible name in some utility lib I don't use.

9:59 but it's a one liner, so whatever

10:01 equivalent ##(into {} (filter (comp some? second) {:a nil :b false :c 1}))

10:01 lazybot: ⇒ {:c 1, :b false}

10:01 justin_smith: or val instead of second etc.

10:01 gfredericks: H4ns: there's an assoc-when in util libs, would that do what you want?

10:02 justin_smith: ,(into {} (remove (comp nil? val) {:a nil :b false :c 1}))

10:02 clojurebot: {:c 1, :b false}

10:02 justin_smith: my final answer :)

10:02 H4ns: ok, thanks, folks

10:02 gfredericks: H4ns: https://github.com/Prismatic/plumbing/blob/467faef254306771b60cce2b675188c40e42294a/src/plumbing/core.cljx#L141-148

10:14 pjstadig: 0.7.0 of https://github.com/pjstadig/humane-test-output has been released

10:14 fixes some issues with comparing records to each other and to plain hash maps

10:32 drbobbeaty: justin_smith: I got [clj-oauth2 "0.2.0"] working to get me an access-token with Google. Looking good so far. Thanks! :)

11:20 justin_smith: drbobbeaty: cool, I did remember it working, good to know it works with google too

11:20 drbobbeaty: I'll post up a gist when I get it cleaned up... so you can have a reference to how it works as well. Just giving back... :)

11:20 justin_smith: oh, thanks

11:33 darrenh: I have a function that takes 1 argument that I want to call 'n' times with it's output passed to it's input. What's the easiest way to do that?

11:33 TimMc: iterate

11:33 drbobbeaty: darrenh: Look up 'iterate'

11:33 darrenh: thanks

11:34 TimMc: &(nth (iterate inc 0) 5)

11:34 lazybot: ⇒ 5

11:36 justin_smith: &(nth (iterate * 1) 1000000)

11:36 lazybot: ⇒ 1

11:36 justin_smith: that was actually kind of fast

11:39 TimMc: &(nth (iterate * 1) 1000000000)

11:39 lazybot: Execution Timed Out!

11:39 TimMc: &(nth (iterate * 1) 100000000)

11:39 lazybot: Execution Timed Out!

11:39 TimMc: &(nth (iterate * 1) 10000000)

11:39 lazybot: ⇒ 1

11:40 justin_smith: binary search will find it faster :)

11:40 haha

11:41 TimMc: Are you familiar with binary search on an unbounded search interval? ("Interval" is the wrong word...)

11:42 justin_smith: unbounded?

11:42 we had a count that worked, and a count that timed out

11:42 mbac: mumble mumble reservoir sampling?

11:42 TimMc: justin_smith: Not at first, we just had one that worked.

11:42 justin_smith: ahh

11:43 yeah, I was just talking about the third try

11:43 (my instinct would have been (highest working + lowest non-working) / 2)

11:44 TimMc: Yours had 6 zeroes, my first try had 9. The next could have been either 7 or 8, depending on how you round.

11:44 justin_smith: ahh, going by orders of magnitude rather than quantity

11:44 OK

11:45 TimMc: According to unbounded binary search, I should have doubled your guess for my first try (or doubled the magnitude, maybe.)

11:45 justin_smith: my naive view just saw "oh, he's going to drop a zero on each try"

11:45 cool

11:46 devll: is anyone having problem with Cider in Emacs?

11:46 C-c C-c works. C-c C-p throws error

11:46 TimMc: I guess multiplying by 2 would have been more in the spirit of binary search.

11:46 ~cider

11:46 clojurebot: cider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now.

11:46 TimMc: ^ I don't know if that's true, I just wanted to see what the bot would say.

11:47 justin_smith: ~cider

11:47 clojurebot: cider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now.

11:47 justin_smith: interesting, I thought there were other factoids

11:47 TimMc: ~batsov

11:47 clojurebot: Excuse me?

11:48 justin_smith: (from private message) -- 08:47 <clojurebot> cider is rage-inducing

11:48 ~cider

11:48 clojurebot: cider is rage-inducing

11:48 Glenjamin: cider?

11:48 clojurebot: cider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now.

11:49 arrdem: devll: I'm sure #clojure-emacs would take a bug report. Can you provide any more information than "it doesn't work"?

11:49 devll: (sh "ls" "-aul")

11:50 this prints "ls" results in echo after C-c C-c.

11:50 but C-c C-p throws an error cannot recognize "sh"

11:50 OK

11:51 I will post in #clojure-emacs

11:52 arrdem: #clojure-emacs may be able to help, but if this is a CIDER issue throw up a ticket on GH bbatsov is amazingly responsive for most things.

11:53 devll: yeah. I am just checking. I thought maybe I am not the only one.

12:10 bozhidar: ~cider

12:10 clojurebot: cider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now.

12:11 TimMc: I think the bot will just keep saying those two things.

12:11 bozhidar: fucking hilarious!

12:11 Glenjamin: clojurebot: cider is Try #clojure-emacs for more help with Cider

12:11 clojurebot: Ik begrijp

12:11 Glenjamin: does that append or replace?

12:12 arrdem: Glenjamin: append AFAIK

12:12 Glenjamin: probably fine

12:12 arrdem: clojurebot is a probabilistic mapping from inputs to bad jokes

12:12 ,1

12:12 clojurebot: eval service is offline

12:12 justin_smith: ,1

12:12 clojurebot: 1

12:13 justin_smith: he ignored som pms from me, just checking I was still legit

12:17 TimMc: Rate-limiting.

12:30 justin_smith: of course :)

12:45 win 4

12:45 oops!

15:25 patrkris: hello everyone. I have a strange problem, but it may be that I just don't understand protocols. In a namespace x.y, I define a protocol with a single method get-connection. I then proceed to use extend-protocol to define get-connection for Object, so that I have a default implementation. when I require the namespace this happens in, and call (get-connection "test"), I am told that there is no implementat

15:25 ion for String. here is the code: https://www.refheap.com/97729

15:25 (i.e. I require x.y from user namespace, and call get-connection, which fails)

15:28 tbaldrid_: patrkris: try restarting your repl, it works fine for me

15:28 Eremox: Do anyone got any tips when learning clojure? Or lisps in general?

15:28 tbaldrid_: Eremox: good place to start: http://www.braveclojure.com/

15:28 justin_smith: Eremox: as with any other language, do small exercises, then small apps, then larger ones

15:28 and find a good book of course

15:29 Eremox: one thing that helps with fp in general is that if functions don't have side effects, you can develop very efficiently in the repl just based on your expected arguments and return value

15:30 the interactivity of the repl can really speed up learning

15:30 Eremox: I have read joy of clojure and can written snippets, but my main problem is that I don't have any ideas for smaller projects.

15:30 Sorry for spelling

15:30 justin_smith: oh, so you need an idea

15:30 patrkris: tbaldrid_: just tried restarting the REPL and it didn't help. I can easily make it work in a clean project, so it must be something broken with the project itself. I just can't figure it out :(

15:30 tbaldrid_: can it have something to do with AOT? just a wild guess

15:31 justin_smith: patrkris: just a sanity check -- you are requiring the namespace, and then calling the protocol function namespace qualified?

15:31 tbaldrid_: are you using AOT?

15:31 justin_smith: also, protocols + AOT makes me think "lein clean"

15:33 kaplan: What is preferred in the Clojure world, add_user, addUser or add-user?

15:33 tbaldrid_: add-user

15:33 "kabob-case"

15:33 justin_smith: the second is for classes or protocols or records/types, the third for normal vars

15:33 patrkris: tbaldrid_: I have a a (:gen-class) in one namespace that contains a -main function

15:33 justin_smith: that is doSomething makes sense for method names

15:33 patrkris: justin_smith: will give lein clean a try

15:34 lein clean and restarting REPL didn't help :(

15:35 tbaldrid_: perhaps post more of your source, There's nothing wrong with the code you posted.

15:35 patrkris: justin_smith: and btw, yes, I am calling the protocol function using the full namespace

15:35 tbaldrid_: are those bits in different namespaces?

15:36 patrkris: tbaldrid_: the code I linked to is in a single namespace

15:36 I'm about ready to give you all the code to have a look :D but that is too much to ask

15:39 tbaldrid_: would you be willing to clone a repository and have a look? I'll just have to send you the URL privately

16:00 vas: Hi, I'm trying to go through some Datomic examples but I'm not sure how to teach the lein repl where my source files are / set the namespace...

16:07 sdegutis: Is there a story behind Hiccup's name?

16:09 vas: Html In Clojure = HIC ?

16:10 bja_: is there a way to eval in a particular context/namespace?

16:12 rhg135: surround in `(do (in-ns 'xxx) code)

16:12 then eval that i'd try

16:14 drbobbeaty: justin_smith: Here's the gist that has the project.clj, the server.clj for callbacks, and the dcm.clj where the guts of the Google work is happening. It's keyed to a specific version of the clj-oauth2-ls because I needed to add a function that's in other versions, but not that one: https://gist.github.com/drbobbeaty/44f60ab64a270ebf71ae

16:15 justin_smith: awesome!

16:15 I'll likely fork it just for reference

16:15 drbobbeaty: justin_smith: Certainly. I just wanted to make it feature-complete and decently documented so that it's easy to see where the hacks are.

16:15 justin_smith: rhg135: "do or don't do there is no try" doesn't really apply to clojure huh

16:16 rhg135: hmm well kinda, justin_smith

16:16 catch makes it applicable

16:23 justin_smith: vas: datomic has docs for setting up your project.clj to find the deps

16:24 vas: I think it involves using lein install or maybe mvn install from the datomic download dir

16:26 ajmagnif_: anyone: what's the preferred way to set off a new thread to call a function that is called purely for side effects (no return value needed)?

16:27 the context:

16:27 justin_smith: ajmagnif_: future works just fine for that, if you want to use the thread pool

16:27 ajmagnif_: I don't want blocking behavior, is the thing.

16:27 justin_smith: future doesn't have to block

16:27 you don't need to access the return value at all

16:27 ajmagnif_: no, return value not needed

16:28 justin_smith: right, so you just run future

16:28 and ignore the return value

16:28 and it executes

16:28 that easy

16:28 ajmagnif_: Oh, it execute immediately?

16:28 justin_smith: yes

16:28 ajmagnif_: For some reason I was thinking it didn't execute until deref

16:28 justin_smith: it's not lazy or anything

16:28 ajmagnif_: but now, that sounds stupid

16:28 justin_smith: it would be of limited utility :)

16:28 ajmagnif_: lol, for sure

16:28 OK, thanks justin_smith

16:29 justin_smith: you can also use Thread directly if you don't want to use the pool

16:29 ajmagnif_: no, the thread pool should be fine for this

16:29 thanks

16:29 justin_smith: ajmagnif_: but thread does not set up thread bindings the way future does (in particular *out*) will be noticed

16:29 cool

17:03 gfredericks: hyPiRion: hey does your swearjure nested-fns trick work in clojure 1.5?

17:08 (Thread. (bound-fn [] ...))

17:17 sobel: doc swearjure?

17:19 gfredericks: $google swearjure

17:19 lazybot: [polymatheia - Swearjure - hyPiRion] http://hypirion.com/musings/swearjure

17:20 gfredericks: $google swearjure infoq

17:20 lazybot: [Swearjure - InfoQ] http://www.infoq.com/presentations/swearjure

17:20 hyPiRion: gfredericks: is that pre your unroll changes?

17:20 or was that TimMc's patch

17:20 gfredericks: hyPiRion: right

17:20 hyPiRion: gfredericks: I have no idea

17:20 I'd guess no

17:21 gfredericks: I'm wanting to be able to say that I made swearjure-empowering changes to clojure.core

17:22 sobel: heh

17:23 hyPiRion: gfredericks: Amazing how you did so unintentionally

17:23 clojurebot: Excuse me?

17:23 hyPiRion: please continue doing that

17:24 gfredericks: I wonder if there will be lightning talks at clojure/west

17:27 hyPiRion: gfredericks: hey, when is clojure/west this year?

17:28 and yeah, it doesn't seem to work

17:28 AeroNotix: it's always good to put faces to the names accompanying text I read near-daily.

17:33 gfredericks: hyPiRion april something

17:33 hyPiRion: ah

17:33 justin_smith: gfredericks: hyPiRion: 4/20 dude

17:34 (but seriously, that's the start date)

17:34 TimMc: hyPiRion: In Clojure 1.6.0, (clojure.walk/macroexpand-all '(->> (->> a #() (-> [b])) #() (-> [a]))) yields (fn* [a] [] () (fn* [b] [] () a)). In 1.5.0 it yields (fn* [] () ([a] (fn* [] () (a [b])))).

17:34 xemdetia: AeroNotix, jokes on you they will all wear masks :(

17:42 gfredericks: hoo ray

17:42 justin_smith: I should put together a "ultimate hipsters tour" or something

17:43 gfredericks: paul whathisface did something to that effect two years ago

17:44 I mean it was a writeup of some sort, not a physical tour

17:50 sdegutis: Is Midge still the dominating testing library?

17:52 hyPiRion: sdegutis: Midje and clojure.test for unit tests, test.check for property based testing

17:52 sdegutis: ok

17:55 amalloy: when has midje ever been dominant?

17:55 gfredericks: hard to measure

17:55 TimMc: It can be dominant without being popular.

17:56 * TimMc is just trying to incite argument

17:58 sdegutis: Midje is hugely popular right?

17:58 tons of mindshare etc

18:01 justin_smith: I don't think it's used as extensively as clojure.test

18:02 sdegutis: but more mindshare outside #clojure, right?

18:02 malyn: justin_smith: gfredericks Aforementioned Portland guide: https://github.com/ohpauleez/pdx_guide

18:02 justin_smith: sdegutis: more projects use clojure.test than midge, I think

18:05 TimMc: justin_smith: Yes, but what if you weight those numbers by the *quality* of those projects, hmm?

18:06 gfredericks: clojure uses clojure.test

18:06 justin_smith: TimMc: of course, and how about the "mind" per project, if we are doing proper mindshare measurement

18:06 gfredericks: minds to projects is a many2many relationship

18:06 quick make a join table

18:06 justin_smith: each project has 0 or more minds

18:07 sounds about right

18:07 gfredericks: it's probably a weighted bipartite graph

18:07 quick use neo4j

18:10 bja_: is (some-> &env 'foo .init .eval) a supported method of getting a value for 'foo from the lexical scope?

18:10 gfredericks: nope

18:11 bja_: is there a supported way of doing that?

18:11 gfredericks: bja_: perhaps back up a bit and describe what you're trying to do?

18:13 amalloy: bja_: only supported way of doing that involves a blood sacrifice and a pentagram

18:14 bja_: https://gist.github.com/emidln/1b9a7a2f33d44e8d95f5

18:15 amalloy: so I should probably just settle for it happening to work where I'm using it right now?

18:15 TimMc: yikes

18:15 amalloy: no! just make this thing a function

18:16 bja_: well, no. if I make it a function it will eval its arguments

18:16 which means I'll have to write (tmux 'send-message '-some '-args "foo")

18:16 which is ugly

18:16 amalloy: wait, so why are you calling .eval if you don't want to eval?

18:17 bja_: oh, I do want to eval, but I only actually want certain things to be eval'd, in particular, things that already in the scope

18:17 amalloy: okay. you want to eval only if it's in scope? that is pretty gross but not totally repugnant

18:17 so don't call .init or .eval, just check that it exists in &env at all

18:17 hiredman: or use syntax quote

18:17 TimMc: bja_: (tmux `(send-message foo ~bar "baz"))

18:18 hiredman: or one of the various syntax quote like templating things

18:18 TimMc: That's the least horrible way I can see hacking tha together.

18:18 bja_: I mean, I can do it with just a function and keywords pretty easily, but it looks ugly

18:18 adding syntax quote to my call sites isn't really much better

18:18 gfredericks: ,(defmacro list+ [& forms] (->> forms (map (fn [x] (if (and (symbol? x) (not (contains? &env x))) (str x) x))) (cons `list)))

18:19 Frozenlock: Is there a lein plugin to add a splash screen while clojure is loading?

18:19 clojurebot: #'sandbox/list+

18:19 gfredericks: ,(let [x 12] (list+ x y z))

18:19 clojurebot: (12 "y" "z")

18:19 hiredman: if you think keywords are ugly you are going to have a bad time

18:19 bja_: I think keywords are ugly for interactive usage.

18:20 gfredericks: ~if you think keywords are ugly you |are| going to have a bad time

18:20 clojurebot: 'Sea, mhuise.

18:22 gfredericks: ,(defmacro list+ [& forms] (->> forms (map (fn [x] (if (and (symbol? x) (not (contains? &env x)) (not (resolve x))) (str x) x))) (cons `list)))

18:22 clojurebot: #'sandbox/list+

18:22 gfredericks: ,(list+ + ++ +++)

18:22 clojurebot: (#<core$_PLUS_ clojure.core$_PLUS_@3db64033> "++" "+++")

18:23 hyPiRion: well this is interesting

18:23 gfredericks: what is interesting hyPiRion

18:24 hyPiRion: the macros. I've not actually seen them be used like this

18:25 gfredericks: bja_: you could use the list+ macro above to do most of what you need

18:27 I mean you still have to write your own macro because macros are infectious like that but it wouldn't do much

18:27 (defmacro tmux [& args] (tmux-fn (list+ ~@args)))

18:28 bja_: yeah, I understand

18:29 was just trying to improve my real experience by being able to define user functions that show/hide tmux panes

18:29 primitive IDE or something like that

18:46 CaptainLex: Is there a corrollary to apply that I can use with maps?

18:47 gfredericks: mapply is in util libs

18:47 e.g. prismatic/plumbing

18:48 justin_smith: something like (fn [f & m] (apply f (apply concat (butlast m) (last m))))

18:48 CaptainLex: gfredericks: Thanks!

18:49 justin_smith: ,((fn [f & m] (apply f (apply concat (butlast m) (last m)))) list :a :b {:c 0 :d 1})

18:49 clojurebot: (:a :b :c 0 :d ...)

18:49 TimMc: ~mapply

18:49 clojurebot: You have to do something like (defn mapply [f & args] (apply f (apply concat (butlast args) (last args)))), which just goes to show why unrolled keyword args are a bad idea

18:49 TimMc: ^ I like the opinionated version.

18:49 justin_smith: wow, that's exactly what I cam up with

18:50 what are the chances, huh

18:50 CaptainLex: TimMc: Unrolled?

18:50 justin_smith: CaptainLex: unrolled as in not just taking a map as an argument

18:51 CaptainLex: justin_smith: That's what I thought! Indeed, were I writing the library, I wouldn've done it that way ;)

18:51 But alas I am using it

18:51 justin_smith: fair enough

18:51 TimMc: CaptainLex: Clojure makes it easy to destructure restargs as a map with [foo bar & {:keys [a b c]}], but it's really annoying for callers.

18:51 CaptainLex: TimMc: Yeah, inspecting the source, that's just what they've done

18:52 TimMc: There's a TODO comment to make it work more like we'd like, but hey

18:52 TimMc: That's FOSS

18:52 bja_: @gfredericks, thanks. also at least for my purposes, name is slightly better than str when no match is found, since that will give me the unqualified name as a string

18:54 gfredericks: bja_: why would a user supply a namespaced keyword if they didn't care about the namespace half?

18:55 bja_: they didn't though, it just gets namespace qualified by syntax-quote

18:55 gfredericks: that shouldn't happen in the code I showed above

18:56 ,(list+ x/y z)

18:56 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: list+ in this context, compiling:(NO_SOURCE_PATH:0:0)>

18:56 gfredericks: ,(defmacro list+ [& forms] (->> forms (map (fn [x] (if (and (symbol? x) (not (contains? &env x)) (not (resolve x))) (str x) x))) (cons `list)))

18:56 clojurebot: #'sandbox/list+

18:56 gfredericks: ,(list+ x/y z)

18:56 clojurebot: ("x/y" "z")

18:56 gfredericks: ^ z turned into "z"

18:57 justin_smith: gfredericks: but if that is called inside a quasiquote?

18:57 which would be namespacing symbols

18:57 gfredericks: oh gee whiz

18:57 CaptainLex: Anyway, thanks everyone!

21:13 sritchie: anyone seen this in the repl? No reader function for tag +clj, compiling:(taoensso/sente:606:89)

21:13 ; CIDER 0.8.2 (Java 1.8.0_11, Clojure 1.7.0-alpha2, nREPL 0.2.7)

21:13 this is when trying to compile a file that includes the latest version of sente… the only odd thing I can find is that sente includes its cljx files in the jar

21:13 justin_smith: looks like this is an nginx issue...

21:16 nope, not nginx

21:16 hit the app directly on production and still seeing the issue

21:16 it's serving up from my local server, but failing from tomcat

21:16 in both cases I am using wrap-resources

21:16 moquist: Is it possible to access arbitrary env vars in project.clj? For example: :some-plugin-key :env/some_value_from_environment

21:16 justin_smith: I've verified that the file in question is present in the uberwar

21:16 moquist: I see support for :password :env/arbitrary_var, but nothing else obvious (yet).

21:19 justin_smith: moquist: ~(System/getenv "key")

21:19 that should work with any env key present

21:19 moquist: justin_smith: RIGHT. Of course. thanks

21:19 justin_smith: see also ~(System/getProperty "whatever.key")

21:19 for java properties

21:19 moquist: I had tried that without splicing...

21:19 justin_smith: that's not splicing

21:19 it's unquoting

21:20 the whole project.clj is syntax-quoted

21:20 or effectively so at least

21:20 moquist: justin_smith: RIGHT. Of course. ;)

21:21 justin_smith: That's very helpful.

21:28 celwell: Hi, how can I insert values into my inline js with Enlive? I'm manipulating the HTML fine but I want to be able to insert my config's base-url into a jQuery AJAX call. (I'm not referring to dynamic changes after page load).

21:29 justin_smith: celwell: I would assume you're using deftemplate?

21:29 celwell: yes

21:29 justin_smith: oh, but the issue is you need to template into an embedded js string

21:29 never mind, that's tricky

21:29 celwell: do I need to look into a different lib?

21:30 justin_smith: I'm not sure

21:30 celwell: coming from php this would be easy i thought

21:30 justin_smith: it would be easy with eg. selmer

21:30 because it's string-interpolation based, rather than structural transform based

21:30 celwell: i could dump it into a hidden span but that would pretty ugly

21:31 justin_smith: but there is probably a way to do it with a structural transform, I just don't know that part of enlive well enough to tell you exactly how

21:38 gfredericks: anybody know any compelling examples of using validators on *anything*, and any examples of using watches on vars aside from potemkin/import-vars?

21:38 validators meaning set-validator! in particular

21:40 justin_smith: gfredericks: I have daydreamed about using set-validator! to attach a specific prismatic/schema requirement on a var

21:40 gfredericks: but in practice a real need to do that hasn't come up yet, it's just a spare idea I have ready in case...

21:40 gfredericks: like what are you trying to guard against when you do that?

21:41 justin_smith: bad var updates. More likely to be seen with an atom or ref than a var in real code, but hypothetically possible.

21:41 or even more likely, an agent

21:42 gfredericks: justin_smith: can you think of a use case for updating a var as part of a normal program's operation?

21:42 rather than startup or devstuffs

21:42 justin_smith: hrm

21:44 oops

22:07 ajmagnif_: Hey, so I modified pmap to allow me to specify the maximum number of threads that I wanted to be running simultaneously.

22:07 I called it pmap-n

22:07 I'm calling (pmap-n #(%) vector-of-funs 2)

22:08 justin_smith: ajmagnif_: pmap already limits the number of threads

22:08 ajmagnif_: The reason for this is because I have a vector of fns that make calls to a database.

22:08 Well, I want to limit it even more

22:08 justin_smith: OK

22:08 ~pmap

22:08 clojurebot: pmap is not what you want

22:09 ajmagnif_: So I want max of 2 threads simultaneously querying the database

22:09 But,

22:09 I have multiple databases

22:09 So, I want to call (pmap-n #(%) vector-of-fns 2) for each vector-of-fns, where each vector pertains to a separate database.

22:09 Here's what I have:

22:10 (defmacro execute-all [cluster-tasks max-simultaneous]

22:10 `(mapv future-call

22:10 (mapv (fn [x#] (util.core/pmap-n #(%)

22:10 (get ~cluster-tasks x#)

22:10 ~max-simultaneous))

22:10 (keys ~cluster-tasks))))

22:10 justin_smith: ajmagnif_: don't do that

22:11 ajmagnif_: yeah

22:11 justin_smith: use a pastebin

22:11 refheap or gist or something

22:11 ajmagnif_: k, good idea, one moment

22:13 https://gist.github.com/TheAnalystAaron/9bed30b404bb5bee254e

22:13 OK, justin_smith, sorry about that

22:14 justin_smith: ajmagnif_: why is this a macro?

22:14 ajmagnif_: So again, here's the setup: dozens of databases that I want to query in parallel, each database can have up to 2 simultaneous queries.

22:14 i-blis: ajmagnif_: why a macro?

22:14 ajmagnif_: I don't know. I've been at it since 4AM, so everything I do at this point should be taken with a grain (or cup) of salt

22:14 :D

22:14 justin_smith: haha, yeah, this would make much more sense as a function

22:14 ajmagnif_: OK, let me paste the exception I'm getting:

22:14 justin_smith: unless I severely misunderstand something

22:16 ajmagnif_: ClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn clojure.core/binding-conveyor-fn/fn--4145 (core.clj:1910)

22:16 the cluster-tasks that is mentioned is a map

22:17 each key in the map is an ID for one of the databases,

22:17 and the value is a vector of fns that take no arguments

22:17 So the fns actually run

22:17 just fine

22:17 I'm pulling in all the data, and it appears that it's running in parallel as it should.

22:17 justin_smith: and you map future-call over the result of mapv

22:18 ajmagnif_: But when I try to deref what comes out of this mess, I get that exception

22:19 justin_smith: I think the whole thing will make more sense when you turn it into a function

22:19 then build it up from the inside out

22:19 ajmagnif_: OK.

22:19 Let me try it again and I'll let you know what happens

22:20 by the way, justin_smith, I notice that sometimes people (inc justin_smith), or others. Is that the socially acceptable way of saying thank you here?

22:20 Because I think I owe you about 50 of these now

22:20 justin_smith: haha

22:20 it's our way of handing out fake internet points

22:20 (identity justin_smith)

22:20 lazybot: justin_smith has karma 193.

22:20 ajmagnif_: (inc justin_smith)

22:20 lazybot: ⇒ 194

22:21 ajmagnif_: well there's 194!

22:21 I'm going to go rewrite this again and we'll see what happens

22:21 thanks

22:43 amalloy: wow when did justin_smith get to 194? i remember when he was but a wee lad

22:56 justin_smith: indeed

22:57 this wrap-resource thing is driving me nuts

22:57 locally, I can serve up foo/bar/baz. via wrap-resource

22:57 in tomcat, it is 404

22:57 the file is in there

22:57 the pattern is that files that have a name ending in . have the problem

22:58 I wish I could just tell the client "don't name files that way"

22:59 ToxicFrog: I have a sequence of [k v k v k v ...]

23:00 I want to update a map with these.

23:00 justin_smith: maybe you want to (apply hash-map ...) to it?

23:00 or apply assoc

23:00 ToxicFrog: (conj existing-map (apply hash-map kv-seq))?

23:00 justin_smith: ,(apply assoc {:a 0} [:b 1 :c 2 :d 3])

23:00 ToxicFrog: Oh wait, assoc takes multiple kv pairs, doesn't it

23:00 clojurebot: {:d 3, :c 2, :b 1, :a 0}

23:00 ToxicFrog: That makes my life super easy

23:00 Thanks

23:00 TEttinger: (inc justin_smith)

23:00 lazybot: ⇒ 195

23:01 TEttinger: I wonder if I can get to 200 tabletop RPG classes before justin_smith gets to 200 karma

23:01 (not likely)

23:01 justin_smith: haha

23:02 TEttinger: little known secret, when you pass 100 #clojure karma you automatically get a tower and 2d4+1 followers

23:02 TEttinger: I've passed 100 classes!

23:02 justin_smith: it's expensive, but it's kind of coll having a tower and men at arms, and they earn their keep pillaging the nearby countryside

23:03 *cool

23:03 TEttinger: raiding #ruby for, well, rubies

23:03 justin_smith: right, right

Logging service provided by n01se.net