#clojure logs

2015-02-24

00:02dnolenhiredman: thanks that was it, old version was package private, in new release isn't
00:11rntzis there any way to use leiningen *without* having a src/ directory?
00:23seancorfieldrntz: you could configure :source-paths to be just ["."] if you wanted your source files relative to the current directory. Is that what you mean?
00:25rntzseancorfield: yes, I think so
00:28rntz... 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"
00:34caternrntz: make sure cider.el is up to date, cider-nrepl is up to date, and also restart emacs
00:35rntzcatern: how do I make sure cider-nrepl is up to date?
00:35rntz(I know how to do the other two)
00:35caternrntz: run lein deps
00:36caternrntz: you have a ~/.lein/profiles.clj that pulls it in, yes?
00:36rntzcatern: no? I don't even know what ~/.lein/profiles.clj is.
00:37caternhttps://github.com/clojure-emacs/cider-nrepl
00:37catern"A minimal profiles.clj for CIDER would be:"
00:37rntzI should probably read up on wth profiles.clj is first
00:38caterni wouldn't recommend it
00:38rntzokay, is there a good way to quit cider when something has gone wrong? (",cider-quit" produces the error message "Wrong type argument: commandp, nil")
00:40caternC-x k?
00:40rntzhm, I encountered some strange errors after trying that brute-force approach last time
00:40rntzmaybe it was something else going wrong, though
00:44rntzwhere 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.
00:47ewemoarntz: somewhere under ~/.m2 perhaps?
00:48rntzewemoa: aha, thanks
00:49ewemoaglad it worked out :)
00:49rntzhm. 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?
00:50ewemoahe he, never figured that one out :)
00:50rntzand ,cider-quit *still* doesn't work even now that I have cider-jack-in working
00:51rntzaha, it wants "0.9.0-SNAPSHOT", not "0.9.0-snapshot"
00:51caternrntz: because you're probably using cider.el from MELPA or something else that bilds straight from git, yes?
00:51caternrntz: right :)
00:51caternrntz: er, I mean, you want to put 0.9.0-SNAPSHOT in your profiles.clj, if you're using the latest CIDER
00:51ewemoaahhh...the 'snapshot' should be in all-caps thing -- got bitten by that one recently :)
00:52rntzcatern: thanks, I figured it out. now I have only *one* warning when jacking in...
00:52rntz"WARNING: CIDER requires nREPL 0.2.7 to work properly", which seems, uh, misplaced
00:53rntzbut ,cider-quit still doesn't work
00:53caternhuh
00:53caternlook at this
00:53caternhttp://stackoverflow.com/questions/28688721/how-to-upgrade-nrepl-version-of-leiningen
00:53caternsomeone across space and time
00:53caternis doing exactly the same thing as you right now
00:56rntzoh, I see, cider-nrepl isn't the same thing as tools.nrepl
01:02rntzokay, nrepl all upgraded, no error messages. ,cider-quit still fails, though.
01:03rntzoh, I see, it's called "hasta la vista" for some silly reason and the error message is bad.
01:22crocketDoes ClojureScript provide significant long-term advantages over javascript on the web?
01:35justin_smithcrocket: it has namespaces and immutable datatypes, both of which are a bonus if you want software to be reliable
01:38justin_smithbut of course it compiles to javascript, but these things are easy to use with the clojurescript semantics
01:48Eremox1When is the expected release date for 1.7.0?
01:51raspasovEremox1: if I have to bet, around Clojure/west?
02:22H4nsdoes anyone know the cider failure more where it tells you "Connected." in the status line, but no cider repl buffer appears?
02:27H4nsah. nuking both ~/.m2/repository/ and ~/.emacs.d/ has helped. quite a large hammer, though.
03:46hyPiRionHas anyone taken a look at using transducers on trees? Could imagine it being useful for nanopasses over an AST.
03:47AeroNotixH4ns: which version of CIDER are you using?
03:50H4nsAeroNotix: 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.
03:50AeroNotixah right yeah, snapshots'll do it.
03:51H4nsAeroNotix: 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.
04:05devllHi,How to specify ssh port while connecting to remote REPL?
04:08H4nsdevll: i've never used it myself, but maybe you want to look at ssh port forwarding (-L flag)
04:08devllyes
04:08H4nsdevll: (i mean, i've never used remote cider repls so far)
04:08devllI am able to do that with port forwarding.
04:09devllssh -L 4343:localhost:4343 user@server
04:09devllthen connect local port
04:09devllthis works
04:09H4ns... but?
04:10devllI thought maybe some option to spicify.
04:10devllfor cider.
04:14devllthanks anyway H4ns
04:17AeroNotixH4ns: indeed, running snapshots of cider is really never a good idea.
04:17AeroNotixdevll: I use ssh tunnels daily to get a REPL on a remote instance.
04:17AeroNotixdevll: obligatory "messing with production" warning
04:23samiswellcoolI've been having trouble getting vim-fireplace to connect to a REPL on a vagrant instance recently, that's not going well for me
04:33devllAeroNotix: that's beauty of Clojure. So easy to mess with prod env. :D
04:35Guest37944I have somethng like '[[something x]] and would like to resolve x within the quoted vector (x is defined as "abc" somewhere else)
04:36Guest37944`[[something ~x]]
04:36Guest37944is this what I'm looking for?
04:36H4nsdoes it not do what you want? try it in the repl.
04:41ordnungswidrigI guess it's '[[something ~x]] note the apostrophe
04:42AeroNotixGuest37944: TIAS
04:57Guest37944ordnungswidrig: I think `~` is not a thing in regular 'quote forms is it?
04:57Guest37944AeroNotix: TIAS?
04:58ordnungswidrigGuest37944: 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
04:59AeroNotixGuest37944: try it and see
04:59ordnungswidrigor is "x" available at the time the expression is defined?
04:59AeroNotix,(let [x 10] `(inc ~x))
04:59Guest37944`[[something~(resolve x)]]
04:59clojurebot(clojure.core/inc 10)
04:59Guest37944ended up with this
04:59AeroNotixGuest37944: what's the problem you're trying to actually solve here?
05:00ordnungswidrigOh sure, now the ` makes sense vs. '
05:01mbachow do people present clojure code with sweet syntax highlighting on arbitrary blog posts?
05:01mbacare they simply having emacs export the buffer to html?
05:02AeroNotixthe works, sometimes.
05:02AeroNotixthat*
05:02AeroNotixbut I just use https://github.com/redline6561/coleslaw
05:02drbobbeatymbac: Wordpress has plugins that do all manner of languages nicely.
05:03mbachmm
05:03drbobbeatyGeSHi - is a PHP system that does the highlighting - have a look.
05:07ordnungswidrigmbac: I'm using a jekyll plugin that will download and link gists
05:20boskyhow do i map over every line in the macro. eg (macro-count-prints (println “a”) (println “b”))
05:21AeroNotixbosky: you get the & body
05:21AeroNotixwhich is a list
05:21AeroNotixand then you just walk that tree
05:24AeroNotix,(defmacro count-printlns [& body]
05:24AeroNotix (let [c (count (keep #(= % 'println) body))]
05:24clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
05:24AeroNotix `~c))
05:25AeroNotixeven something as primitive as this
05:25AeroNotixcould work
05:25AeroNotixor no
05:25boskyAeroNotix: this is what i tried http://pastebin.com/cPmAgR1w
05:27KristienWhy does Clojars exist? As opposed to using Maven Central.
05:28kaplanKristien, clojars is easier to use
05:28KristienIn what way?
05:28KristienDeployment?
05:28H4nsbosky: @args is not the same as ~@args
05:29H4nsbosky: @ is deref, ~@ is splice
05:30schauehombac, I use a geshi plugin for my s9y blog that I derived from the Common Lisp geshi plugin.
05:38AeroNotixKristien: deployment/search are much simpler.
05:38AeroNotixalso, it's focused on clojure.
05:38KristienI see.
05:38AeroNotixinstead of having a huge surface and baggage
05:40mbacMacros 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.
05:40mbac__fewer inhibitions__
05:41mbacfinally i can give up my sniffing glue habit
05:41AeroNotixbosky: dang I'm sure I saw a replace tool for macros
05:41mbacand sub in clojure
05:41Kristiensub in clojure? make clojure like Perl!
05:42mbacD:
05:42Kristien(defmacro sub [& args] `(defn ~@args))
05:44AeroNotixbosky: http://blog.fogus.me/2013/07/17/an-introduction-to-deep-code-walking-macros-with-clojure/
05:44AeroNotixhere is a good walkthrough
05:45KristienI tend to like this: (defmacro proc [params body] `(fn ~params (do ~@body nil))) and similar for defproc
05:45slipsetbosky: timbaldridge has two great videos on the subject as well.
05:46slipsethttps://www.youtube.com/watch?v=HXfDK1OYpco
05:47slipsethttps://www.youtube.com/watch?v=R3PZMIwXN_g
06:11bosky@AeroNotix & slipset . Thanks
06:11clojurebotGabh mo leithscéal?
06:18brkpnt_hi, what is the meaning of ".foo" in (.foo arg)?
06:18brkpnt_the dot in the start is my problem
06:18TEttingerbrkpnt_, it accesses a java method called foo on the object arg
06:18mbaci think it means call the foo method in arg
06:19mbacarg.foo() in java
06:19TEttinger,(.length "whee")
06:19clojurebot4
06:19kaplanbrkpnt_, http://clojure.org/java_interop#dot
06:19TEttinger~punctuation
06:19clojurebotpunctuation means kind of fun
06:19TEttingerhm
06:20TEttinger$google weird wonderful characters of clojure
06:20lazybot[The Weird and Wonderful Characters of Clojure - yobriefca.se] http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
06:20TEttingerthat guide covers pretty much all the unusual and hard to google characters you would find in clojure
06:20brkpnt_ohoo thanks
06:21brkpnt_(:
06:21TEttinger# is interesting because it is only half of the macro, like #{} is a set and #() is an anonymous function
06:22TEttingeryou'll probably see #() a lot, it's extremely convenient
06:31brkpnt_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.
06:32shiranaihitobrkpnt_: not the answer you asked for, but you might want to check this out anyway: https://www.youtube.com/watch?v=vt1y2FbWQMg
07:50dysfungosh, it's really nice being able to deploy just a jar and it having all the assets in for low-traffic sites
07:50dysfuneven if uploading a new jar is taking longer than i'd like
08:16KristienTIL about seque. Why did nobody ever tell me! (╯°□°)╯︵ ┻━┻
08:21winkI hate how my font sucks for q and g
08:22winkinteresting, this seque :)
08:22Kristienseque, not segue!
08:27hyPiRionTIL Inconsolata has a pretty big difference between lowercase q and g
08:28Kristienmerging seques is unfortunately not possible though
08:50sg2002Hey guys. What would be a proper way of writing something like this: (let [x 0]
08:50sg2002 (try (doseq [y [1]]
08:50sg2002 (set! x y)
08:50sg2002 (throw (Exception. "err:")))
08:50sg2002 (catch Exception e
08:50sg2002 (print e x))))
08:51opqdonutwhat?
08:51sg2002This would not interpret of course, but I need my exception and the object that caused it in doseq.
08:51clojurebotwhat is your favorite number
08:51opqdonutah ok
08:52sg2002Just thinking of what would be an idiomatic solution.
08:53opqdonutwell you can use (let [current (atom nil)] (try (doseq [y [1 2 3]] (reset! current y) (something)) (catch Exception e) (print e @current))))
08:53hyPiRionsg2002: Usually something using ex-info. Then the receiver uses ex-data
08:53opqdonutbut ex-info is a better idea
08:53justin_smithsg2002: you are aware that set! on a let-bound value will always fail, right?
08:54sg2002Oh, cool, ex-info is totally something that I needed. Was just not aware how is it called.
08:54sg2002justin_smith: yes, of course.
08:55hyPiRion,(try (doseq [y [1]] (throw (ex-info "some-error" {:val y}))) (catch clojure.lang.ExceptionInfo ex (println (.getMessage ex) (-> ex ex-data :val))))
08:55clojurebothyPiRion: Excuse me?
08:56hyPiRionBots still doesn't like try/catch? :/
08:56hyPiRion*don't
09:08justin_smithhyPiRion: it was some kind of exploit loophole
09:08justin_smithI'm forgetting how it worked...
09:09hyPiRionyeah, I'm not surprised
09:13drbobbeatygfredericks: 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"... :)
09:15hyPiRion &gary
09:15TEttingerjustin_smith may have a justin pointer
09:15TEttinger*justin
09:16drbobbeatyHey... 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.
09:17justin_smithdrbobbeaty: why would they need to be updated?
09:17justin_smithhas Oauth2 changed significantly?
09:17justin_smithIn my experience clj-oauth2 worked
09:18drbobbeatyjustin_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.
09:18justin_smithoh, OK
09:18drbobbeatyjustin_smith: Which one off clojars?
09:18justin_smithone moment, it was a while ago
09:19drbobbeatyjustin_smith: thanks so much for looking...
09:20gfredericksdrbobbeaty: I don't think I've ever used oauth at all, sorry
09:20drbobbeatygfredericks: thanks, Gary.
09:21justin_smithdrbobbeaty: it was the main clj-oauth2, from DerGuteMoritz
09:21justin_smithdrbobbeaty: https://clojars.org/clj-oauth2
09:21drbobbeatyjustin_smith: OK... his is at 0.2.0, so I'll try that.
09:22justin_smiththat's the original version too
09:22justin_smith"only the client side is implemented and of that only the "Authorization Code" grant type" for what that's worth
09:22drbobbeatyjustin_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.
09:23justin_smithdrbobbeaty: 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?
09:26drbobbeatyjustin_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.
09:26fellipebritoWhat 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?
09:27justin_smithfellipebrito: I think a lot of it is "big data" and server side web stuff
09:27justin_smithI do server side web
09:27justin_smithby "big data" I mean machine learning with data sets that don't fit in ram
09:27nicferriergood definition.
09:28nicferrierglad I caught that.
09:28justin_smithI clarified because the term gets misused a lot
09:28nicferrieryy.
09:28fellipebritoBig Data is used for everything that has a varchar 255 in small companies :P
09:28gfrederickssmall data: https://twitter.com/gfredericks_/status/561191705052205058
09:29justin_smithI 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...
09:29drbobbeatyfellipebrito: Do a lot of Storm - pseudo-real-time processing and analytics... web apps... data processing - Big Data (doesn't fit in RAM)
09:29fellipebritoThank you drbobbeaty and justin_smith
09:31justin_smitha significant chunk of people are doing single page apps with clojurescript on the frontend
09:31justin_smithbecause cljs tends to scale better than raw js in terms of codebase
09:32fellipebritoI 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.
09:33justin_smithfellipebrito: well, server side clojure can gain you (as compared to ruby) longer lived processes, and more work done in a smaller number of processes.
09:33nicferrierfellipebrito: clojure is great on the client and server side for doing CSP style architectures... go routines etc.
09:35fellipebritojustin_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
09:36TEttingerclojure uses a lot of RAM, which thankfully servers have tons of compared to desktop machines
09:36justin_smithI wouldn't be surprised if it saved you more than just weeks in a six month span
09:37justin_smithTEttinger: but we're doing a comparison V. ruby here :)
09:37TEttingerthat tradeoff would have been deeply in favor towards clojure I think
09:37justin_smithand yes, clojure is a ram hog - but not in an explosive must kill the process way
09:37TEttingeryeah
09:37TEttingerI have a 800 MB REPL running
09:38TEttingerlooks like 385 but has a lot reserved
09:38fellipebritoSure thing, and my target is not to think the Ruby way and compare it.
09:38fellipebritoThere 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.
09:38justin_smiththe-kenny: I jumped straight to 32gb (but 16 would have sufficed)
09:38TEttingerI don't use clojure much, but when I do it's very handy
09:39justin_smithbut hey, this way I can run firefox, chrome, and opera too
09:39the-kennyMy laptop doesn't 32 :(
09:39the-kennyAnd the x240 only supports 8, that's the worst.
09:39justin_smiththe-kenny: I had to search for a while to find one that did
09:39TEttingerI primarily use it for complex data handling stuff, small datasets, like a spreadsheet
09:39justin_smithTEttinger: graph stuff?
09:39TEttingerjust getting stuff into the format I want it
09:39TEttingerin lots of different small applications
09:40TEttingerthe latest thing I wrote clojure for is just something that reads a large spreadsheet (TSV) in as big map of maps
09:42TEttingerhttps://dl.dropboxusercontent.com/u/11914692/DungeonVanguards.clj tiny, but it would be much larger if I was using, say, Java or C#
09:43TEttingerit's actually using read-string after formatting the TSV as a vector
09:43TEttingeror map?
09:43TEttingercan't remember
09:56H4nswhen 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.
09:58justin_smithH4ns: 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]))
09:58justin_smithand that will remove nil keys from a map
09:59justin_smith,(into {} (for [[k v] {:a nil :b false :c 1} :when (some? v)] [k v]))
09:59clojurebot{:c 1, :b false}
09:59H4nsnot 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 :)
09:59justin_smithI suggest the above. It probably exists with some sensible name in some utility lib I don't use.
09:59justin_smithbut it's a one liner, so whatever
10:01justin_smithequivalent ##(into {} (filter (comp some? second) {:a nil :b false :c 1}))
10:01lazybot⇒ {:c 1, :b false}
10:01justin_smithor val instead of second etc.
10:01gfredericksH4ns: there's an assoc-when in util libs, would that do what you want?
10:02justin_smith,(into {} (remove (comp nil? val) {:a nil :b false :c 1}))
10:02clojurebot{:c 1, :b false}
10:02justin_smithmy final answer :)
10:02H4nsok, thanks, folks
10:02gfredericksH4ns: https://github.com/Prismatic/plumbing/blob/467faef254306771b60cce2b675188c40e42294a/src/plumbing/core.cljx#L141-148
10:14pjstadig0.7.0 of https://github.com/pjstadig/humane-test-output has been released
10:14pjstadigfixes some issues with comparing records to each other and to plain hash maps
10:32drbobbeatyjustin_smith: I got [clj-oauth2 "0.2.0"] working to get me an access-token with Google. Looking good so far. Thanks! :)
11:20justin_smithdrbobbeaty: cool, I did remember it working, good to know it works with google too
11:20drbobbeatyI'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:20justin_smithoh, thanks
11:33darrenhI 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:33TimMciterate
11:33drbobbeatydarrenh: Look up 'iterate'
11:33darrenhthanks
11:34TimMc&(nth (iterate inc 0) 5)
11:34lazybot⇒ 5
11:36justin_smith&(nth (iterate * 1) 1000000)
11:36lazybot⇒ 1
11:36justin_smiththat was actually kind of fast
11:39TimMc&(nth (iterate * 1) 1000000000)
11:39lazybotExecution Timed Out!
11:39TimMc&(nth (iterate * 1) 100000000)
11:39lazybotExecution Timed Out!
11:39TimMc&(nth (iterate * 1) 10000000)
11:39lazybot⇒ 1
11:40justin_smithbinary search will find it faster :)
11:40justin_smithhaha
11:41TimMcAre you familiar with binary search on an unbounded search interval? ("Interval" is the wrong word...)
11:42justin_smithunbounded?
11:42justin_smithwe had a count that worked, and a count that timed out
11:42mbacmumble mumble reservoir sampling?
11:42TimMcjustin_smith: Not at first, we just had one that worked.
11:42justin_smithahh
11:43justin_smithyeah, I was just talking about the third try
11:43justin_smith(my instinct would have been (highest working + lowest non-working) / 2)
11:44TimMcYours had 6 zeroes, my first try had 9. The next could have been either 7 or 8, depending on how you round.
11:44justin_smithahh, going by orders of magnitude rather than quantity
11:44justin_smithOK
11:45TimMcAccording to unbounded binary search, I should have doubled your guess for my first try (or doubled the magnitude, maybe.)
11:45justin_smithmy naive view just saw "oh, he's going to drop a zero on each try"
11:45justin_smithcool
11:46devllis anyone having problem with Cider in Emacs?
11:46devllC-c C-c works. C-c C-p throws error
11:46TimMcI guess multiplying by 2 would have been more in the spirit of binary search.
11:46TimMc~cider
11:46clojurebotcider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now.
11:46TimMc^ I don't know if that's true, I just wanted to see what the bot would say.
11:47justin_smith~cider
11:47clojurebotcider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now.
11:47justin_smithinteresting, I thought there were other factoids
11:47TimMc~batsov
11:47clojurebotExcuse me?
11:48justin_smith (from private message) -- 08:47 <clojurebot> cider is rage-inducing
11:48justin_smith~cider
11:48clojurebotcider is rage-inducing
11:48Glenjamincider?
11:48clojurebotcider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now.
11:49arrdemdevll: I'm sure #clojure-emacs would take a bug report. Can you provide any more information than "it doesn't work"?
11:49devll(sh "ls" "-aul")
11:50devllthis prints "ls" results in echo after C-c C-c.
11:50devllbut C-c C-p throws an error cannot recognize "sh"
11:50devllOK
11:51devllI will post in #clojure-emacs
11:52arrdem#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:53devllyeah. I am just checking. I thought maybe I am not the only one.
12:10bozhidar~cider
12:10clojurebotcider is Cider is unstable and broken right now, most things don't work. Use the last stable version of nrepl.el for now.
12:11TimMcI think the bot will just keep saying those two things.
12:11bozhidarfucking hilarious!
12:11Glenjaminclojurebot: cider is Try #clojure-emacs for more help with Cider
12:11clojurebotIk begrijp
12:11Glenjamindoes that append or replace?
12:12arrdemGlenjamin: append AFAIK
12:12Glenjaminprobably fine
12:12arrdemclojurebot is a probabilistic mapping from inputs to bad jokes
12:12arrdem,1
12:12clojureboteval service is offline
12:12justin_smith,1
12:12clojurebot1
12:13justin_smithhe ignored som pms from me, just checking I was still legit
12:17TimMcRate-limiting.
12:30justin_smithof course :)
12:45justin_smithwin 4
12:45justin_smithoops!
15:25patrkrishello 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:25patrkrision for String. here is the code: https://www.refheap.com/97729
15:25patrkris(i.e. I require x.y from user namespace, and call get-connection, which fails)
15:28tbaldrid_patrkris: try restarting your repl, it works fine for me
15:28EremoxDo anyone got any tips when learning clojure? Or lisps in general?
15:28tbaldrid_Eremox: good place to start: http://www.braveclojure.com/
15:28justin_smithEremox: as with any other language, do small exercises, then small apps, then larger ones
15:28justin_smithand find a good book of course
15:29justin_smithEremox: 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:30justin_smiththe interactivity of the repl can really speed up learning
15:30EremoxI 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:30EremoxSorry for spelling
15:30justin_smithoh, so you need an idea
15:30patrkristbaldrid_: 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:30patrkristbaldrid_: can it have something to do with AOT? just a wild guess
15:31justin_smithpatrkris: just a sanity check -- you are requiring the namespace, and then calling the protocol function namespace qualified?
15:31tbaldrid_are you using AOT?
15:31justin_smithalso, protocols + AOT makes me think "lein clean"
15:33kaplanWhat is preferred in the Clojure world, add_user, addUser or add-user?
15:33tbaldrid_add-user
15:33tbaldrid_"kabob-case"
15:33justin_smiththe second is for classes or protocols or records/types, the third for normal vars
15:33patrkristbaldrid_: I have a a (:gen-class) in one namespace that contains a -main function
15:33justin_smiththat is doSomething makes sense for method names
15:33patrkrisjustin_smith: will give lein clean a try
15:34patrkrislein clean and restarting REPL didn't help :(
15:35tbaldrid_perhaps post more of your source, There's nothing wrong with the code you posted.
15:35patrkrisjustin_smith: and btw, yes, I am calling the protocol function using the full namespace
15:35tbaldrid_are those bits in different namespaces?
15:36patrkristbaldrid_: the code I linked to is in a single namespace
15:36patrkrisI'm about ready to give you all the code to have a look :D but that is too much to ask
15:39patrkristbaldrid_: would you be willing to clone a repository and have a look? I'll just have to send you the URL privately
16:00vasHi, 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:07sdegutisIs there a story behind Hiccup's name?
16:09vasHtml In Clojure = HIC ?
16:10bja_is there a way to eval in a particular context/namespace?
16:12rhg135surround in `(do (in-ns 'xxx) code)
16:12rhg135then eval that i'd try
16:14drbobbeatyjustin_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:15justin_smithawesome!
16:15justin_smithI'll likely fork it just for reference
16:15drbobbeatyjustin_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:15justin_smithrhg135: "do or don't do there is no try" doesn't really apply to clojure huh
16:16rhg135hmm well kinda, justin_smith
16:16rhg135catch makes it applicable
16:23justin_smithvas: datomic has docs for setting up your project.clj to find the deps
16:24justin_smithvas: I think it involves using lein install or maybe mvn install from the datomic download dir
16:26ajmagnif_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:27ajmagnif_the context:
16:27justin_smithajmagnif_: future works just fine for that, if you want to use the thread pool
16:27ajmagnif_I don't want blocking behavior, is the thing.
16:27justin_smithfuture doesn't have to block
16:27justin_smithyou don't need to access the return value at all
16:27ajmagnif_no, return value not needed
16:28justin_smithright, so you just run future
16:28justin_smithand ignore the return value
16:28justin_smithand it executes
16:28justin_smiththat easy
16:28ajmagnif_Oh, it execute immediately?
16:28justin_smithyes
16:28ajmagnif_For some reason I was thinking it didn't execute until deref
16:28justin_smithit's not lazy or anything
16:28ajmagnif_but now, that sounds stupid
16:28justin_smithit would be of limited utility :)
16:28ajmagnif_lol, for sure
16:28ajmagnif_OK, thanks justin_smith
16:29justin_smithyou can also use Thread directly if you don't want to use the pool
16:29ajmagnif_no, the thread pool should be fine for this
16:29ajmagnif_thanks
16:29justin_smithajmagnif_: but thread does not set up thread bindings the way future does (in particular *out*) will be noticed
16:29justin_smithcool
17:03gfrederickshyPiRion: hey does your swearjure nested-fns trick work in clojure 1.5?
17:08gfredericks(Thread. (bound-fn [] ...))
17:17sobeldoc swearjure?
17:19gfredericks$google swearjure
17:19lazybot[polymatheia - Swearjure - hyPiRion] http://hypirion.com/musings/swearjure
17:20gfredericks$google swearjure infoq
17:20lazybot[Swearjure - InfoQ] http://www.infoq.com/presentations/swearjure
17:20hyPiRiongfredericks: is that pre your unroll changes?
17:20hyPiRionor was that TimMc's patch
17:20gfrederickshyPiRion: right
17:20hyPiRiongfredericks: I have no idea
17:20hyPiRionI'd guess no
17:21gfredericksI'm wanting to be able to say that I made swearjure-empowering changes to clojure.core
17:22sobelheh
17:23hyPiRiongfredericks: Amazing how you did so unintentionally
17:23clojurebotExcuse me?
17:23hyPiRionplease continue doing that
17:24gfredericksI wonder if there will be lightning talks at clojure/west
17:27hyPiRiongfredericks: hey, when is clojure/west this year?
17:28hyPiRionand yeah, it doesn't seem to work
17:28AeroNotixit's always good to put faces to the names accompanying text I read near-daily.
17:33gfrederickshyPiRion april something
17:33hyPiRionah
17:33justin_smithgfredericks: hyPiRion: 4/20 dude
17:34justin_smith(but seriously, that's the start date)
17:34TimMchyPiRion: 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:34xemdetiaAeroNotix, jokes on you they will all wear masks :(
17:42gfrederickshoo ray
17:42justin_smithI should put together a "ultimate hipsters tour" or something
17:43gfrederickspaul whathisface did something to that effect two years ago
17:44gfredericksI mean it was a writeup of some sort, not a physical tour
17:50sdegutisIs Midge still the dominating testing library?
17:52hyPiRionsdegutis: Midje and clojure.test for unit tests, test.check for property based testing
17:52sdegutisok
17:55amalloywhen has midje ever been dominant?
17:55gfrederickshard to measure
17:55TimMcIt can be dominant without being popular.
17:58sdegutisMidje is hugely popular right?
17:58sdegutistons of mindshare etc
18:01justin_smithI don't think it's used as extensively as clojure.test
18:02sdegutisbut more mindshare outside #clojure, right?
18:02malynjustin_smith: gfredericks Aforementioned Portland guide: https://github.com/ohpauleez/pdx_guide
18:02justin_smithsdegutis: more projects use clojure.test than midge, I think
18:05TimMcjustin_smith: Yes, but what if you weight those numbers by the *quality* of those projects, hmm?
18:06gfredericksclojure uses clojure.test
18:06justin_smithTimMc: of course, and how about the "mind" per project, if we are doing proper mindshare measurement
18:06gfredericksminds to projects is a many2many relationship
18:06gfredericksquick make a join table
18:06justin_smitheach project has 0 or more minds
18:07justin_smithsounds about right
18:07gfredericksit's probably a weighted bipartite graph
18:07gfredericksquick use neo4j
18:10bja_is (some-> &env 'foo .init .eval) a supported method of getting a value for 'foo from the lexical scope?
18:10gfredericksnope
18:11bja_is there a supported way of doing that?
18:11gfredericksbja_: perhaps back up a bit and describe what you're trying to do?
18:13amalloybja_: only supported way of doing that involves a blood sacrifice and a pentagram
18:14bja_https://gist.github.com/emidln/1b9a7a2f33d44e8d95f5
18:15bja_amalloy: so I should probably just settle for it happening to work where I'm using it right now?
18:15TimMcyikes
18:15amalloyno! just make this thing a function
18:16bja_well, no. if I make it a function it will eval its arguments
18:16bja_which means I'll have to write (tmux 'send-message '-some '-args "foo")
18:16bja_which is ugly
18:16amalloywait, so why are you calling .eval if you don't want to eval?
18:17bja_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:17amalloyokay. you want to eval only if it's in scope? that is pretty gross but not totally repugnant
18:17amalloyso don't call .init or .eval, just check that it exists in &env at all
18:17hiredmanor use syntax quote
18:17TimMcbja_: (tmux `(send-message foo ~bar "baz"))
18:18hiredmanor one of the various syntax quote like templating things
18:18TimMcThat's the least horrible way I can see hacking tha together.
18:18bja_I mean, I can do it with just a function and keywords pretty easily, but it looks ugly
18:18bja_adding syntax quote to my call sites isn't really much better
18:18gfredericks,(defmacro list+ [& forms] (->> forms (map (fn [x] (if (and (symbol? x) (not (contains? &env x))) (str x) x))) (cons `list)))
18:19FrozenlockIs there a lein plugin to add a splash screen while clojure is loading?
18:19clojurebot#'sandbox/list+
18:19gfredericks,(let [x 12] (list+ x y z))
18:19clojurebot(12 "y" "z")
18:19hiredmanif you think keywords are ugly you are going to have a bad time
18:19bja_I think keywords are ugly for interactive usage.
18:20gfredericks~if you think keywords are ugly you |are| going to have a bad time
18:20clojurebot'Sea, mhuise.
18:22gfredericks,(defmacro list+ [& forms] (->> forms (map (fn [x] (if (and (symbol? x) (not (contains? &env x)) (not (resolve x))) (str x) x))) (cons `list)))
18:22clojurebot#'sandbox/list+
18:22gfredericks,(list+ + ++ +++)
18:22clojurebot(#<core$_PLUS_ clojure.core$_PLUS_@3db64033> "++" "+++")
18:23hyPiRionwell this is interesting
18:23gfrederickswhat is interesting hyPiRion
18:24hyPiRionthe macros. I've not actually seen them be used like this
18:25gfredericksbja_: you could use the list+ macro above to do most of what you need
18:27gfredericksI mean you still have to write your own macro because macros are infectious like that but it wouldn't do much
18:27gfredericks(defmacro tmux [& args] (tmux-fn (list+ ~@args)))
18:28bja_yeah, I understand
18:29bja_was just trying to improve my real experience by being able to define user functions that show/hide tmux panes
18:29bja_primitive IDE or something like that
18:46CaptainLexIs there a corrollary to apply that I can use with maps?
18:47gfredericksmapply is in util libs
18:47gfrederickse.g. prismatic/plumbing
18:48justin_smithsomething like (fn [f & m] (apply f (apply concat (butlast m) (last m))))
18:48CaptainLexgfredericks: Thanks!
18:49justin_smith,((fn [f & m] (apply f (apply concat (butlast m) (last m)))) list :a :b {:c 0 :d 1})
18:49clojurebot(:a :b :c 0 :d ...)
18:49TimMc~mapply
18:49clojurebotYou 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:49TimMc^ I like the opinionated version.
18:49justin_smithwow, that's exactly what I cam up with
18:50justin_smithwhat are the chances, huh
18:50CaptainLexTimMc: Unrolled?
18:50justin_smithCaptainLex: unrolled as in not just taking a map as an argument
18:51CaptainLexjustin_smith: That's what I thought! Indeed, were I writing the library, I wouldn've done it that way ;)
18:51CaptainLexBut alas I am using it
18:51justin_smithfair enough
18:51TimMcCaptainLex: 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:51CaptainLexTimMc: Yeah, inspecting the source, that's just what they've done
18:52CaptainLexTimMc: There's a TODO comment to make it work more like we'd like, but hey
18:52CaptainLexTimMc: That's FOSS
18:52bja_@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:54gfredericksbja_: why would a user supply a namespaced keyword if they didn't care about the namespace half?
18:55bja_they didn't though, it just gets namespace qualified by syntax-quote
18:55gfredericksthat shouldn't happen in the code I showed above
18:56gfredericks,(list+ x/y z)
18:56clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: list+ in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:56gfredericks,(defmacro list+ [& forms] (->> forms (map (fn [x] (if (and (symbol? x) (not (contains? &env x)) (not (resolve x))) (str x) x))) (cons `list)))
18:56clojurebot#'sandbox/list+
18:56gfredericks,(list+ x/y z)
18:56clojurebot("x/y" "z")
18:56gfredericks^ z turned into "z"
18:57justin_smithgfredericks: but if that is called inside a quasiquote?
18:57justin_smithwhich would be namespacing symbols
18:57gfredericksoh gee whiz
18:57CaptainLexAnyway, thanks everyone!
21:13sritchieanyone seen this in the repl? No reader function for tag +clj, compiling:(taoensso/sente:606:89)
21:13sritchie; CIDER 0.8.2 (Java 1.8.0_11, Clojure 1.7.0-alpha2, nREPL 0.2.7)
21:13sritchiethis 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:13justin_smithlooks like this is an nginx issue...
21:16justin_smithnope, not nginx
21:16justin_smithhit the app directly on production and still seeing the issue
21:16justin_smithit's serving up from my local server, but failing from tomcat
21:16justin_smithin both cases I am using wrap-resources
21:16moquistIs it possible to access arbitrary env vars in project.clj? For example: :some-plugin-key :env/some_value_from_environment
21:16justin_smithI've verified that the file in question is present in the uberwar
21:16moquistI see support for :password :env/arbitrary_var, but nothing else obvious (yet).
21:19justin_smithmoquist: ~(System/getenv "key")
21:19justin_smiththat should work with any env key present
21:19moquistjustin_smith: RIGHT. Of course. thanks
21:19justin_smithsee also ~(System/getProperty "whatever.key")
21:19justin_smithfor java properties
21:19moquistI had tried that without splicing...
21:19justin_smiththat's not splicing
21:19justin_smithit's unquoting
21:20justin_smiththe whole project.clj is syntax-quoted
21:20justin_smithor effectively so at least
21:20moquistjustin_smith: RIGHT. Of course. ;)
21:21moquistjustin_smith: That's very helpful.
21:28celwellHi, 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:29justin_smithcelwell: I would assume you're using deftemplate?
21:29celwellyes
21:29justin_smithoh, but the issue is you need to template into an embedded js string
21:29justin_smithnever mind, that's tricky
21:29celwelldo I need to look into a different lib?
21:30justin_smithI'm not sure
21:30celwellcoming from php this would be easy i thought
21:30justin_smithit would be easy with eg. selmer
21:30justin_smithbecause it's string-interpolation based, rather than structural transform based
21:30celwelli could dump it into a hidden span but that would pretty ugly
21:31justin_smithbut 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:38gfredericksanybody know any compelling examples of using validators on *anything*, and any examples of using watches on vars aside from potemkin/import-vars?
21:38gfredericksvalidators meaning set-validator! in particular
21:40justin_smithgfredericks: I have daydreamed about using set-validator! to attach a specific prismatic/schema requirement on a var
21:40justin_smithgfredericks: 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:40gfrederickslike what are you trying to guard against when you do that?
21:41justin_smithbad var updates. More likely to be seen with an atom or ref than a var in real code, but hypothetically possible.
21:41justin_smithor even more likely, an agent
21:42gfredericksjustin_smith: can you think of a use case for updating a var as part of a normal program's operation?
21:42gfredericksrather than startup or devstuffs
21:42justin_smithhrm
21:44justin_smithoops
22:07ajmagnif_Hey, so I modified pmap to allow me to specify the maximum number of threads that I wanted to be running simultaneously.
22:07ajmagnif_I called it pmap-n
22:07ajmagnif_I'm calling (pmap-n #(%) vector-of-funs 2)
22:08justin_smithajmagnif_: pmap already limits the number of threads
22:08ajmagnif_The reason for this is because I have a vector of fns that make calls to a database.
22:08ajmagnif_Well, I want to limit it even more
22:08justin_smithOK
22:08justin_smith~pmap
22:08clojurebotpmap is not what you want
22:09ajmagnif_So I want max of 2 threads simultaneously querying the database
22:09ajmagnif_But,
22:09ajmagnif_I have multiple databases
22:09ajmagnif_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:09ajmagnif_Here's what I have:
22:10ajmagnif_(defmacro execute-all [cluster-tasks max-simultaneous]
22:10ajmagnif_ `(mapv future-call
22:10ajmagnif_ (mapv (fn [x#] (util.core/pmap-n #(%)
22:10ajmagnif_ (get ~cluster-tasks x#)
22:10ajmagnif_ ~max-simultaneous))
22:10ajmagnif_ (keys ~cluster-tasks))))
22:10justin_smithajmagnif_: don't do that
22:11ajmagnif_yeah
22:11justin_smithuse a pastebin
22:11justin_smithrefheap or gist or something
22:11ajmagnif_k, good idea, one moment
22:13ajmagnif_https://gist.github.com/TheAnalystAaron/9bed30b404bb5bee254e
22:13ajmagnif_OK, justin_smith, sorry about that
22:14justin_smithajmagnif_: why is this a macro?
22:14ajmagnif_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:14i-blisajmagnif_: why a macro?
22:14ajmagnif_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:14ajmagnif_:D
22:14justin_smithhaha, yeah, this would make much more sense as a function
22:14ajmagnif_OK, let me paste the exception I'm getting:
22:14justin_smithunless I severely misunderstand something
22:16ajmagnif_ClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn clojure.core/binding-conveyor-fn/fn--4145 (core.clj:1910)
22:16ajmagnif_the cluster-tasks that is mentioned is a map
22:17ajmagnif_each key in the map is an ID for one of the databases,
22:17ajmagnif_and the value is a vector of fns that take no arguments
22:17ajmagnif_So the fns actually run
22:17ajmagnif_just fine
22:17ajmagnif_I'm pulling in all the data, and it appears that it's running in parallel as it should.
22:17justin_smithand you map future-call over the result of mapv
22:18ajmagnif_But when I try to deref what comes out of this mess, I get that exception
22:19justin_smithI think the whole thing will make more sense when you turn it into a function
22:19justin_smiththen build it up from the inside out
22:19ajmagnif_OK.
22:19ajmagnif_Let me try it again and I'll let you know what happens
22:20ajmagnif_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:20ajmagnif_Because I think I owe you about 50 of these now
22:20justin_smithhaha
22:20justin_smithit's our way of handing out fake internet points
22:20justin_smith(identity justin_smith)
22:20lazybotjustin_smith has karma 193.
22:20ajmagnif_(inc justin_smith)
22:20lazybot⇒ 194
22:21ajmagnif_well there's 194!
22:21ajmagnif_I'm going to go rewrite this again and we'll see what happens
22:21ajmagnif_thanks
22:43amalloywow when did justin_smith get to 194? i remember when he was but a wee lad
22:56justin_smithindeed
22:57justin_smiththis wrap-resource thing is driving me nuts
22:57justin_smithlocally, I can serve up foo/bar/baz. via wrap-resource
22:57justin_smithin tomcat, it is 404
22:57justin_smiththe file is in there
22:57justin_smiththe pattern is that files that have a name ending in . have the problem
22:58justin_smithI wish I could just tell the client "don't name files that way"
22:59ToxicFrogI have a sequence of [k v k v k v ...]
23:00ToxicFrogI want to update a map with these.
23:00justin_smithmaybe you want to (apply hash-map ...) to it?
23:00justin_smithor apply assoc
23:00ToxicFrog(conj existing-map (apply hash-map kv-seq))?
23:00justin_smith,(apply assoc {:a 0} [:b 1 :c 2 :d 3])
23:00ToxicFrogOh wait, assoc takes multiple kv pairs, doesn't it
23:00clojurebot{:d 3, :c 2, :b 1, :a 0}
23:00ToxicFrogThat makes my life super easy
23:00ToxicFrogThanks
23:00TEttinger(inc justin_smith)
23:00lazybot⇒ 195
23:01TEttingerI wonder if I can get to 200 tabletop RPG classes before justin_smith gets to 200 karma
23:01TEttinger(not likely)
23:01justin_smithhaha
23:02justin_smithTEttinger: little known secret, when you pass 100 #clojure karma you automatically get a tower and 2d4+1 followers
23:02TEttingerI've passed 100 classes!
23:02justin_smithit'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:03justin_smith*cool
23:03TEttingerraiding #ruby for, well, rubies
23:03justin_smithright, right