#clojure logs

2012-08-06

00:12_zach_jak: http://www.marco.org/2012/07/25/siracusa-mountain-lion-review-review
00:13_zachOops. Wrong channel, sorry about that :/.
01:02brianpeirisWhy isn't (= (list '(1 2) '(3 4)) '('(1 2) '(3 4))) ?
01:08emezeskebrianpeiris: Have you tried typing each of those into a REPL on it's own, to see what it evaluates to?
01:09brianpeirisHaven't tried that yet. (I'm using Light Table). Will try now.
01:13brianpeirisThanks emezeske. I see (quote (1 2) quote (3 4)) I think I understand better now.
01:14emezeskeGreat!
01:40smswzhi all, so I'm trying to install clojure, and the index for maven is failing
01:40smswzwoops wrong channel
02:30TEttinger2has anyone here ever used HtmlUnit for testing webpages?
02:30TEttinger2I am trying to call it from clojure
02:31TEttinger2http://htmlunit.sourceforge.net/ I am having trouble either with library management or the namespace
02:32TEttinger2in particular, http://htmlunit.sourceforge.net/gettingStarted.html doesn't seem to say what I need to import, and I am clueless as to how to get Clojure to see it
02:33TEttinger2"The class com.gargoylesoftware.htmlunit.WebClient is the main starting point." if I add a [com.gargoylesoftware.htmlunit] to my :import section in my namespace, it can't find htmlunit.clj
02:36TEttinger2it might have to do with my classpath -- I am using Leiningen
02:55firesofmayHi, anyone here ever used clj-webdriver (Selenium Library in clojure)? I am stuck with how to input text inside an iframe.
02:56TEttinger2firesofmay: I was just using that yesterday! I didn't get it to work.
02:56firesofmayTEttinger, I was trying this FAQ http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_How_do_I_type_into_a_contentEditable_iframe?
02:56firesofmayin clj-webdriver, it just does not work
02:57ro_stdoes it work in other webdrivers?
02:57firesofmayTEttinger, i can flash the iframe, but input doesn't work.
02:58firesofmayro_st, I didn't try any other library
02:58TEttinger2I can't really help you there, I barely got the thing to run (did I even do that? I can't remember)
02:59firesofmayTEttinger, :( I am stuck with this things for days now. I tried asking in the google group of clj-webdriver, no replies.
03:06TEttinger2I'm stuck on some basic clojure-java interop stuff I think
03:12noidi_firesofmay, you could use find-element to find the IFrame, get the underlying WebElement object and then try using WebDriver directly
03:13noidi_(class (:webelement (find-element {:css "h3"}))) ;= org.openqa.selenium.remote.RemoteWebElement
03:14noidi_so something like (-> (find-element ...) :web-element (.sendKeys "foobar"))
03:15noidi_oops, I only skimmed the WebDriver docs. you'd probably have to obtain the element via the driver instead of find-element.
03:15firesofmaynoidi_, what is ":web-element here"
03:16firesofmaynoidi_, ohkay
03:17firesofmaynoidi_, (flash (find-element {:tag :iframe})) with this i can see text-area flashing inside iframe
03:17firesofmaynoidi_, i am not sure how to enter text inside it
03:18noidi_clj-webdriver stores the driver in the var *driver*. it's a wrapper object, but you can access the "real" driver like this: (:webdriver *driver*)
03:21noidi_firesofmay, here's a quick (and untested) clj-webdriver translation of the example in the selenium FAQ: https://gist.github.com/23130a526bc8bdd400c7
03:21firesofmaynoidi_, Okay checking
03:25firesofmaynoidi_, my frame has no name. Check this https://gist.github.com/4227967f9e19623f31a6
03:26firesofmaynoidi_, what do I put instead of "foo"?
03:27noidi_firesofmay, you could use ".text-editor #iframe" as the selector
03:27noidi_I updated my gist with what I think are the clj-webdriver.taxi equivalents of the WebDriver functions called in the Java snippet: https://gist.github.com/23130a526bc8bdd400c7
03:30firesofmaynoidi_, (switch-to-frame ".text-editor #iframe") does not work
03:30firesofmayit can't find the frame
03:31noidi_drop the hash
03:31noidi_".text-editor iframe"
03:31firesofmaynoidi_, "Unable to locate frame: .text-editor iframe"
03:31firesofmayfor (switch-to-frame ".text-editor iframe")
03:32noidi_is that the only iframe on the page? you could try just plain "iframe"
03:34firesofmaynoidi_, nope still fails but this works ->
03:34babysnakeshi, I'm looking for a way to put strings outside my hiccup templates. One option is creating a large map and call keys from it but it doesn't seem to be very elegant. Any ideas (provided I don't need the overhead of i18n)?
03:34firesofmaynoidi_, https://gist.github.com/72adedd117dbf13f64bc
03:34firesofmaynoidi_, but using this i unable to select the iframe
03:35firesofmayi am*
03:37noidi_firesofmay, try (switch-to-frame 0)
03:37noidi_I looked at http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebDriver.TargetLocator.html, and apparently you can select frames by their index
03:39noidi_I gave it a try and it seemed to work
03:39firesofmaynoidi_, that worked :D
03:39noidi_yay \o/
03:39firesofmaynoidi_, wait let me try again from scratch just to make sure ;)
03:41TEttinger2noidi_, you probably have encountered some errors with clojure/java classpath stuff in the past right?
03:42noidi_TEttinger2, I think everyone has :)
03:42firesofmaynoidi_, dude you are awesome! :D
03:42noidi_firesofmay, glad to help :)
03:43firesofmaynoidi_, i'll post this script in the group so that others can use it to later :D
03:43TEttinger2http://pastebin.com/kjTjRyT0
03:43firesofmaynoidi_, man you saved me so many hours :D
03:44TEttinger2noidi_, do you maybe recognize the top error? I have looked and neither of those exist, but WebClient.class does
03:44noidi_firesofmay, yeah a fresh pair of eyes can do wonders when you're stuck and running in circles
03:44ifesdjeenfiresofmay: could you paste the script here, too? :)
03:44ifesdjeenprobably i joined after you guys pasted it first time
03:45noidi_TEttinger2, you are probably trying to use one of clojure's namespace-referencing functions when you want to import a java class
03:46TEttinger2ah, yes
03:46noidi_TEttinger2, if you have something like (ns foobar (require com.argoylesoftware.htmlunit.WebClient)) in your source, change the require/use/whatever to import
03:46firesofmaynoidi_, https://gist.github.com/3271980 :)
03:46TEttinger2uh actually it is in an ns :import [ com.gargoylesoftware.htmlunit.WebClient] block
03:47TEttinger2oh! no!
03:47TEttinger2it is in :use !
03:47djcoinfiresofmay: noidi_, which lib are you using for this ?
03:47firesofmaydjcoin, https://github.com/semperos/clj-webdriver/wiki/Introduction%3A-Taxi
03:48firesofmayclj-webdriver, Taxi API
03:48djcoinThanks !
03:49noidi_firesofmay, btw. I think the last line could be (click "button['type=submit']"). slightly cleaner, imo :)
03:49firesofmaynoidi_, checking
03:49noidi_oops, I meant "button[type='submit']"
03:51djcoinDo you use this for testing, js/html ?
03:52djcoinI wonder if there is some work with clojure-script or phantomjs
03:52firesofmaynoidi_, does not work. doesnt select the button for some reason
03:52ro_stdjcoin: cljsbuild has an advanced example which has phantomjs stuff preconfigured
03:53ro_stturn-key config to start writing code and tests in cljs and running them on phantom
03:53firesofmaydjcoin, its for browser testing. Its a wrapper around the Selenium-Webdriver framework
03:55firesofmaynoidi_, https://github.com/semperos/clj-webdriver/wiki/Snippets :)
03:58noidi_=)
04:25edge86Why is this returning true for all 3 elements? I would expect (true false false).
04:25edge86(map #(contains? % 1) [[1, 2], [2, 3], [3, 4]])
04:26ejackson,(doc contains?)
04:26clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
04:27ejacksonadmittedly tricky, contains? checks the keys, which for vectors are the indices
04:27edge86aww man, I had just looked at the docs, too.
04:27edge86Anyway, thanks!
04:40TEttinger2Raynes, do you remember how to get lazybot to auto-announce the titles of links?
05:33otfrommorning
05:36augustlI'm using [boolean "string with results"] a lot, where the boolean tells me whether the result is an error message or the actual result
05:36augustlare there any data abstractions I should use that makes this cleaner?
05:43staindo you mean exceptions?
05:44stainor you want to allow say a map to return some values and some errors?
05:44augustlit's not for exceptions
05:45augustlin this particular case, it's a function that compiles javascript with the Google Closure Compiler
05:45augustlif the compilation succeeds, I return the JS, if it fails, I return JS that will write the error message to the document.body in the browser.
05:46augustlso since both success and failure results in valid JS being returned, I need to return something more than just a string to let outsiders know whether or not the string you get back is from a successfull compilation
05:46stainin our workflow system (not clojure at all) we pass along data that can be either a list, a value, or an error (standing in place of either a value or list). Henc eyou can have a list of some values and some errors, or an error instead of the list, or an error instead of a single value. But everything downstream needs to be able to avoid those errors to not cause strange things like concatinations of an error and a regular string
05:47augustlI've done something similar before, where I return [a-boolean a-map]. The map is either data from a database, or validation errors, and the boolean tells the user which
05:47stainso you mean you could just ignore the error and execute that error-message code, it should still be "ok"
05:48stainit's some code as a placeholder for what the caller really wanted
05:48stainso it's a valid result.. just not the one he wanted
05:48augustlyeah
05:48stainif it was not replacable, I would have used a map instead, and have :result and :error in there. Then looking up :result would give nil when it's not there.
05:48augustlin both cases you get a string of JS
05:49stainbut fo ryou perhaps :code could work
05:49stainthe boolean is not very extensible
05:49augustlperhaps a map is better, it's a little less magic :)
05:49augustl{:js "..." :failed true}
05:49stainyeah, then you could put in extra bits about how it failed
05:49stain:lineno etc
05:49ro_stis there a way to get *sldb cloure/NNN* buffers to wrap their text in emacs?
06:05kralnamaste
06:37nkkarthikIn nrepl.el I keep getting this error? http://paste.debian.net/182339/
06:37nkkarthikas soon as I switch to the nrepl buffer
06:37nkkarthikany clue?
08:36ro_stclojars' database is down
08:36ohpauleezro_st: Did you get a chance to try the pubsub?
08:37ohpauleezBoth the simple and the event bus are working for me
08:37ro_sti did, but due to the version number not increasing on the dep, i couldn't load the new version into my project
08:37ro_stor did i misunderstand how that works :-)
08:38ohpauleez-SNAPSHOT should pull the latest
08:38ohpauleezbut it's also sitting in the demo app
08:38ro_stargh. how do i get https://github.com/clojure/math.numeric-tower/ into my project?
08:38ohpauleez(in /src/
08:38ro_sti tried [math.numeric-tower "0.0.2-SNAPSHOT"] in project.clj
08:39ro_stand [org.clojure/math.numeric-tower "0.0.2-SNAPSHOT"]
08:39ro_stok ohpauleez, i'll give it another try
08:39ohpauleeznvm, that was going to be my guess
08:39ro_sti'm just busy trying to round a bloody fraction in clojure and it turns out i need a library for that :p
08:40ohpauleezro_st: Are you specifically avoiding floating point?
08:41ro_stthe fractions are coming at me from (/ 1 2)
08:41ohpauleez&(quot 1 2)
08:41lazybot⇒ 0
08:41ohpauleez&(quot 1.0 2.0)
08:41lazybot⇒ 0.0
08:43ohpauleez&(Math/ceil (/ 1 2))
08:43lazybot⇒ 1.0
08:43ro_st&(Math/round 1/30)
08:43lazybotjava.lang.IllegalArgumentException: No matching method found: round
08:43ro_stthat's the issue i had. i casted my fraction to a double, now it works
08:48ohpauleezFor completeness for the logs
08:48ohpauleez&(Math/round (double (/ 1 2)))
08:48lazybot⇒ 1
09:01ro_stohpauleez: when do you use the evented bus and when do you use the simple bus? just curious how you're using each
09:02ohpauleezro_st: I always use the simple bus, but if you need truly non-blocking across all your endpoints, and you can sacrifice some speed, then the evented bus
09:02ohpauleezevented bus is slower, but non-blocking
09:03ohpauleezsimple bus is fast but synchronous
09:03ro_stcool. just curious where you're using the evented one
09:03ro_stwhat the use case there was
09:04ohpauleezro_st: Well, ClojureDev has been looking for solutions to Functional Reactive Programming - which needs to be async
09:04ohpauleezso I made an async bus
09:04ohpauleez:)
09:05ro_stinteresting
09:13noidi_re:rounding fractions via floating point. does that always round the number correctly though? isn't it possible that a fraction that rounds up has a closest floating point representation that rounds down?
09:14hyPiRionnoidi_: Indeed
09:20hyPiRionfor instance, ##(let [a 18014398509481980] (= (Math/round (double (/ (+ a a -1) 2))) a))
09:20lazybot⇒ true
09:21pandeirodoes (doto x (.form1 ...) (.form2 ...)) pass x or the return val of (.form1 ...) to (.form 2 ...) ?
09:21ohpauleezx
09:22ohpauleezif you want the return form, you can use the threading macro: ->
09:22ohpauleezreturn val*
09:22hyPiRion(doto x (.form1 ...) (.form2 ...)) = (let [foo x] (.form1 x ...) (.form2 x ...) x)
09:23pandeiroah sure, great
09:52FrozenlockUnrelated question: Given a unicode symbol, is there a way to find a font compatible with it? For example I can't see this one: ⚙
09:54edwDo you have OS X? The Character Viewer panel is very handy for that problem.
09:55FrozenlockNo... Currently Win7, Ubuntu when I'll get home
09:56ro_stwin7 has Character Map
09:59FrozenlockI need to check all of them until I see something?
10:02twhumeHow would I take a string and use it as a namespace? I want to call a function within an arbitrary namespace retrieved from a file or over the net...
10:05mdeboard##(doc symbol)
10:05lazybot⇒ "([name] [ns name]); Returns a Symbol with the given namespace and name."
10:05twhumeThanks!
10:09babycljHi guys, quick newbie question -- how do I parse a long string, split by newline?
10:10mdeboardYou mean split at new lines or what
10:10babyclj(string/split long-text #{\n} ) doesn't really work
10:10babycljyeah new line \n
10:10mdeboardclojure.string/split-lines
10:10mdeboard##(clojure.string/split-lines)
10:10lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: string$split-lines
10:10mdeboard##(doc clojure.string/split-lines)
10:10lazybot⇒ "([s]); Splits s on \\n or \\r\\n."
10:11babycljYes! thanks
10:11babyclj:-)
10:20cemerickFYI: Results of the 2012 State of Clojure survey now available — with a kitten! Seriously! http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
10:23arkhcemerick: what do the lighter/darker shades of color mean in the bar charts?
10:24cemerickarkh: Nothing; they are, AFAICT, some artifact of google docs' rendering of spreadsheet data.
10:25otfromcemerick: just having a read now.
10:26arkhcemerick: I was hoping it would be year-over-year changes or something ; ) Thank you for the survey + report
10:27cemerickah, unfortunately not
10:27cemerickI'd love to be able to easily chart year over year changes, but that'll have to fall to someone else.
10:27casioni feel surprised by all the previous java users
10:27casioneven though it seems obvious
10:27cemerickarkh: sounds like something you could take on ;-)
10:28arkh*ducks*
10:28mdeboarddoes Clojure CLR have C# interop?
10:29mdeboardor what
10:29ro_styou mean .net library interop
10:29casionmdeboard: CLR
10:29mdeboardYeah I guess, I have no idea really
10:29mdeboardAll I nkow is that we have some C# in production here
10:29mdeboardI'm generally clueless about the platform
10:29mdeboard(am looking at the survey results)
10:30mdeboardI'm so happy about the results of the clojure-py adoption
10:30cemerickmdeboard: of course, e.g. https://github.com/clojure/clojure-clr/blob/master/Clojure/Clojure.Source/clojure/clr/io.clj#L368
10:30mdeboard:o
10:30casionthere's a clojure-scheme?!
10:30casionI.. uh what?
10:30hyPiRionthere's a clojure-c
10:31casionI know about clojure-c, I've used it
10:31hyPiRionthere are a lot of clojures around.
10:31hyPiRioncasion: Is it nice?
10:31casionhyPiRion: eh…
10:32casionI dont feel I know enough about clojure to comment very authoritatively
10:32hyPiRionAs in - is it troublesome to get it up and running, or is it a hassle?
10:32casionbut as a c programmer, I thought it was shit heh
10:32casionso I could be entirely wrong and it's fantastic
10:32casionit was easy to get working
10:32cemerickAll of the variants are *very* new, so there's going to be rough edges.
10:33hyPiRion'kay, guess I'll peek into it.
10:33casioni didnt really get the point of it honestly
10:33scriptorcasion: so you wouldn't be tied to the jvm
10:33scriptorfaster startup, at least
10:33hyPiRionyeah.
10:33casionscriptor: that's all I could figure
10:33hyPiRionWell, for compiled scripts.
10:33casionbut you may as well use scheme then?
10:34scriptorwhat if you prefer clojure over scheme?
10:34hyPiRionThat's like saying you may as well use C++ instead of C ;)
10:34cemerickcasion: just because something has parens doesn't mean it's sufficient ;-)
10:34casionit was a question, not a statement :)
10:34casiona badly phrased one, but I did get the ? in there
10:35pjstadigit's one thing to add persistent data structures and reference types to an existing language
10:35hyPiRionBut sure thing - if startup time is important, CLisp or Scheme is a way to go.
10:35pjstadigit's another to have clojure
10:35mdeboardcemerick: Just showed my coworker Clojure CLR, he was blown away. I am too, I had no idea.
10:35hyPiRionBut for me, the only negative thing is the startup time and the hard dependency on the jvm
10:36casionhyPiRion: well, personally, I started with clojure because of the dependecy on the jvm
10:37hyPiRioncasion: Me too - It freed me from the Common Lisp library hell. But it's a bit "meh" if you don't need any jvm library
10:37hyPiRionEspecially for small scripts I want to start up and shut down - as I'm currently doing at work.
10:37cemerickmdeboard: I'm the the ClojureCLR contributors would love to hear your enthusiasm ;-)
10:37casionhyPiRion: I came from embedded c/asm… so the portability of the jvm and number of excellent java ilbs is infinitely attractive to me
10:38casionin fact I only started with clojure because I wanted to see 'what the fuss was' about functional programming, and I became enamoured with it very quickly
10:38cemerickmdeboard: "I'm sure", that is.
10:39mdeboardcemerick: Well, I think the objective is to get away fromt he CLR on the servers where the C# code resides, so I'm sure we won't be using it. I've been rewriting some stuff in Clojure (JVM) already
10:39mdeboardalthough mono is pretty awesome
10:39casionI would be pretty happy with a cocoa clojure, but I suspect that's out of the question hehe
10:40luciani'm really looking forward to clojurescript being self-hosted, or CinC or w/e
10:40luciancasion: that may not be all that far off, there's a clojurec dialect for clojurescript
10:40casioncasion: yeah, I know
10:40cemerickcasion: https://github.com/joshaber/clojurem
10:41casioncemerick: github isnt working for me atm for some reason, what is it?
10:41cemerickthough I think clojure-scheme and clojurec are both aiming to target iOS at some point?
10:41cemerickcasion: link to a clojure impl targeting objc
10:41casionoh oh!
10:41casionwhat is this sorcery
10:41cemerickmdeboard: ah, well, then I guess you're one more data point re: CLR being a non-entity in general
10:41dgrnbrgHey, I'm unfamiliar w/ clojure's choices in databasey integration. I have a bunch of long, pr-str-able strings (100s to 1000s of characters) which are keys into a set where the values are URIs. I am thinking that I'm just going to use sqlite and some db lib. Is there a better solution in clojure?
10:42casionwhy the hell won't github load, this is bothersome
10:42mdeboardcemerick: It's too bad Windows Server is so, so awful, because C# is a good language.
10:43mdeboardIs David Miller the StrangeLoop guy?
10:44rbarraudMdeboard: is mono evil?
10:44mdeboardoh, that's Alex Miller
10:44rbarraud:-)
10:44mdeboardrbarraud: Was that a The Gunslinger reference?
10:44rbarraudNorman Mailer?
10:44mdeboardBlain the Mono
10:45mdeboardif so, wow
10:45mdeboardif not, huh?
10:45rbarraudHeh... Not seen the gunslinger
10:45mdeboardbook series by Stephen King
10:45nDuffdgrnbrg: There's korma, if you want a layer of sugar on top of SQL
10:45rbarraudMono is .net on *nix
10:45nDuffdgrnbrg: ...for a non-SQL-ish datastore, there are plenty of options, but I'm not familiar enough to suggest between them.
10:46dgrnbrgnDuff: my biggest question is what to do about multi-kbyte keys
10:46mdeboardrbarraud: Yeah, just didn't get why you'd ask if it's evil. mono isn't evil, it's been pretty easy to use in my opinoin.
10:46pyykkisdgrnbrg: monger is quite nice for mongodb http://clojuremongodb.info/
10:47casionclojurem looks fantastically useful to me
10:47rbarraudI've heard people complain about it in the past
10:47casionthanks cemerick :)
10:47rbarraudAnd wonder about its long term viability / M$chrushability
10:47mdeboardrbarraud: It let me write C#, compile and run it, which is all I used it for. Did pretty ok, especially compared to the alternative (running a windows VM)
10:48rbarraudOf course it misses all the MS GUI stuff, right.
10:48nDuffdgrnbrg: The only cogent complaints I've heard have been from people complaining that Microsoft's promise not to attack Mono on intellectual property grounds is too limited to trust.
10:48nDuffrbarraud: ...ehh, it has _some_ of the GUI bits; they're getting better, slowly.
10:48mdeboardrbarraud: I guess, I dunnow hat MS GUI stuff you're talking about so
10:48cemerickcasion: :-) I only heard about it myself a few days ago. Make noise if it works well for you.
10:49casioncemerick: there will be much noise if I get it running and it works
10:49rbarraud:-)
10:49casionI know about 40 people who would instantly fall in love with this
10:51rbarraudHeheh... That's a creakily cute mascot thingy ;-)
10:51rbarraudIs it a bird, is it a plane, ....
10:51rbarraudLmao
10:51rbarraudThanks for pointing it up demerits
10:52rbarraudI feel privileged to be talking with you.
10:52rbarraudNow I should
10:52rbarraudA) go to sleep since its 2:51am
10:52rbarraudB) STFU and read your book which I jus bought the other day :-)
10:52ro_stC) stop making lists?
10:53ro_st(because it's close to 3am :-) )
10:53casionstop making lists in the clojure channel?
10:53rbarraud;-)
10:53casionsurely you jest :P
10:53rbarraudLol
10:53rbarraudNite peeps
10:53rbarraudMSL FTW! :-)
10:58casionwell, that was fun as usual
11:00uvtcWhat *was* that?
11:00casionnet split
11:00uvtcirc server needed to step out for a bit of fresh air?
11:05antares_dgrnbrg: take a look at clojurewerkz.org for data stores, plus clojure.java.jdbc and sqlkorma.com
11:28TimMcuvtc: If that's a euphemism for a "smoke break", then yes. :-)
11:29ohpauleezThat's the second time it's happened in the past three-ish days
11:33djpowellany korma know
11:33mdeboardohpauleez: netsplits are just a part of life on irc
11:33djpowellgah... any korma knowledge?
11:33casionpart of life on bad IRC servers
11:33casionof which freenode happens to be one
11:33ohpauleezmdeboard: true true
11:34mdeboardI've used IRC for years, never had a network (which is what freenode is, not a server) that was netsplit-free
11:34djpowellsql server requires subqueries to be given an alias. anyone know how to do this in korma?
11:35mdeboarddjpowell: No idea, sorry. It may be something you have to roll for yourself
11:39djpowellah. got it. just throwing a vector and an alias around the subselect works
11:39meliponehow can I find how many keys in a hash-map?
11:39djpowellcount
11:40melipone`(count {:a 3, :b 4})
11:41meliponehow can I invoke the eval bot here
11:41uvtc&(pr "like this")
11:41lazybot⇒ "like this"nil
11:41ohpauleez,(count {:a 1, :b 2})
11:41uvtc,(pr "or this")
11:41clojurebot2
11:41clojurebot"or this"
11:41melipone,(count {:a 1, :b 2})
11:41uvtcI've seen ##(pr "this too though")
11:41clojurebot2
11:41lazybot⇒ "this too though"nil
11:42djpowell,(+4 3)
11:42clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:45mdeboard##(doc defn)
11:45lazybot⇒ "Macro ([name doc-string? attr-map? [params*] prepost-map? body] [name doc-string? attr-map? ([params*] prepost-map? body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the ... https://www.refheap.com/paste/4071
11:47TimMc## is for middle-of-msg eval. It doesn't trigger on as many forms, though.
11:50mdeboardwut
11:51TimMcFor example ##3 doesn't but ##[3] should
11:51lazybot⇒ [3]
11:53mdeboard##"foo"
11:54mdeboard##'("foo")
11:54lazybot⇒ ("foo")
11:54mdeboardJava literals don't, apparently
11:54mdeboard##Integer
11:54meenalHi, is there a "continue" keyword in clojure?
11:54mdeboardmeenal: like, to continue in a loop without evaluating?
11:55meenalyes mdeboard
11:55S11001001meenal: it's called recur, and you can only use it where it makes sense
11:55S11001001meenal: if at all possible try to avoid writing loops though
11:56meenali was trying to loop through a hashmap, and populating a stringbuffer
11:56meenalwhen a condition is met, i want to continue in a loop, without evaluating
11:56S11001001right, here's a better solution: (apply str (map (fn [[k v]] make-a-string-here) hashmap))
11:57mdeboardmeenal: Filter out the values you don't want first
11:57mdeboard(which is why I assume you want the continue)
11:57S11001001meenal: loops are bad, seq functions are good
11:57TimMcand reductions are even better
11:57TimMc*reducers
11:57mdeboardmonads*
11:58TimMcheh
11:58mdeboard(I don't actually know what a monad is)
11:58gfredericks~monad
11:58clojurebotmonad is #<RuntimeException java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "=" at line 1, column 38.>
11:58gfredericks~monad
11:58clojurebotmonad is "yea, though I should walk in the valley of imperative code, I shall fear no evil, for your monad comforts me" - seen in #haskell
11:58gfredericks~monad
11:58clojurebotmonad is "yea, though I should walk in the valley of imperative code, I shall fear no evil, for your monad comforts me" - seen in #haskell
11:58gfredericksokay that's sufficient
11:58meenalis doseq bad too?
11:59gfredericksif you don't need side effects
11:59S11001001not as bad as loop/recur, but not as good as the other options we've mentioned
12:00scriptormeenal: so you're populating a string buffer by processing each item in a hashmap, unless that item meets a condition in which case you skip it?
12:00meenali do something different and skip it
12:00S11001001what's "do"?
12:01mdeboardIt's used in --
12:01mdeboardoh
12:01mdeboard##(do)
12:01lazybot⇒ nil
12:01mdeboard##(doc do)
12:01lazybot⇒ "Special: do; Evaluates the expressions in order and returns the value of\n the last. If no expressions are supplied, returns nil."
12:01mdeboard:P
12:02bryanlI'm trying to convert a map's value. https://gist.github.com/3275916 How do I remove a key of a hash that is the value of another hash?
12:02meenalin doseq, i iterate thro' a map, populating a stringbuffer - this is the normal flow (and if a needed, if there is an inner map, i recursively cal the function); if a condition is met, i populate buffer with some different value and want to "continue"
12:02S11001001mdeboard: ha. ha.
12:03meenalthis is what i meant by "do something different"
12:03S11001001mapcat then
12:04jkkramerbryancp: (update-in m ["20"] dissoc :age)
12:04S11001001(fn my-function [some-map] (mapcat (fn [[k v]] (if condition [some-string] (my-function descent-case))) some-map). (apply str (my-function starting-map))
12:05meenalokay.. let me try that and see.. thank you
12:06bryanljkkramer: i was going to use update-in. But the key is not always "20"
12:06bryanljkkramer: i'm looking for a way to tell update-in to use all the keys
12:08jkkramerbryanl: (reduce (fn [m [k subm]] (assoc m k (dissoc subm :age))) {} m) ?
12:09bryanljkkramer: thank you
12:17mdeboardgreat post on HN about Clojure http://news.ycombinator.com/item?id=4345689
12:17pzolIf I want to find all combinations of a list of items, is there a better way than doing this: (for [a items b items c items d items e items f items g items] (distinct [a b c d e f g])) ?
12:18S11001001pzol: I would use the existing clojure.math.combinatorics library :)
12:19pzolS11001001 :) ok, but for the sake of how to do it best…
12:23mdeboardparametric polymorphism ~= type dispatch
12:23mdeboard?
13:05uvtcHi #clojure. Regarding solving the related problems of (A) "What library should I use to do $x?", and
13:05uvtc(B) "What needs to go in my project.clj to use this library?" (which entails, "which is the *canonical* Clojars page for this library?"),
13:05uvtcI've been thinking that this might be useful: https://github.com/uvtc/clojure-dining-car
13:05uvtcView it rendered with a table of contents at http://unexpected-vortices.com/clojure/dining-car.html
13:05uvtcIt's still very bare.
13:05uvtcAnd it needs a graphic of a dining car. :)
13:05uvtcI think it can only be useful though if the community contributes to it. I certainly don't know enough about the various libraries to properly populate it,
13:06uvtcor to adequately spec out the hierarchy.
13:08scriptorI'd add a github link as well as a clojars link
13:08TimMc+1
13:08scriptorto select a library, they'd have to learn a little about it first :)
13:08uvtcThe Clojar page contains the github link.
13:09scriptornot always, for example https://clojars.org/clojurewerkz/neocons
13:09uvtcscriptor: Yes, that's true. I'd hope that there could be *some* pithy comments following each entry there.
13:10uvtcIf the Clojars page doesn't contain a link to the github page, then either there's no github page, or it's a big in the project's project.clj (fwict).
13:10scriptorah, got it
13:11zerokarmaleftcemerick: percentiles don't add up for your cljs environments chart
13:11technomancyzerokarmaleft: it was a multiple choice question, so that's expected
13:11cemerickzerokarmaleft: "Note: Any question with results that sum to more than 100% allowed respondents to select more than one response."
13:11zerokarmaleftah, my bad
13:12zerokarmaleftheh, i think i asked you to change some of those questions to multiple response questions also, derp
13:13uvtcscriptor: filed a bug with Neocons about the missing :url option.
13:13solussdanyone else having trouble with clojars today? I'm getting a "failed to collect dependencies for … " with clojure 1.4 at the top of the list
13:17uvtcoops. s/it's a big/it's a bug/. Though, looks like some of the clojurewerkz :url's point to their doc webpages rather than to github project pages.
13:18solussdack! maven clojure version is 1.2? http://repo.maven.apache.org/maven2/org/clojure/clojure/maven-metadata.xml
13:19seancorfieldsolussd: all versions are there http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22clojure%22
13:20solussdwell 'lein reps' is failing for me, presumably b/c that manifest file points to clojure 1.2 as the latest version
13:21solussdor not.. idk. I'm taking stabs at this
13:22seancorfieldlein reps? or lein deps? which version of lein? what is in your project.clj?
13:22solussd* deps
13:22solussdmountain lion autocorrect fail
13:24technomancybleaugh, another central screwup?
13:25solussdseancorfield: my deps: https://www.refheap.com/paste/df55aa9e01dd90de1288b8783
13:26technomancythey're all still there: http://repo.maven.apache.org/maven2/org/clojure/clojure/
13:26technomancysomeone just screwed up the metadata file
13:27solussdyay! it's not me. :)
13:27technomancysolussd: are you getting this from the US?
13:27solussdtechnomancy: yes
13:28seancorfieldwith those deps, both lein1 deps and lein2 deps work for me
13:28technomancyis anyone from the UK seeing the same thing? only 1.2 showing from http://repo.maven.apache.org/maven2/org/clojure/clojure/maven-metadata.xml
13:28technomancyseancorfield: that's because your ~/.m2 cache is populated
13:29solussdI noticed after adding deps
13:29seancorfieldah, i'd better not clean my cache out then :)
13:30technomancyhrm; all the brits I know aren't present
13:30technomancyseancorfield: sorry, you don't count since you live in the US
13:31technomancylast time this happened the central guys asked me to check if the problem was specific to either the US or UK mirrors
13:31ohpauleeztechnomancy: Is there any document explaining how the dependency mechanism works in lein2?
13:33technomancyohpauleez: not really, but all the docs covering Maven should apply
13:33technomancythe main difference would be that Leiningen uses profiles instead of scopes; those are not specific to dependencies, but they're pretty well documented
13:34seancorfieldtechnomancy: i'm a passport-carrying american (well, i would be if my passport wasn't currently in DC for my upcoming Russian tourist visa!) :)
13:34technomancyseancorfield: but... the accent!
13:34xeqiohpauleez: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Transitive_Dependencies works if you ignore the scope stuff
13:35ohpauleeztechnomancy: Cool. Specifically, I'm curious how deps get tracked/referenced in lein2 vs lein1 (with ./lib) - I'll dig around. I appreciate it
13:35ohpauleezxeqi: Thank you
13:36ohpauleezxeqi: Can you link me one more time
13:36xeqiohpauleez: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Transitive_Dependencies works if you ignore the scope stuff
13:36ohpauleezthanks!
13:36technomancyohpauleez: the tldr is you need to get it in a repo. `lein deploy` to an s3-backed repository if you want to do it the right way; otherwise use lein-localrepo if you're just experimenting.
13:37technomancyhrm; it occurs to me that making `lein deploy` work with a pom+jar combo on disk would help a lot there.
13:37ohpauleeztechnomancy: most certainly
13:38ohpauleezPreviously when I was just trying some changes out, I would just drop a jar in a test-project's ./lib and go
13:39ohpauleezI'm trying to find the shorthand for doing that with lein2 without having the weird system wide inconsistencies
13:39technomancyis the jar from a leiningen project or just some random jar?
13:39ohpauleezlein
13:39technomancyohpauleez: ok, just do `lein install` to make it available locally and `lein deploy` to make it available to your team
13:40technomancyohpauleez: also see the "checkouts" feature to make it more convenient
13:40ohpauleezcool, maybe checkout is what I'm looking for. `lein install` goes to .m2, no? - that's the piece I'm missing
13:41technomancyyep
13:41ohpauleezright, I want to avoid that if possible
13:41technomancycheckouts make it a bit more convenient once you've got it working with `lein install`
13:42nedhi folks
13:43ohpauleeztechnomancy: Thank you, I think what I'm looking for is something like checkouts
13:57solussdhm, so since it appears this: http://grokbase.com/t/gg/clojure/126bx7z0jy/central-screwup/oldest is happening again, who needs to be informed so it can be fixed?
13:58solussdi miss my repl. :(
14:06puredangerso, what is the current set of reasonable choices for writing a parser in Clojure? what's actually being used out there of: fnparse, amotoen, ez-parse, clojure-pg, clj-peg, clarsec, Antlr, etc. We've experimented with several of these and built our own parser combinators for some stuff but they seem kind of slow for certain kinds of grammars. Will someone go definitively solve this problem for me? :) Seems like there sho
14:06puredangerbe a slam dunk answer for this in Clojure by now.
14:29ebaxtHas anyone else experienced problems loading transitive depenencies for noir 1.2.x?
14:29ebaxtdownloading that is..
14:58michaelr`hello
15:00uvtchi, michaelr`.
15:00foodoogreetings michaelr
15:01michaelr`wow it's a crowded night with lot's of friendly people :)
15:02SegFaultAX|work2It's actually been pretty dead in here all morning.
15:02SegFaultAX|work2At least since I got into the office at 9ish.
15:02foodooand then /you/ showed up ;)
15:02michaelr`haha
15:02SegFaultAX|work2... wait a minute, are you saying that... :'(
15:04foodoohm. A minute is over now. Why are you sad?
15:05SegFaultAX|work2Did you guys checkout cemerick's post on his survey results? Pretty interesting read if you haven't.
15:05foodoolink?
15:05clojurebotyour link is dead
15:05SegFaultAX|work2http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/
15:06naegas I'm very new to clojure, I'm also very excited about those results
15:06naegdidn't know that almost no one uses the CLR
15:08SegFaultAX|work2naeg: ... for clojure.
15:08naegyeah, I meant it like that
15:09foodooI guess a lot of people are satisfied with what Clojure provides itself + a few extras from Java land
15:10uvtcI found it somewhat interesting that --- aside from Java --- a lot of users came from Python & Ruby, but not from Perl.
15:10ibdknoxstill have a lot to do
15:10ibdknox:)
15:10naegI assume many clojure programmers do have a java background?
15:10foodooI'm not sure if that's the case. I have a rather broad background (which also includes Java)
15:11SegFaultAX|work2naeg: If that survey is anything to go by they do.
15:12antares_naeg: according to the survey and my own anecdotal evidence, as many come from Java as from Ruby/Python
15:12miloshadzicuvtc: my guess is that most of the perl guys migrated to ruby or python first
15:13SegFaultAX|work2Well IIRC the question was something like "what language did you come from /right before/ clojure?"
15:13uvtcmiloshadzic: Perl 5 still has a pretty substantial community. I was thinking that part of the reason is that Perlers like Perl, and another part might be that Perl is used a lot for scripting.
15:14foodooI may be mistaken, but the number of Perl users nowadays is not tha great any more. So there are less Perlers that can come to Clojure
15:14naeg"What language did you use prior to adopting Clojure [...]?"
15:14SegFaultAX|work2The majority of system admins, ops, and server-side folks I've worked with use Perl but only very few of them use it as a primary development language.
15:14hiredman"english"
15:14duck11232less perl users self identify as perl users
15:14SegFaultAX|work2What duck11232 said. I fall into that boat as well.
15:15uvtcfoodoo: Perl 5 gets used a lot behind the scenes.
15:15uvtcduck1123: Sounds right.
15:16foodoouvtc: thanks for clarifying that
15:16uvtcI'd have been interested in seeing the question: "If you have Java experience, is it recent, or did you come *back* to the JVM for Clojure?" :)
15:17naegI'm sure you can ask him to include this in his next survey
15:17SegFaultAX|work2"If you have Java experience, did you have a mental breakdown before you found Clojure?"
15:17naegsounds interesting to me too
15:18foodoouvtc: I came back to the JVM because of Clojure. Haven't used Java for quite a while
15:27RoxxiWhat were you using before you came back to the JVM, foodoo?
15:28uvtcI bet foodoo 's experience is fairly common.
15:29foodooRoxxi: mostly Python. But also various other languages
15:30uvtcer. s/experience/path/ ... fairly common among Clojurers anyhow.
15:37foodoocemerick's report states that many people have a problem with Clojure documentation. I agree with that. It's difficult to find or learn about the functions (in clojure.core) that would make your life much easier.
15:38uvtcThe cheatsheets with tooltips help a lot with that, IMO: http://jafingerhut.github.com/
15:38uvtc~cheatsheets
15:38clojurebotTitim gan ?ir? ort.
15:38foodooMaybe it would help, if all functions in Clojure would be put into categories (at least for the documentation) so that one can easily get all functions that are related to a topic?
15:38uvtc~cheatsheet
15:38clojurebotCheatsheets with tooltips can be found at http://jafingerhut.github.com/ .
15:38hiredmanfoodoo: clojure.org has that
15:38jolyclojuredocs.org has been pretty helpful
15:38hiredmanthe #1 problem with documentation is people don't read it, and complain that it doesn't exist
15:39uvtcOh, neat. The cheatsheet at clojure.org http://clojure.org/cheatsheet actually has a link at the bottom to the ones with the tooltips.
15:39hiredmanhttp://clojure.org/namespaces <-- namespace functions http://clojure.org/sequences <-- sequence functions, etc
15:40foodoosure, these cheatsheets are neat, but the official documentation doesn't link to them. (Or have I overlooked something?)
15:41foodooah, there it is *facepalms*
15:41hiredmanhttp://clojure.org/ has a list of links under "reference"
15:41amalloyfoodoo: perhaps you've missed the URL bar? the clojure.org in there seems to indicate that it's official documentation
15:41seancorfieldperl... i don't think i've used perl in a decade...
15:41seancorfieldwhen i was at macromedia, our build/deploy script was perl...
15:41seancorfieldabout 1,000 lines... i had to maintain it for a while... ugh! :(
15:52puredangerI think I might actually owe Andy an update of the clojure.org cheat sheet with the tool tipped version, can't remember now
15:55gunsIs there a function that will expand shell globs like: {~guns,~foo}/bar/**/*.baz
15:56gunsOr at least do tilde expansion?
15:57amalloyi'm pretty sure that function is your shell
15:57duck11231guns: if there is anything, it's probably part of or used by pallet
15:57gunsduck11231: Okay, will check it out
15:59hugodguns: nothing directly in pallet for that - though you could shell out to a ls for a quick hack
15:59amalloyhugod: nooooo, not ls. echo
15:59gunshugod: ah. It's not important. Just spoiled by Ruby's Dir.glov
15:59guns*Dir.glob
16:01hugodamalloy: that would be better, indeed
16:01nDuff*shudder* (re: "shell out to ls")
16:02nDuff...to quote from the !ls factoid in #bash: <greybot> ls is a tool for interactively looking at file information. Its output is formatted for humans and will cause bugs in scripts. Use globs or find instead. Understand why: http://mywiki.wooledge.org/ParsingLs
16:03nDuffprintf '%s\0' your_glob_here <- safer approach (requires handling null-delimited output)
16:04uvtcguns: maybe something in https://github.com/Raynes/fs or https://github.com/flatland/useful ?
16:05gunsnDuff: You'd still have to parse the output. find -print0 is ultimately most appropriate for shelling out imo
16:05gunsuvtc: Thanks for the links
16:06uvtcguns: You're welcome. I added them to {cough} ... the Dining Car. (!)
16:06amalloyuvtc: useful doesn't have any fs-related stuff afaik. if we implement filesystem globbing please show me where so i can remove it :P
16:06nDuffguns: Pardon? Output from the printf approach and from find -print0 would be identical
16:06uvtcamalloy: right-e-o. :)
16:07nDuffguns: ...you're right that it needs to be parsed, if by "parsed" you mean "split on nulls", but that's not the same as detecting what kind of behavior your local platform's ls has on non-printable characters.
16:07gunsnDuff: oh, right printf '%s\0' in a list
16:07uvtcamalloy: feature request for `useful`: A readme. :P
16:07uvtc:)
16:07mattmossAnyone using VimClojure? If so, do agent watches work for you?
16:08gunsnDuff: no argument about ls. that's a horrible practice
16:08naegibdknox: according to the survey some already use lighttable - is it that usable already?
16:09RaynesNope.
16:09Raynesamalloy: fs has globbing, iirc.
16:10amalloyugh. if it does, it probably shouldn't
16:10amalloybut that's your project; as long as it's not in useful
16:10ibdknoxnaeg: it's a full replacement for a repl :)
16:11Raynesamalloy: I didn't write that particular monstrosity. It's only in there because everything I touch causes someone to complain, so I get worried.
16:11ibdknoxthe next update should make it a capable clojure env
16:11Raynesibdknox: <3!
16:11naegibdknox: but those who voted it can only be using the playground, right? so there is no other beta for e.g. kickstarter backers out there?
16:12gunsamalloy: I'm curious about your dislike of libs emulating shell functions
16:12cpineraHi all. Is there a way to output the results of lein test in the JUnit format? I was looking at lein-test-out but it looks like it's been abandoned, and it doesn't work with lein2.
16:14ohpauleezmattmoss: The agents won't work
16:14ohpauleezthe repl ins't a real repl
16:14ibdknoxnaeg: everything is the playground for now
16:14ohpauleezit's just a buffer that has special commands to send via Nailgun, but it's not truly interactive
16:14ibdknoxRaynes: hey dude :)
16:14amalloyguns: there are an infinite number of shells, which all glob differently
16:14ohpauleezit just does call/response pairs
16:14amalloyif a clojure function pretends to do one of them, it will fail unexpectedly on other platforms
16:14gunsamalloy: POSIX sh?
16:14mdeboardpuredanger: Are you any relation to the David Miller who maintains ClojureCLR?
16:15hiredmandoesn't exist
16:15puredangermdeboard: nope :)
16:15gunsI guess you're right. I'll make sure to call any functions I write bash-expand, etc
16:15ohpauleezmattmoss: What you can do is use lein-tarsier and have it start a connected REPL
16:16amalloyguns: and you'd only be doing a small part of shell expanding anyway, namely filename globs. i'd rather shell out to bash, so that it can do foo.{txt,pdf} for me
16:16mattmossohpauleez: I'm using lein-tarsier to start up nailgun.
16:16ohpauleezthis let's you use the vim repl for quick one-off things, use vim to modify the running environment using evals, and then use the outside repl for agents anfd such
16:16uvtcguns: what is bash-expand?
16:16nDuffPOSIX sh may not exist, but there are shells that try to do nothing not in it. Granted, nobody uses them but masochists and busybox.
16:17amalloy(at least then the platform-dependency i'm creating is explicit)
16:17ohpauleezmattmoss: in your profiles.clj -> :vimclojure-opts {:repl true} ;; for lein-tarsier
16:18gunsamalloy: that's sensible, but you then have a dependency on the bash version. bash4 is a world of difference from bash2 for instance
16:18uvtcamalloy: to shell out to bash, do you mean by using Raynes's conch, or clojure.java.shell?
16:18amalloydon't see why that matters, uvtc
16:19RaynesConch is the sexy, so assume he always means conch.
16:19uvtcamalloy: I'm asking how to do it.
16:19amalloyi'd use c.j.sh until i fonud something frustrating enough to make me try/learn conch, but there's no reason you should follow my particular footsteps
16:19uvtcamalloy: (was worded poorly. Sorry. :) )
16:20mattmossohpauleez: ok, thanks... that helps.
16:20Raynesamalloy: That's true. I was mostly kidding. I don't tell people to use conch until they actually need it.
16:20ohpauleezmattmoss: totally welcome - it's the best solution I've found to that situation
16:20Raynesamalloy: Though I could in probably 4 lines add the same abstraction in conch that you get form c.j.sh
16:21Raynesc.j.sh is already there.
16:21uvtcEarlier, guns mentioned "bash-expand". What is that?
16:22amalloythe name of a function he plans to write
16:22uvtcamalloy: Ah. Thanks.
16:22mdeboardsimply by conceiving of it, it already exists
16:24mattmossohpauleez: okay, seems to be working for me, as long as the call to send-off is in the non-vim repl
16:24ohpauleezcorrect, yes
16:24ohpauleezmattmoss: All stuff requiring rich-interaction will have to be from the non-vim repl
16:24mattmossIs this a VimClojure issue, or a nailgun issue? Or something else?
16:25ohpauleezVimClojure's REPL is just a facade
16:25ohpauleezit's literally a special interpretation of keystrokes and is built on assumption of call/response
16:25ohpauleezto get around it, you'd need to use something like Python within vim
16:26ohpauleezbut some people don't have vim compiled with Python support
16:26ohpauleezso to keep the plugin simple and ease the adoption, the tradeoff is made
16:26mattmossah
16:27ohpauleezlein-tarsier adds a work-around by connecting a live repl to the nailgun instance, which is nice
16:27ohpauleezyou can \ep and \ef in vim and it's all in the non-vim repl too
16:27ohpauleezif you're using tmux, this is just as good
16:29emezeskeREPLs running in vim windows are always destined to be crap, because vim doesn't really support asynchronous updates to windows
16:29mattmossMy biggest problem at the moment is forgetting emacs keys and remembering vim. :)
16:30ohpauleezmattmoss: emacs + clojure-mode + jack-in + EVIL if you really need it
16:30ohpauleezor you just feel up for a real challenge?
16:30mattmossI've been using emacs up until today. I had just gotten vim keys out of my system.
16:31mattmossProblem is... something got corrupted or misconfigured when my power went down.
16:31mattmossAnd now, for the life of me, I cannot get emacs/clojure/swank working again. clojure-jack-in does nothing.
16:31mattmossSpent a full day trying to fix.
16:44dgrnbrgI am using clojure.java.shell/sh with the option :out :bytes, but I am seeing the returned value of the :out key be a string. When I read the docs, it should be an array of bytes. What could be happening?
16:44dgrnbrgOh, it changed to out-enc
16:44RaynesIt's evil like that.
17:36arkhraynes: thanks for conch! It's not expect but looks handy ; )
17:37RaynesHeh.
17:37RaynesYou're welcome.
17:37RaynesI write all my libraries specifically for you.
17:38arkhis that the plural and anonymous form of 'you'?
17:38amalloyhe's looking you in the eye while he says it
17:38amalloyguaranteed
17:39nDuff...I think the rest of the room became more sarcastic simply by having him in it.
17:39RaynesI'm not sure I've ever been sarcastic at a conj. I mostly go inside of a tiny little shell at conferences.
17:39RaynesI guess my talk might have had some sarcasm in it.
17:39arkhI was at the first conj! Raynes is a better programmer than I'll probably ever be … but I try not to let that keep me from wanting to improve : )
17:40RaynesAw.
17:40nDuff*nod* -- it's the talk I was going by.
17:40RaynesThey like me! They really like me!
17:40nDuffOf course we do. Other people can make us feel stupid by comparison, but only you make us all feel old _and_ stupid. :P
17:43RaynesHeh.
17:43RaynesI try my best.
17:44naegWhat talk are you guys talking about?
17:44naegI like sarcasm to some extent and you made me curious
17:45RaynesI had a talk about clojail at the conj last year. I'm not really promising good and extensive sarcasm though.
17:45amalloyRaynes makes everyone curious
17:45naegis that talk online?
17:45RaynesYup.
17:46foxdonutRaynes makes all the computers in my house switch to the Sarcasm color scheme.
17:46RaynesSpeaking of talks, I guess I should submit one for this year's conj. If they're still accepting them.
17:47Rayneshttp://blip.tv/clojure/anthony-grimes-clojail-life-in-the-clojure-prison-5919720
17:47naegfound it already, thanks
17:47RaynesLooks like blip just went down though.
17:47RaynesAt least for me.
17:47naeghttp://lanyrd.com/2011/clojure-conj/shhfb/
17:48RaynesHuh, Simpson. My twitter doesn't still say Simpson, does it?
17:49RaynesD'oh well.
17:49RaynesAlso, I'm not fat up there. It's totally the angle of the camera. Puts on 100 pounds. I promise.
17:51naeghehe
17:52rkzanyone know what the vimclojure altnerative to swank/break is?
18:10holohi!
18:10naeghi
18:10ls3hi!
18:11naegRaynes: with what program did you create those slides?
18:11Raynesnaeg: Keynote
18:17hololein just installed clojure 1.3 as a dependency of lein-cljsbuild specified in my project.clj. i have also specified clojure 1.4 as a dependency of the project. which version is going to be used?
18:19Raynes1.4
18:20RaynesIn most cases, whatever you specify in project.clj overrides transient dependencies.
18:22holoRaynes, i see. i will remove the reference to clojure 1.4 in project.clj then. will i have to manually remove clojure 1.4 in lib/ and classes/ too?
18:26RaynesNo. And you shouldn't need to remove 1.4 in the first place.
18:26Raynescljsbuild will probably work just fine with 1.4.
18:28emezeskeI belive the latest version of lein-cljsbuild depends on 1.4.
18:29RaynesDon't get caught up in what things depend on unless they cease to work. ;)
18:29holoemezeske, how do you believe it? didn't you develop this plugin? o.o
18:30emezeskeI didn't memorize the whole codebase, and I didn't take time to refer to it
18:32holoemezeske, i'm pretty sure it just included 1.3: "Including clojure-1.3.0.jar" after adding 'lein-cljsbuild "0.2.5"'. also, i came across a comment string stating: "Your project must use Clojure 1.3 or above to support ClojureScript compilation."
18:33Raynes"or above"
18:33emezeskeholo: https://github.com/emezeske/lein-cljsbuild/blob/master/support/project.clj#L7
18:35holoRaynes, yes, you are completely right. but about "Don't get caught up in what things depend on unless they cease to work.", i think it's safe just to avoid some stupid mistakes that may take hours to solve, instead of just some minutes. of course, if i was as good as any of you already...
18:40holoemezeske, how can i specify to download the release of that commit 5 days ago?
18:42emezeskeholo: You already did, that was in 0.2.5
18:49naegnice talk Raynes
18:49naegI'm outta here now, bye
18:57mdeboardHas anyone else been having any issues with emacs freezing up ? Running emacs-snapshot-gtk (emacs 24), lein 2
18:57mdeboardon ubuntu 12.04
18:58mdeboardThis almost always happens when there's some autocomplete action taking place in the repl
18:58mdeboard(talking about clojure-mode here obv)
19:03technomancymdeboard: do you mean M-TAB completion or specifically the autocomplete.el library?
19:06mdeboardtechnomancy: I'm not sure, it's hard to track down because emacs hard-crashes (i.e. the process is killed immediately, or freezes for 5-10 seconds then is killed), but I have noticed this correlation. Sorry for the delayed response, it just crashed again.
19:06technomancywow, never heard of anything like that
19:06technomancyhave you tried updating to the stable 24 release?
19:07technomancyseancorfield: so I recently discovered jsql. is it still in crazy unstable experimental-land?
19:07mdeboardNot yet. I'm wondering if it has something to do with this iText Java library I'mw orking with, I've never ever had this problem before. Seems improbable.
19:08technomancyseancorfield: I'm very interested in this notion of compiling a sexp representation of a query into SQL so it can be the building blocks for further tools
19:08SegFaultAX|work2technomancy: Isn't that kinda what Korma is trying to accomplish?
19:08xeqikorma does alot of things
19:09xeqimap -> sql, orm-ish foriegn key, connection pooling
19:09technomancySegFaultAX|work2: yes, but for various reasons I prefer jsql's approach
19:09SegFaultAX|work2It's not exactly sexp compiliation; rather a DSL. But it's pretty close.
19:09SegFaultAX|work2technomancy: I haven't heard of that before.
19:09technomancyor rather the approach discussed as a possibility for jsql
19:10SegFaultAX|work2I must have missed that discussion.
19:13technomancysome of it's here https://groups.google.com/forum/#!msg/clojure/VnNJbBwOv2o/PzXfJgWBiSMJ
19:13technomancy(apologies for the shebang-style URL)
19:14mdeboardI'm workgin with a Java library that has a class, `PdfWriter'. It can only be instantiated by calling its `getInstance' method with the proper signature, i.e. `(def w (PdfWriter/getInstance doc os)'. `doc' is a `Document' instance, `os' is an output-stream. Now, in order to do any work with the PdfWriter instance, you have to explicitly call e.g. `(. doc open)', THEN call the `open' method for the PdfWriter instance
19:14mdeboardtoo. God I hate this library. So my question is, this library sucks.
19:14mdeboardBut seriously, my question is, does anyone have a recommendation for how to gracefully manage this nightmare
19:15mdeboard(with-open) works great for the document, but not for the PdfWriter
19:22Cr8mdeboard: is this library iText?
19:22mdeboardCr8: Yes.
19:22Cr8oh boy, I've used that before
19:22Cr8not from clojure, mind
19:22mdeboardDude, it's the worst.
19:23Cr8Not sure why with-open would not work
19:23mdeboardI'm literally about to rewrite the PdfWriter class :|
19:23mdeboardin Java.
19:24mdeboardbecause of how you have to invoke the close method or something.
19:26mdeboardI have never written a line of Java; is it common to have a class that you can't instantiate by invoking its constructor? http://api.itextpdf.com/itext/com/itextpdf/text/pdf/PdfWriter.html#PdfWriter(com.itextpdf.text.pdf.PdfDocument, java.io.OutputStream)
19:26mdeboardwow, god.
19:26Cr8mdeboard: sometimes.
19:26mdeboardWhy?
19:26clojurebotWhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
19:27emezeskemdeboard: Factory methods are often used in place of constructors, for various good reasons
19:27emezeskemdeboard: Very common pattern.
19:27mdeboardI see.
19:27mdeboardok
19:27mdeboardI will enhance my calm. Still very frustrating.
19:27clojurebotHuh?
19:28emezeskemdeboard: I don't understand your problem, exactly; can't you just call open and close from clojure?
19:28mdeboardemezeske: Not for the PdfWriter instance.
19:29emezeskemdeboard: But, it can be used from java?
19:30mdeboardAlso, are you asking whether you can call open and close from clojure for the PdfWriter instance or the Document instance that must be passed to the PdfWriter instance? Each must be opened separately
19:30emezeskeI guess I just don't understand what's stopping you from doing everything you need to do from clojure
19:30emezeskeIt seems like if you couldn't do it from clojure, you couldn't do it at all
19:32Cr8so I'm looking at http://api.itextpdf.com/itext/com/itextpdf/text/Document.html
19:33mdeboardright
19:33Cr8If that example actually works, I think https://www.refheap.com/paste/4079 would be a reasonable translation. (with the necessare imports/requires)
19:34mdeboardYou'd thik so
19:34mdeboardhttps://gist.github.com/1b4a85042d3185f4c625
19:36amalloyum, the latter isn't calling .close on the doc, and the former is
19:36mdeboardWhere?
19:36clojurebotwhere is log
19:36amalloyin with-open. the whole point is it calls .close on everything when it returns
19:37mdeboardOh, I thought it worked as a context manager. It kept things alive until the scope it enclosed was exited.
19:37Cr8mdeboard: any var in the with-open binding form has .close called on it at the end of with-open. That's all with-open does.
19:37mdeboardWell.
19:37hiredmanthey are not vars
19:38Cr8name
19:39mdeboardbased on https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3394
19:39mdeboardI thought the body was executed before .close was called from reading the code there
19:39amalloyindeed, it is
19:39amalloyand the body is just (.open pw)
19:40wilfredhI'm writing a bot that has a list of plugins (functions, each in their own namespace). I'd like any plugin to be able to access this list of all plugins. How do I resolve the circular dependency? It seems fundamentally circular.
19:41mdeboardamalloy: I'm confused. Even if I remove line 6 from that paste and close the parens appropriately, it still throws NPE. Is it supposed to evaluate that expression before calling close or not?
19:41technomancywilfredh: you need to use runtime resolution
19:42technomancyns-resolve inside the body of a function
19:42technomancywilfredh: you may also find the bultitude library useful
19:42mdeboardI'm not arguing with you because what you are saying is either obviously true or implausibly coincidental... just trying to unconfuse myself.
19:42technomancywilfredh: something like this: https://github.com/technomancy/leiningen/blob/master/src/leiningen/help.clj#L13
19:42rkzin clojure regex where does the ?i go for case insensitive
19:43amalloyi don't know what it's "supposed" to do in your context. all i can tell you is that if you put (.close doc) in between lines 12 and 13, the two will behave identically
19:43rkzim trying to replace the space here
19:43rkz(clojure.string/replace-first "hello world" #"O\s" "")
19:44rkz(clojure.string/replace-first "hello world" #"O\s?i" "")
19:44amalloyalso, i don't really agree with technomancy that the automatic solution here is runtime resolution
19:44amalloyyou could, for example, make each plugin be a function, where one of the function args is "all the plugins"
19:45Cr8mdeboard: hey, I just popped up a new lein project and this code successfully outputs a pdf
19:45Cr8https://www.refheap.com/paste/4080
19:45Cr8with lein run
19:46rkzoh it goes at the front
19:47Cr8mdeboard: https://www.refheap.com/paste/4081 better, this one does it without leaking the outputstream
19:48mdeboardCr8: Right, but now you've got to manually close the document; this circles back around to my previous question. Recommendations on how to handle that gracefully (thank you btw)
19:48Cr8mdeboard: the doc, pdfwriter, and outputstream all get closed by with-open
19:48Cr8in that order
19:48wilfredhtechnomancy: thanks.
19:49mdeboardOh, god, ok.
19:49mdeboardCr8: Thanks :)
19:49Cr8np :)
19:49technomancyit's interesting how low "Future staffing concerns" ranked in the list of concerns about Clojure
19:49emezesketechnomancy: You can learn lisp on the bus ride to your job interview
19:49technomancyI'd consider that easily the #1 blocker of adoption in medium-to-large orgs.
19:50technomancyemezeske: you can, but people you hire won't. =)
19:50holoemezeske, i don't have any explicit reference to clojure 1.4 anymore in project.clj. i was using lein 1.x (maybe some problem because of this, dunno). now i upgraded to lein2, cleaned .m2 directory and did lein self-install. now lib/ is not used anymore (but also empty). after doing "lein deps" the "clojure" files donwloaded to .m2 directory are https://gist.github.com/3279689 - as you can see, there is no .jar for clojure 1.4. should there be one?
19:50holoanyways, i guess i shouldn't care so much about this. but if it's useful for you..
19:50emezesketechnomancy: haha, I can't! just referencing some lisp joke I read a while back
19:51technomancyemezeske: oh, that was _implementing_ a lisp. totally different. =)
19:51emezesketechnomancy: that was it! :)
19:52technomancyI guess the question was phrased in a way that emphasized personal frustration rather than uptake within an organization.
19:52emezeskeholo: You might have to run a "lein cljsbuild ..." task first, I'm not sure
19:52duck1123I like to think that a well written clojure program should be trivially maintainable by a decent programmer. (if the only guy that knows clojure leaves and you just have to keep it running)
19:52RoxxiHey, in leiningen, can you do something equivalent to maven's ${project.version} to have the version field pulled or filled in by, say, an environment variable?
19:52Roxxi(Or some higher pom?)
19:52technomancyRoxxi: you can unquote in project.clj to eval arbitrary clojure
19:53duck1123Roxxi: the answer I got was to write out the version number as bart of the build process
19:53technomancyso (defproject foo "1.0.0" :some-value ~(System/getenv "SOME_VALUE"))
19:53technomancyRoxxi: depends on whether you want it in the project map or at runtime I guess
19:53mdeboardCr8: Thanks again, big relief. I've had my head down in this library for days wrapping it in Clojure to smooth out rough spots. Tunnel vision set in
19:54Cr8ha, yeah.
19:54duck1123Roxxi: this is what I was linked to git://github.com/clojurewerkz/route-one.git
19:54duck1123oops
19:54Cr8Again, I've worked with iText before. It was two years ago, but I remember a little of it.
19:54Roxxitechnomancy: Well, right now I'm making a small set of dependent projects, when filling out another :dependencies section, it'd be nice if everything would have the same version.
19:54duck1123https://github.com/geni/geni-gedcom/blob/develop/project.clj
19:54xeqiholo: can you post you're project.clj. dependencies with version ranges have to pull a .pom for each version before figuring out which one to use
19:54antares_duck1123: are you trying out route-one? :)
19:55mdeboardCr8: Regardless of how myopic I was being, it's still a really hairy API :P
19:55duck1123actually yeah, that was in my clipboard from last night
19:55duck1123expect a pull request soon
19:55Cr8mdeboard: I don't disagree. It's quite quirky.
19:55antares_duck1123: cool. Honestly, it is one of the clojurewerkz project I haven't gotten to really polishing but it should do its main job well. Contributions are welcome ;)
19:55antares_*polish
19:56Cr8I'd used it for a project converting from some odd proprietary document format with its own annotations, bookmarks, etc. to PDF
19:57Cr8lots of it really felt like jumping through hoops
19:57duck1123the changes I made was I changed the route-map to a ref and added a add-route function that would conj on a new routes, since my routes are split amongst a couple files
19:57technomancyRoxxi: middleware might be a good fit for that
19:57antares_duck1123: ok, using a ref is fine with me
19:57Roxxithanks duck1123 and technomancy
19:59duck1123antares_: the only issue I had with that was you can't have multiple arity vararg functions, so I had to pass the option map as a map, Need to clean it up before I push
19:59duck1123antares_: also, the example for add-route is only valid in a route-map block
20:00mdeboardCr8: Yes, I'm actually doing this because we use the C# version at work but it's been identified for a rewrite down the road. Getting a Clojure version -- at least of the components we use -- together to pitch rewriting in Clojure. We do a *lot* of business converting PDFs to a different format for our platform, so it would be a neat feather in the cap
20:00antares_duck1123: I personally group routes in a single file but if you've made it possible to split routes, that's great
20:01mdeboardfor clojure
20:01duck1123I used to have all my routes in a single file, but I have so many routes now, I had to split it up
20:01mdeboardok, bragging rights for me
20:01mdeboardunfortunately I'm an idiot so it's taking a while. :)
20:01antares_duck1123: heavy users get heard ;)
20:09holoxeqi, from what you are saying, it downloaded some .pom, then decided to use .jar of clojure 1.3? my project.clj - https://gist.github.com/3279791
20:13mattmossAnyone using emacs/clojure-mode/swank at the moment on Mac OS X? I'm trying to debug an issue and want to see the output of 'lsof -i -P | grep -i "listen"' for someone who has things working.
20:14casionjava 37242 audiolabs 33u IPv6 0xffffff8014384bc0 0t0 TCP localhost.localdomain:62107 (LISTEN)
20:14mattmossok... so yours says localhost
20:14casioncorrect
20:15mattmossMine is being opened like this: TCP [::192.168.177.130]:64073 (LISTEN)
20:15mattmossand then swine-connect tries to connect to localhost and fails.
20:15casioni had zero issue getting things working
20:16holoemezeske, heh, i think this settles it - lein cljsbuild once -> java.lang.Exception: lein-cljsbuild requires your project to specify which Clojure version it uses . thanks
20:16casionemacs 24 from brew, installed clojure-mode from the package manager
20:16emezeskeholo: cool!
20:16casioneverything working from no emacs to clojure in about 3 minuets
20:16mattmossI had it working before... but my machine shutdown un-cleanly once, and suddenly I'm missing some config or something is corrupt.
20:19xeqiholo: in this case you have a dependency chain of noir -> lib-noir -> clojure 1.4.0, so it downloads the pom
20:19xeqibut an earlier dependency on 1.3.0 takes precedence
20:19xeqiso it downloads the jar and uses that one
20:23holoxeqi, i see.. thanks so much for this useful info. huh, i think i will still take my chance with clojure 1.4 explicit in the project
20:25emezeskeI think it's generally good practice to be explicit about the clojure version
20:25casionanyone use paredit with clojure?
20:25xeqiyeah, if you put a 1.4.0 dep at the top thats what you should end up with
20:25xeqican verify with `lein deps :tree`
20:25casionI'm wondering how to surround with []
20:28technomancycasion: just mark the region and hit [
20:28casiontechnomancy: that's what I thought, but it's not working :|
20:28casionit is simply doing nothing
20:28technomancyare you using a slightly older version of nrepl.el?
20:29casionI believe I am
20:29technomancythe latest switches things around so clojure-mode's paredit adjustments apply; try upgrading
20:30casionok thank you
20:40jt360I've never really used tomcat before and now I'm going to attempt to use it for production on my noir app... is this basically as simple as apt-get install tomcat, then messing around with Lein-Ring settings until it works, or is it more complicated than that?
20:42hiredmangetting noir to work inside a war file (built by lein ring) is not just flipping a switch
20:43technomancyare you using tomcat in order to interoperate with some existing deployments, or for some other reason?
20:43jt360i'm new at all this, all I really want to do is get it to run on port 80 safely
20:44weavejesterI'd suggest running an embedded Jetty server on an unpriviliedged port, with nginx acting as a proxy.
20:44jt360ok cool, I've actually done that before with apache. Thanks!
20:45weavejesterApache can be used as a proxy too, but nginx is more lightweight (and faster, I think?)
20:46jt360yeah, i've been meaning to try on nginx in place of apache next time I needed it anyway
20:50technomancylooks like central's metadata.xml file was fixed some time today
20:50technomancyweavejester: hey, are you independent yet?
20:50weavejestertechnomancy: I am, yep!
20:50technomancycool; how's that going?
20:52holoxeqi, thanks!
20:53weavejestertechnomancy: Pretty good so far. I've got one contract signed already, and I'm working on a web app on the side. Nothing complex, but enough to give me some better understanding of how it works in production.
20:54technomancysure, good luck
20:55weavejesterThanks :)
21:26rabidsnailIn a macro how do I make sure that a symbol that gets passed in is qualified to the caller's namespace? e.g.: in (ns foo) (my-macro bar) gets #'foo/bar and not #'bar
21:28amalloyin general you shouldn't resolve the symbol at all
21:29rabidsnailI don't want to resolve it, I want to convert it to a string with the namespace attached
21:33casionI could use some help with understanding how to think functionally… I came up with fairly simple problem and I can't seem to solve it in clojure
21:33casionhttp://pastebin.com/Lmge9ESb
21:33casionsimply have those 2 'fight', remove damage at cooldown (assume a single unit of time), then print who won with how much remaining health
21:34casionif anyone has a moment could they talk me through it or write a demo?
21:34casionI can't seem to come up with a solution that doesnt liberally use swap!
21:37amalloysketch would look like (defn fight-to-death [a b] (drop-while (fn [fighters] (every? pos? (map :health fighters))) (iterate fight-one-round [a b]))), or similar
21:38casionhmm
21:39rabidsnailAnswered my own question: (defmacro my-macro [s] `(symbol (.toString *ns*) ~(.toString s)))
21:53casionamalloy: unfortunately that doesnt make sense to me :|
22:00tremolohaving a weird issue with compujure (1.1.1). If I have 2 routes with wrap-multipart-params, the params and multipart-params hashmaps are always empty for the second one
22:00tremolofirst one works fine
22:00tremolohas anyone seen this issue?
22:01tremolobasically the first route defined works but the second one does not
22:02tremoloif I remove the first one, the second one starts working
22:04amalloycasion: okay, so a working detailed solution: https://gist.github.com/3280677
22:06casionamalloy: thank you, I will look through it shortly
22:07amalloythe basic idea is that you don't need mutation, you just need a function that applies one round of battle, and you apply that function over and over recursively (via iterate) until you decide you're done
22:12xeqitremolo: my guess is :body is an InputStream and it can only be read once
22:12xeqiso the second wrap-multipart-params doesn't read any data, and sets them to {}
22:19muhoobest ascii art in clojure sourcecode, nomination: https://gist.github.com/2046375
22:21tremoloxeqi: thanks, that was the issue
22:52casionI can't figure this code out at all amalloy :(
23:02muhoothere is no can't. there is only haven't, yet. :-)
23:03casionIt's very frustrating :|
23:37PeregrineHmm light table helps shed some light on amalloy's code casion.
23:38uvtcCrafty pun there, Peregrine. :)
23:38PeregrineAlso taking the call to first out helps because then you see the entire list of results
23:38PeregrineLol it was unintentional.
23:38uvtc:)
23:44PeregrineIt's definitely some dense code though and takes some time to look into.
23:44PeregrineYay for light table and repl's.
23:45RaynesYay for misplaced apostophe's!
23:45uvtcI often put in the extra paren, myself. Ex. REPL's instead of REPLs.
23:45uvtc(for acronyms)