#clojure log - Aug 06 2012

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

0:12 _zach: _jak: http://www.marco.org/2012/07/25/siracusa-mountain-lion-review-review

0:13 Oops. Wrong channel, sorry about that :/.

1:02 brianpeiris: Why isn't (= (list '(1 2) '(3 4)) '('(1 2) '(3 4))) ?

1:08 emezeske: brianpeiris: Have you tried typing each of those into a REPL on it's own, to see what it evaluates to?

1:09 brianpeiris: Haven't tried that yet. (I'm using Light Table). Will try now.

1:13 Thanks emezeske. I see (quote (1 2) quote (3 4)) I think I understand better now.

1:14 emezeske: Great!

1:40 smswz: hi all, so I'm trying to install clojure, and the index for maven is failing

1:40 woops wrong channel

2:30 TEttinger2: has anyone here ever used HtmlUnit for testing webpages?

2:30 I am trying to call it from clojure

2:31 http://htmlunit.sourceforge.net/ I am having trouble either with library management or the namespace

2:32 in 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

2:33 "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

2:36 it might have to do with my classpath -- I am using Leiningen

2:55 firesofmay: Hi, anyone here ever used clj-webdriver (Selenium Library in clojure)? I am stuck with how to input text inside an iframe.

2:56 TEttinger2: firesofmay: I was just using that yesterday! I didn't get it to work.

2:56 firesofmay: TEttinger, I was trying this FAQ http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_How_do_I_type_into_a_contentEditable_iframe?

2:56 in clj-webdriver, it just does not work

2:57 ro_st: does it work in other webdrivers?

2:57 firesofmay: TEttinger, i can flash the iframe, but input doesn't work.

2:58 ro_st, I didn't try any other library

2:58 TEttinger2: I can't really help you there, I barely got the thing to run (did I even do that? I can't remember)

2:59 firesofmay: TEttinger, :( I am stuck with this things for days now. I tried asking in the google group of clj-webdriver, no replies.

3:06 TEttinger2: I'm stuck on some basic clojure-java interop stuff I think

3:12 noidi_: firesofmay, you could use find-element to find the IFrame, get the underlying WebElement object and then try using WebDriver directly

3:13 (class (:webelement (find-element {:css "h3"}))) ;= org.openqa.selenium.remote.RemoteWebElement

3:14 so something like (-> (find-element ...) :web-element (.sendKeys "foobar"))

3:15 oops, I only skimmed the WebDriver docs. you'd probably have to obtain the element via the driver instead of find-element.

3:15 firesofmay: noidi_, what is ":web-element here"

3:16 noidi_, ohkay

3:17 noidi_, (flash (find-element {:tag :iframe})) with this i can see text-area flashing inside iframe

3:17 noidi_, i am not sure how to enter text inside it

3:18 noidi_: 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*)

3:21 firesofmay, here's a quick (and untested) clj-webdriver translation of the example in the selenium FAQ: https://gist.github.com/23130a526bc8bdd400c7

3:21 firesofmay: noidi_, Okay checking

3:25 noidi_, my frame has no name. Check this https://gist.github.com/4227967f9e19623f31a6

3:26 noidi_, what do I put instead of "foo"?

3:27 noidi_: firesofmay, you could use ".text-editor #iframe" as the selector

3:27 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

3:30 firesofmay: noidi_, (switch-to-frame ".text-editor #iframe") does not work

3:30 it can't find the frame

3:31 noidi_: drop the hash

3:31 ".text-editor iframe"

3:31 firesofmay: noidi_, "Unable to locate frame: .text-editor iframe"

3:31 for (switch-to-frame ".text-editor iframe")

3:32 noidi_: is that the only iframe on the page? you could try just plain "iframe"

3:34 firesofmay: noidi_, nope still fails but this works ->

3:34 babysnakes: hi, 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)?

3:34 firesofmay: noidi_, https://gist.github.com/72adedd117dbf13f64bc

3:34 noidi_, but using this i unable to select the iframe

3:35 i am*

3:37 noidi_: firesofmay, try (switch-to-frame 0)

3:37 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

3:39 I gave it a try and it seemed to work

3:39 firesofmay: noidi_, that worked :D

3:39 noidi_: yay \o/

3:39 firesofmay: noidi_, wait let me try again from scratch just to make sure ;)

3:41 TEttinger2: noidi_, you probably have encountered some errors with clojure/java classpath stuff in the past right?

3:42 noidi_: TEttinger2, I think everyone has :)

3:42 firesofmay: noidi_, dude you are awesome! :D

3:42 noidi_: firesofmay, glad to help :)

3:43 firesofmay: noidi_, i'll post this script in the group so that others can use it to later :D

3:43 TEttinger2: http://pastebin.com/kjTjRyT0

3:43 firesofmay: noidi_, man you saved me so many hours :D

3:44 TEttinger2: noidi_, do you maybe recognize the top error? I have looked and neither of those exist, but WebClient.class does

3:44 noidi_: firesofmay, yeah a fresh pair of eyes can do wonders when you're stuck and running in circles

3:44 ifesdjeen: firesofmay: could you paste the script here, too? :)

3:44 probably i joined after you guys pasted it first time

3:45 noidi_: TEttinger2, you are probably trying to use one of clojure's namespace-referencing functions when you want to import a java class

3:46 TEttinger2: ah, yes

3:46 noidi_: TEttinger2, if you have something like (ns foobar (require com.argoylesoftware.htmlunit.WebClient)) in your source, change the require/use/whatever to import

3:46 firesofmay: noidi_, https://gist.github.com/3271980 :)

3:46 TEttinger2: uh actually it is in an ns :import [ com.gargoylesoftware.htmlunit.WebClient] block

3:47 oh! no!

3:47 it is in :use !

3:47 djcoin: firesofmay: noidi_, which lib are you using for this ?

3:47 firesofmay: djcoin, https://github.com/semperos/clj-webdriver/wiki/Introduction%3A-Taxi

3:48 clj-webdriver, Taxi API

3:48 djcoin: Thanks !

3:49 noidi_: firesofmay, btw. I think the last line could be (click "button['type=submit']"). slightly cleaner, imo :)

3:49 firesofmay: noidi_, checking

3:49 noidi_: oops, I meant "button[type='submit']"

3:51 djcoin: Do you use this for testing, js/html ?

3:52 I wonder if there is some work with clojure-script or phantomjs

3:52 firesofmay: noidi_, does not work. doesnt select the button for some reason

3:52 ro_st: djcoin: cljsbuild has an advanced example which has phantomjs stuff preconfigured

3:53 turn-key config to start writing code and tests in cljs and running them on phantom

3:53 firesofmay: djcoin, its for browser testing. Its a wrapper around the Selenium-Webdriver framework

3:55 noidi_, https://github.com/semperos/clj-webdriver/wiki/Snippets :)

3:58 noidi_: =)

4:25 edge86: Why is this returning true for all 3 elements? I would expect (true false false).

4:25 (map #(contains? % 1) [[1, 2], [2, 3], [3, 4]])

4:26 ejackson: ,(doc contains?)

4:26 clojurebot: "([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'."

4:27 ejackson: admittedly tricky, contains? checks the keys, which for vectors are the indices

4:27 edge86: aww man, I had just looked at the docs, too.

4:27 Anyway, thanks!

4:40 TEttinger2: Raynes, do you remember how to get lazybot to auto-announce the titles of links?

5:33 otfrom: morning

5:36 augustl: I'm using [boolean "string with results"] a lot, where the boolean tells me whether the result is an error message or the actual result

5:36 are there any data abstractions I should use that makes this cleaner?

5:43 stain: do you mean exceptions?

5:44 or you want to allow say a map to return some values and some errors?

5:44 augustl: it's not for exceptions

5:45 in this particular case, it's a function that compiles javascript with the Google Closure Compiler

5:45 if 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.

5:46 so 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

5:46 stain: in 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

5:47 augustl: I'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

5:47 stain: so you mean you could just ignore the error and execute that error-message code, it should still be "ok"

5:48 it's some code as a placeholder for what the caller really wanted

5:48 so it's a valid result.. just not the one he wanted

5:48 augustl: yeah

5:48 stain: if 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.

5:48 augustl: in both cases you get a string of JS

5:49 stain: but fo ryou perhaps :code could work

5:49 the boolean is not very extensible

5:49 augustl: perhaps a map is better, it's a little less magic :)

5:49 {:js "..." :failed true}

5:49 stain: yeah, then you could put in extra bits about how it failed

5:49 :lineno etc

5:49 ro_st: is there a way to get *sldb cloure/NNN* buffers to wrap their text in emacs?

6:05 kral: namaste

6:37 nkkarthik: In nrepl.el I keep getting this error? http://paste.debian.net/182339/

6:37 as soon as I switch to the nrepl buffer

6:37 any clue?

8:36 ro_st: clojars' database is down

8:36 ohpauleez: ro_st: Did you get a chance to try the pubsub?

8:37 Both the simple and the event bus are working for me

8:37 ro_st: i did, but due to the version number not increasing on the dep, i couldn't load the new version into my project

8:37 or did i misunderstand how that works :-)

8:38 ohpauleez: -SNAPSHOT should pull the latest

8:38 but it's also sitting in the demo app

8:38 ro_st: argh. how do i get https://github.com/clojure/math.numeric-tower/ into my project?

8:38 ohpauleez: (in /src/

8:38 ro_st: i tried [math.numeric-tower "0.0.2-SNAPSHOT"] in project.clj

8:39 and [org.clojure/math.numeric-tower "0.0.2-SNAPSHOT"]

8:39 ok ohpauleez, i'll give it another try

8:39 ohpauleez: nvm, that was going to be my guess

8:39 ro_st: i'm just busy trying to round a bloody fraction in clojure and it turns out i need a library for that :p

8:40 ohpauleez: ro_st: Are you specifically avoiding floating point?

8:41 ro_st: the fractions are coming at me from (/ 1 2)

8:41 ohpauleez: &(quot 1 2)

8:41 lazybot: ⇒ 0

8:41 ohpauleez: &(quot 1.0 2.0)

8:41 lazybot: ⇒ 0.0

8:43 ohpauleez: &(Math/ceil (/ 1 2))

8:43 lazybot: ⇒ 1.0

8:43 ro_st: &(Math/round 1/30)

8:43 lazybot: java.lang.IllegalArgumentException: No matching method found: round

8:43 ro_st: that's the issue i had. i casted my fraction to a double, now it works

8:48 ohpauleez: For completeness for the logs

8:48 &(Math/round (double (/ 1 2)))

8:48 lazybot: ⇒ 1

9:01 ro_st: ohpauleez: when do you use the evented bus and when do you use the simple bus? just curious how you're using each

9:02 ohpauleez: ro_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

9:02 evented bus is slower, but non-blocking

9:03 simple bus is fast but synchronous

9:03 ro_st: cool. just curious where you're using the evented one

9:03 what the use case there was

9:04 ohpauleez: ro_st: Well, ClojureDev has been looking for solutions to Functional Reactive Programming - which needs to be async

9:04 so I made an async bus

9:04 :)

9:05 ro_st: interesting

9:13 noidi_: 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?

9:14 hyPiRion: noidi_: Indeed

9:20 for instance, ##(let [a 18014398509481980] (= (Math/round (double (/ (+ a a -1) 2))) a))

9:20 lazybot: ⇒ true

9:21 pandeiro: does (doto x (.form1 ...) (.form2 ...)) pass x or the return val of (.form1 ...) to (.form 2 ...) ?

9:21 ohpauleez: x

9:22 if you want the return form, you can use the threading macro: ->

9:22 return val*

9:22 hyPiRion: (doto x (.form1 ...) (.form2 ...)) = (let [foo x] (.form1 x ...) (.form2 x ...) x)

9:23 pandeiro: ah sure, great

9:52 Frozenlock: Unrelated question: Given a unicode symbol, is there a way to find a font compatible with it? For example I can't see this one: ⚙

9:54 edw: Do you have OS X? The Character Viewer panel is very handy for that problem.

9:55 Frozenlock: No... Currently Win7, Ubuntu when I'll get home

9:56 ro_st: win7 has Character Map

9:59 Frozenlock: I need to check all of them until I see something?

10:02 twhume: How 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:05 mdeboard: ##(doc symbol)

10:05 lazybot: ⇒ "([name] [ns name]); Returns a Symbol with the given namespace and name."

10:05 twhume: Thanks!

10:09 babyclj: Hi guys, quick newbie question -- how do I parse a long string, split by newline?

10:10 mdeboard: You mean split at new lines or what

10:10 babyclj: (string/split long-text #{\n} ) doesn't really work

10:10 yeah new line \n

10:10 mdeboard: clojure.string/split-lines

10:10 ##(clojure.string/split-lines)

10:10 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: string$split-lines

10:10 mdeboard: ##(doc clojure.string/split-lines)

10:10 lazybot: ⇒ "([s]); Splits s on \\n or \\r\\n."

10:11 babyclj: Yes! thanks

10:11 :-)

10:20 cemerick: FYI: 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:23 arkh: cemerick: what do the lighter/darker shades of color mean in the bar charts?

10:24 cemerick: arkh: Nothing; they are, AFAICT, some artifact of google docs' rendering of spreadsheet data.

10:25 otfrom: cemerick: just having a read now.

10:26 arkh: cemerick: I was hoping it would be year-over-year changes or something ; ) Thank you for the survey + report

10:27 cemerick: ah, unfortunately not

10:27 I'd love to be able to easily chart year over year changes, but that'll have to fall to someone else.

10:27 casion: i feel surprised by all the previous java users

10:27 even though it seems obvious

10:27 cemerick: arkh: sounds like something you could take on ;-)

10:28 arkh: *ducks*

10:28 mdeboard: does Clojure CLR have C# interop?

10:29 or what

10:29 ro_st: you mean .net library interop

10:29 casion: mdeboard: CLR

10:29 mdeboard: Yeah I guess, I have no idea really

10:29 All I nkow is that we have some C# in production here

10:29 I'm generally clueless about the platform

10:29 (am looking at the survey results)

10:30 I'm so happy about the results of the clojure-py adoption

10:30 cemerick: mdeboard: of course, e.g. https://github.com/clojure/clojure-clr/blob/master/Clojure/Clojure.Source/clojure/clr/io.clj#L368

10:30 mdeboard: :o

10:30 casion: there's a clojure-scheme?!

10:30 I.. uh what?

10:30 hyPiRion: there's a clojure-c

10:31 casion: I know about clojure-c, I've used it

10:31 hyPiRion: there are a lot of clojures around.

10:31 casion: Is it nice?

10:31 casion: hyPiRion: eh…

10:32 I dont feel I know enough about clojure to comment very authoritatively

10:32 hyPiRion: As in - is it troublesome to get it up and running, or is it a hassle?

10:32 casion: but as a c programmer, I thought it was shit heh

10:32 so I could be entirely wrong and it's fantastic

10:32 it was easy to get working

10:32 cemerick: All of the variants are *very* new, so there's going to be rough edges.

10:33 hyPiRion: 'kay, guess I'll peek into it.

10:33 casion: i didnt really get the point of it honestly

10:33 scriptor: casion: so you wouldn't be tied to the jvm

10:33 faster startup, at least

10:33 hyPiRion: yeah.

10:33 casion: scriptor: that's all I could figure

10:33 hyPiRion: Well, for compiled scripts.

10:33 casion: but you may as well use scheme then?

10:34 scriptor: what if you prefer clojure over scheme?

10:34 hyPiRion: That's like saying you may as well use C++ instead of C ;)

10:34 cemerick: casion: just because something has parens doesn't mean it's sufficient ;-)

10:34 casion: it was a question, not a statement :)

10:34 a badly phrased one, but I did get the ? in there

10:35 pjstadig: it's one thing to add persistent data structures and reference types to an existing language

10:35 hyPiRion: But sure thing - if startup time is important, CLisp or Scheme is a way to go.

10:35 pjstadig: it's another to have clojure

10:35 mdeboard: cemerick: Just showed my coworker Clojure CLR, he was blown away. I am too, I had no idea.

10:35 hyPiRion: But for me, the only negative thing is the startup time and the hard dependency on the jvm

10:36 casion: hyPiRion: well, personally, I started with clojure because of the dependecy on the jvm

10:37 hyPiRion: casion: 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:37 Especially for small scripts I want to start up and shut down - as I'm currently doing at work.

10:37 cemerick: mdeboard: I'm the the ClojureCLR contributors would love to hear your enthusiasm ;-)

10:37 casion: hyPiRion: I came from embedded c/asm… so the portability of the jvm and number of excellent java ilbs is infinitely attractive to me

10:38 in 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:38 cemerick: mdeboard: "I'm sure", that is.

10:39 mdeboard: cemerick: 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:39 although mono is pretty awesome

10:39 casion: I would be pretty happy with a cocoa clojure, but I suspect that's out of the question hehe

10:40 lucian: i'm really looking forward to clojurescript being self-hosted, or CinC or w/e

10:40 casion: that may not be all that far off, there's a clojurec dialect for clojurescript

10:40 casion: casion: yeah, I know

10:40 cemerick: casion: https://github.com/joshaber/clojurem

10:41 casion: cemerick: github isnt working for me atm for some reason, what is it?

10:41 cemerick: though I think clojure-scheme and clojurec are both aiming to target iOS at some point?

10:41 casion: link to a clojure impl targeting objc

10:41 casion: oh oh!

10:41 what is this sorcery

10:41 cemerick: mdeboard: ah, well, then I guess you're one more data point re: CLR being a non-entity in general

10:41 dgrnbrg: Hey, 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:42 casion: why the hell won't github load, this is bothersome

10:42 mdeboard: cemerick: It's too bad Windows Server is so, so awful, because C# is a good language.

10:43 Is David Miller the StrangeLoop guy?

10:44 rbarraud: Mdeboard: is mono evil?

10:44 mdeboard: oh, that's Alex Miller

10:44 rbarraud: :-)

10:44 mdeboard: rbarraud: Was that a The Gunslinger reference?

10:44 rbarraud: Norman Mailer?

10:44 mdeboard: Blain the Mono

10:45 if so, wow

10:45 if not, huh?

10:45 rbarraud: Heh... Not seen the gunslinger

10:45 mdeboard: book series by Stephen King

10:45 nDuff: dgrnbrg: There's korma, if you want a layer of sugar on top of SQL

10:45 rbarraud: Mono is .net on *nix

10:45 nDuff: dgrnbrg: ...for a non-SQL-ish datastore, there are plenty of options, but I'm not familiar enough to suggest between them.

10:46 dgrnbrg: nDuff: my biggest question is what to do about multi-kbyte keys

10:46 * nDuff doesn't consider mono evil -- it does what it says on the tin.

10:46 mdeboard: rbarraud: 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:46 pyykkis: dgrnbrg: monger is quite nice for mongodb http://clojuremongodb.info/

10:47 casion: clojurem looks fantastically useful to me

10:47 rbarraud: I've heard people complain about it in the past

10:47 casion: thanks cemerick :)

10:47 rbarraud: And wonder about its long term viability / M$chrushability

10:47 mdeboard: rbarraud: 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:48 rbarraud: Of course it misses all the MS GUI stuff, right.

10:48 nDuff: dgrnbrg: 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:48 rbarraud: ...ehh, it has _some_ of the GUI bits; they're getting better, slowly.

10:48 mdeboard: rbarraud: I guess, I dunnow hat MS GUI stuff you're talking about so

10:48 cemerick: casion: :-) I only heard about it myself a few days ago. Make noise if it works well for you.

10:49 casion: cemerick: there will be much noise if I get it running and it works

10:49 rbarraud: :-)

10:49 casion: I know about 40 people who would instantly fall in love with this

10:51 rbarraud: Heheh... That's a creakily cute mascot thingy ;-)

10:51 Is it a bird, is it a plane, ....

10:51 Lmao

10:51 Thanks for pointing it up demerits

10:52 I feel privileged to be talking with you.

10:52 Now I should

10:52 A) go to sleep since its 2:51am

10:52 B) STFU and read your book which I jus bought the other day :-)

10:52 ro_st: C) stop making lists?

10:53 (because it's close to 3am :-) )

10:53 casion: stop making lists in the clojure channel?

10:53 rbarraud: ;-)

10:53 casion: surely you jest :P

10:53 rbarraud: Lol

10:53 Nite peeps

10:53 MSL FTW! :-)

10:58 casion: well, that was fun as usual

11:00 uvtc: What *was* that?

11:00 casion: net split

11:00 uvtc: irc server needed to step out for a bit of fresh air?

11:05 antares_: dgrnbrg: take a look at clojurewerkz.org for data stores, plus clojure.java.jdbc and sqlkorma.com

11:28 TimMc: uvtc: If that's a euphemism for a "smoke break", then yes. :-)

11:29 ohpauleez: That's the second time it's happened in the past three-ish days

11:33 djpowell: any korma know

11:33 mdeboard: ohpauleez: netsplits are just a part of life on irc

11:33 djpowell: gah... any korma knowledge?

11:33 casion: part of life on bad IRC servers

11:33 of which freenode happens to be one

11:33 ohpauleez: mdeboard: true true

11:34 mdeboard: I've used IRC for years, never had a network (which is what freenode is, not a server) that was netsplit-free

11:34 djpowell: sql server requires subqueries to be given an alias. anyone know how to do this in korma?

11:35 mdeboard: djpowell: No idea, sorry. It may be something you have to roll for yourself

11:39 djpowell: ah. got it. just throwing a vector and an alias around the subselect works

11:39 melipone: how can I find how many keys in a hash-map?

11:39 djpowell: count

11:40 melipone: `(count {:a 3, :b 4})

11:41 how can I invoke the eval bot here

11:41 uvtc: &(pr "like this")

11:41 lazybot: ⇒ "like this"nil

11:41 ohpauleez: ,(count {:a 1, :b 2})

11:41 uvtc: ,(pr "or this")

11:41 clojurebot: 2

11:41 "or this"

11:41 melipone: ,(count {:a 1, :b 2})

11:41 uvtc: I've seen ##(pr "this too though")

11:41 clojurebot: 2

11:41 lazybot: ⇒ "this too though"nil

11:42 djpowell: ,(+4 3)

11:42 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

11:45 mdeboard: ##(doc defn)

11:45 lazybot: ⇒ "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:47 TimMc: ## is for middle-of-msg eval. It doesn't trigger on as many forms, though.

11:50 mdeboard: wut

11:51 TimMc: For example ##3 doesn't but ##[3] should

11:51 lazybot: ⇒ [3]

11:53 mdeboard: ##"foo"

11:54 ##'("foo")

11:54 lazybot: ⇒ ("foo")

11:54 mdeboard: Java literals don't, apparently

11:54 ##Integer

11:54 meenal: Hi, is there a "continue" keyword in clojure?

11:54 mdeboard: meenal: like, to continue in a loop without evaluating?

11:55 meenal: yes mdeboard

11:55 S11001001: meenal: it's called recur, and you can only use it where it makes sense

11:55 meenal: if at all possible try to avoid writing loops though

11:56 meenal: i was trying to loop through a hashmap, and populating a stringbuffer

11:56 when a condition is met, i want to continue in a loop, without evaluating

11:56 S11001001: right, here's a better solution: (apply str (map (fn [[k v]] make-a-string-here) hashmap))

11:57 mdeboard: meenal: Filter out the values you don't want first

11:57 (which is why I assume you want the continue)

11:57 S11001001: meenal: loops are bad, seq functions are good

11:57 TimMc: and reductions are even better

11:57 *reducers

11:57 mdeboard: monads*

11:58 TimMc: heh

11:58 mdeboard: (I don't actually know what a monad is)

11:58 gfredericks: ~monad

11:58 clojurebot: monad is #<RuntimeException java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "=" at line 1, column 38.>

11:58 gfredericks: ~monad

11:58 clojurebot: monad 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:58 gfredericks: ~monad

11:58 clojurebot: monad 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:58 gfredericks: okay that's sufficient

11:58 meenal: is doseq bad too?

11:59 gfredericks: if you don't need side effects

11:59 S11001001: not as bad as loop/recur, but not as good as the other options we've mentioned

12:00 scriptor: meenal: 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:00 meenal: i do something different and skip it

12:00 S11001001: what's "do"?

12:01 mdeboard: It's used in --

12:01 oh

12:01 ##(do)

12:01 lazybot: ⇒ nil

12:01 mdeboard: ##(doc do)

12:01 lazybot: ⇒ "Special: do; Evaluates the expressions in order and returns the value of\n the last. If no expressions are supplied, returns nil."

12:01 mdeboard: :P

12:02 bryanl: I'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:02 meenal: in 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:02 S11001001: mdeboard: ha. ha.

12:03 meenal: this is what i meant by "do something different"

12:03 S11001001: mapcat then

12:04 jkkramer: bryancp: (update-in m ["20"] dissoc :age)

12:04 S11001001: (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:05 meenal: okay.. let me try that and see.. thank you

12:06 bryanl: jkkramer: i was going to use update-in. But the key is not always "20"

12:06 jkkramer: i'm looking for a way to tell update-in to use all the keys

12:08 jkkramer: bryanl: (reduce (fn [m [k subm]] (assoc m k (dissoc subm :age))) {} m) ?

12:09 bryanl: jkkramer: thank you

12:17 mdeboard: great post on HN about Clojure http://news.ycombinator.com/item?id=4345689

12:17 pzol: If 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:18 S11001001: pzol: I would use the existing clojure.math.combinatorics library :)

12:19 pzol: S11001001 :) ok, but for the sake of how to do it best…

12:23 mdeboard: parametric polymorphism ~= type dispatch

12:23 ?

13:05 uvtc: Hi #clojure. Regarding solving the related problems of (A) "What library should I use to do $x?", and

13:05 (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:05 I've been thinking that this might be useful: https://github.com/uvtc/clojure-dining-car

13:05 View it rendered with a table of contents at http://unexpected-vortices.com/clojure/dining-car.html

13:05 It's still very bare.

13:05 And it needs a graphic of a dining car. :)

13:05 I 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:06 or to adequately spec out the hierarchy.

13:08 scriptor: I'd add a github link as well as a clojars link

13:08 TimMc: +1

13:08 scriptor: to select a library, they'd have to learn a little about it first :)

13:08 uvtc: The Clojar page contains the github link.

13:09 scriptor: not always, for example https://clojars.org/clojurewerkz/neocons

13:09 uvtc: scriptor: Yes, that's true. I'd hope that there could be *some* pithy comments following each entry there.

13:10 If 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:10 scriptor: ah, got it

13:11 zerokarmaleft: cemerick: percentiles don't add up for your cljs environments chart

13:11 technomancy: zerokarmaleft: it was a multiple choice question, so that's expected

13:11 cemerick: zerokarmaleft: "Note: Any question with results that sum to more than 100% allowed respondents to select more than one response."

13:11 zerokarmaleft: ah, my bad

13:12 heh, i think i asked you to change some of those questions to multiple response questions also, derp

13:13 uvtc: scriptor: filed a bug with Neocons about the missing :url option.

13:13 solussd: anyone 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:17 uvtc: oops. 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:18 solussd: ack! maven clojure version is 1.2? http://repo.maven.apache.org/maven2/org/clojure/clojure/maven-metadata.xml

13:19 seancorfield: solussd: all versions are there http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22clojure%22

13:20 solussd: well 'lein reps' is failing for me, presumably b/c that manifest file points to clojure 1.2 as the latest version

13:21 or not.. idk. I'm taking stabs at this

13:22 seancorfield: lein reps? or lein deps? which version of lein? what is in your project.clj?

13:22 solussd: * deps

13:22 mountain lion autocorrect fail

13:24 technomancy: bleaugh, another central screwup?

13:25 solussd: seancorfield: my deps: https://www.refheap.com/paste/df55aa9e01dd90de1288b8783

13:26 technomancy: they're all still there: http://repo.maven.apache.org/maven2/org/clojure/clojure/

13:26 someone just screwed up the metadata file

13:27 solussd: yay! it's not me. :)

13:27 technomancy: solussd: are you getting this from the US?

13:27 solussd: technomancy: yes

13:28 seancorfield: with those deps, both lein1 deps and lein2 deps work for me

13:28 technomancy: is 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:28 seancorfield: that's because your ~/.m2 cache is populated

13:29 solussd: I noticed after adding deps

13:29 seancorfield: ah, i'd better not clean my cache out then :)

13:30 technomancy: hrm; all the brits I know aren't present

13:30 seancorfield: sorry, you don't count since you live in the US

13:31 last time this happened the central guys asked me to check if the problem was specific to either the US or UK mirrors

13:31 ohpauleez: technomancy: Is there any document explaining how the dependency mechanism works in lein2?

13:33 technomancy: ohpauleez: not really, but all the docs covering Maven should apply

13:33 the main difference would be that Leiningen uses profiles instead of scopes; those are not specific to dependencies, but they're pretty well documented

13:34 seancorfield: technomancy: 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:34 technomancy: seancorfield: but... the accent!

13:34 xeqi: ohpauleez: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Transitive_Dependencies works if you ignore the scope stuff

13:35 ohpauleez: technomancy: Cool. Specifically, I'm curious how deps get tracked/referenced in lein2 vs lein1 (with ./lib) - I'll dig around. I appreciate it

13:35 xeqi: Thank you

13:36 xeqi: Can you link me one more time

13:36 xeqi: ohpauleez: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Transitive_Dependencies works if you ignore the scope stuff

13:36 ohpauleez: thanks!

13:36 technomancy: ohpauleez: 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:37 hrm; it occurs to me that making `lein deploy` work with a pom+jar combo on disk would help a lot there.

13:37 ohpauleez: technomancy: most certainly

13:38 Previously when I was just trying some changes out, I would just drop a jar in a test-project's ./lib and go

13:39 I'm trying to find the shorthand for doing that with lein2 without having the weird system wide inconsistencies

13:39 technomancy: is the jar from a leiningen project or just some random jar?

13:39 ohpauleez: lein

13:39 technomancy: ohpauleez: ok, just do `lein install` to make it available locally and `lein deploy` to make it available to your team

13:40 ohpauleez: also see the "checkouts" feature to make it more convenient

13:40 ohpauleez: cool, maybe checkout is what I'm looking for. `lein install` goes to .m2, no? - that's the piece I'm missing

13:41 technomancy: yep

13:41 ohpauleez: right, I want to avoid that if possible

13:41 technomancy: checkouts make it a bit more convenient once you've got it working with `lein install`

13:42 ned: hi folks

13:43 ohpauleez: technomancy: Thank you, I think what I'm looking for is something like checkouts

13:57 solussd: hm, 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:58 i miss my repl. :(

14:06 puredanger: so, 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:06 be a slam dunk answer for this in Clojure by now.

14:29 ebaxt: Has anyone else experienced problems loading transitive depenencies for noir 1.2.x?

14:29 downloading that is..

14:58 michaelr`: hello

15:00 uvtc: hi, michaelr`.

15:00 foodoo: greetings michaelr

15:01 michaelr`: wow it's a crowded night with lot's of friendly people :)

15:02 SegFaultAX|work2: It's actually been pretty dead in here all morning.

15:02 At least since I got into the office at 9ish.

15:02 foodoo: and then /you/ showed up ;)

15:02 michaelr`: haha

15:02 SegFaultAX|work2: ... wait a minute, are you saying that... :'(

15:04 foodoo: hm. A minute is over now. Why are you sad?

15:05 SegFaultAX|work2: Did you guys checkout cemerick's post on his survey results? Pretty interesting read if you haven't.

15:05 foodoo: link?

15:05 clojurebot: your link is dead

15:05 SegFaultAX|work2: http://cemerick.com/2012/08/06/results-of-the-2012-state-of-clojure-survey/

15:06 naeg: as I'm very new to clojure, I'm also very excited about those results

15:06 didn't know that almost no one uses the CLR

15:08 SegFaultAX|work2: naeg: ... for clojure.

15:08 naeg: yeah, I meant it like that

15:09 foodoo: I guess a lot of people are satisfied with what Clojure provides itself + a few extras from Java land

15:10 uvtc: I found it somewhat interesting that --- aside from Java --- a lot of users came from Python & Ruby, but not from Perl.

15:10 ibdknox: still have a lot to do

15:10 :)

15:10 naeg: I assume many clojure programmers do have a java background?

15:10 foodoo: I'm not sure if that's the case. I have a rather broad background (which also includes Java)

15:11 SegFaultAX|work2: naeg: If that survey is anything to go by they do.

15:12 antares_: naeg: according to the survey and my own anecdotal evidence, as many come from Java as from Ruby/Python

15:12 miloshadzic: uvtc: my guess is that most of the perl guys migrated to ruby or python first

15:13 SegFaultAX|work2: Well IIRC the question was something like "what language did you come from /right before/ clojure?"

15:13 uvtc: miloshadzic: 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:14 foodoo: I 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:14 naeg: "What language did you use prior to adopting Clojure [...]?"

15:14 SegFaultAX|work2: The 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:14 hiredman: "english"

15:14 duck11232: less perl users self identify as perl users

15:14 SegFaultAX|work2: What duck11232 said. I fall into that boat as well.

15:15 uvtc: foodoo: Perl 5 gets used a lot behind the scenes.

15:15 duck1123: Sounds right.

15:16 foodoo: uvtc: thanks for clarifying that

15:16 uvtc: I'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:17 naeg: I'm sure you can ask him to include this in his next survey

15:17 SegFaultAX|work2: "If you have Java experience, did you have a mental breakdown before you found Clojure?"

15:17 naeg: sounds interesting to me too

15:18 foodoo: uvtc: I came back to the JVM because of Clojure. Haven't used Java for quite a while

15:27 Roxxi: What were you using before you came back to the JVM, foodoo?

15:28 uvtc: I bet foodoo 's experience is fairly common.

15:29 foodoo: Roxxi: mostly Python. But also various other languages

15:30 uvtc: er. s/experience/path/ ... fairly common among Clojurers anyhow.

15:37 foodoo: cemerick'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:38 uvtc: The cheatsheets with tooltips help a lot with that, IMO: http://jafingerhut.github.com/

15:38 ~cheatsheets

15:38 clojurebot: Titim gan ?ir? ort.

15:38 foodoo: Maybe 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:38 uvtc: ~cheatsheet

15:38 clojurebot: Cheatsheets with tooltips can be found at http://jafingerhut.github.com/ .

15:38 hiredman: foodoo: clojure.org has that

15:38 joly: clojuredocs.org has been pretty helpful

15:38 hiredman: the #1 problem with documentation is people don't read it, and complain that it doesn't exist

15:39 uvtc: Oh, neat. The cheatsheet at clojure.org http://clojure.org/cheatsheet actually has a link at the bottom to the ones with the tooltips.

15:39 hiredman: http://clojure.org/namespaces <-- namespace functions http://clojure.org/sequences <-- sequence functions, etc

15:40 foodoo: sure, these cheatsheets are neat, but the official documentation doesn't link to them. (Or have I overlooked something?)

15:41 ah, there it is *facepalms*

15:41 hiredman: http://clojure.org/ has a list of links under "reference"

15:41 amalloy: foodoo: perhaps you've missed the URL bar? the clojure.org in there seems to indicate that it's official documentation

15:41 seancorfield: perl... i don't think i've used perl in a decade...

15:41 when i was at macromedia, our build/deploy script was perl...

15:41 about 1,000 lines... i had to maintain it for a while... ugh! :(

15:52 puredanger: I think I might actually owe Andy an update of the clojure.org cheat sheet with the tool tipped version, can't remember now

15:55 guns: Is there a function that will expand shell globs like: {~guns,~foo}/bar/**/*.baz

15:56 Or at least do tilde expansion?

15:57 amalloy: i'm pretty sure that function is your shell

15:57 duck11231: guns: if there is anything, it's probably part of or used by pallet

15:57 guns: duck11231: Okay, will check it out

15:59 hugod: guns: nothing directly in pallet for that - though you could shell out to a ls for a quick hack

15:59 amalloy: hugod: nooooo, not ls. echo

15:59 guns: hugod: ah. It's not important. Just spoiled by Ruby's Dir.glov

15:59 *Dir.glob

16:01 hugod: amalloy: that would be better, indeed

16:01 nDuff: *shudder* (re: "shell out to ls")

16:02 ...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:03 printf '%s\0' your_glob_here <- safer approach (requires handling null-delimited output)

16:04 uvtc: guns: maybe something in https://github.com/Raynes/fs or https://github.com/flatland/useful ?

16:05 guns: nDuff: You'd still have to parse the output. find -print0 is ultimately most appropriate for shelling out imo

16:05 uvtc: Thanks for the links

16:06 uvtc: guns: You're welcome. I added them to {cough} ... the Dining Car. (!)

16:06 amalloy: uvtc: 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:06 nDuff: guns: Pardon? Output from the printf approach and from find -print0 would be identical

16:06 uvtc: amalloy: right-e-o. :)

16:07 nDuff: guns: ...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:07 guns: nDuff: oh, right printf '%s\0' in a list

16:07 uvtc: amalloy: feature request for `useful`: A readme. :P

16:07 :)

16:07 mattmoss: Anyone using VimClojure? If so, do agent watches work for you?

16:08 guns: nDuff: no argument about ls. that's a horrible practice

16:08 naeg: ibdknox: according to the survey some already use lighttable - is it that usable already?

16:09 Raynes: Nope.

16:09 amalloy: fs has globbing, iirc.

16:10 amalloy: ugh. if it does, it probably shouldn't

16:10 but that's your project; as long as it's not in useful

16:10 ibdknox: naeg: it's a full replacement for a repl :)

16:11 Raynes: amalloy: 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:11 ibdknox: the next update should make it a capable clojure env

16:11 Raynes: ibdknox: <3!

16:11 naeg: ibdknox: 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:12 guns: amalloy: I'm curious about your dislike of libs emulating shell functions

16:12 cpinera: Hi 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:14 ohpauleez: mattmoss: The agents won't work

16:14 the repl ins't a real repl

16:14 ibdknox: naeg: everything is the playground for now

16:14 ohpauleez: it's just a buffer that has special commands to send via Nailgun, but it's not truly interactive

16:14 ibdknox: Raynes: hey dude :)

16:14 amalloy: guns: there are an infinite number of shells, which all glob differently

16:14 ohpauleez: it just does call/response pairs

16:14 amalloy: if a clojure function pretends to do one of them, it will fail unexpectedly on other platforms

16:14 guns: amalloy: POSIX sh?

16:14 mdeboard: puredanger: Are you any relation to the David Miller who maintains ClojureCLR?

16:15 hiredman: doesn't exist

16:15 puredanger: mdeboard: nope :)

16:15 guns: I guess you're right. I'll make sure to call any functions I write bash-expand, etc

16:15 ohpauleez: mattmoss: What you can do is use lein-tarsier and have it start a connected REPL

16:16 amalloy: guns: 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:16 mattmoss: ohpauleez: I'm using lein-tarsier to start up nailgun.

16:16 ohpauleez: this 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:16 uvtc: guns: what is bash-expand?

16:16 nDuff: POSIX 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:17 amalloy: (at least then the platform-dependency i'm creating is explicit)

16:17 ohpauleez: mattmoss: in your profiles.clj -> :vimclojure-opts {:repl true} ;; for lein-tarsier

16:18 guns: amalloy: that's sensible, but you then have a dependency on the bash version. bash4 is a world of difference from bash2 for instance

16:18 uvtc: amalloy: to shell out to bash, do you mean by using Raynes's conch, or clojure.java.shell?

16:18 amalloy: don't see why that matters, uvtc

16:19 Raynes: Conch is the sexy, so assume he always means conch.

16:19 uvtc: amalloy: I'm asking how to do it.

16:19 amalloy: i'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:19 uvtc: amalloy: (was worded poorly. Sorry. :) )

16:20 mattmoss: ohpauleez: ok, thanks... that helps.

16:20 Raynes: amalloy: That's true. I was mostly kidding. I don't tell people to use conch until they actually need it.

16:20 ohpauleez: mattmoss: totally welcome - it's the best solution I've found to that situation

16:20 Raynes: amalloy: Though I could in probably 4 lines add the same abstraction in conch that you get form c.j.sh

16:21 c.j.sh is already there.

16:21 uvtc: Earlier, guns mentioned "bash-expand". What is that?

16:22 amalloy: the name of a function he plans to write

16:22 uvtc: amalloy: Ah. Thanks.

16:22 mdeboard: simply by conceiving of it, it already exists

16:24 mattmoss: ohpauleez: okay, seems to be working for me, as long as the call to send-off is in the non-vim repl

16:24 ohpauleez: correct, yes

16:24 mattmoss: All stuff requiring rich-interaction will have to be from the non-vim repl

16:24 mattmoss: Is this a VimClojure issue, or a nailgun issue? Or something else?

16:25 ohpauleez: VimClojure's REPL is just a facade

16:25 it's literally a special interpretation of keystrokes and is built on assumption of call/response

16:25 to get around it, you'd need to use something like Python within vim

16:26 but some people don't have vim compiled with Python support

16:26 so to keep the plugin simple and ease the adoption, the tradeoff is made

16:26 mattmoss: ah

16:27 ohpauleez: lein-tarsier adds a work-around by connecting a live repl to the nailgun instance, which is nice

16:27 you can \ep and \ef in vim and it's all in the non-vim repl too

16:27 if you're using tmux, this is just as good

16:29 emezeske: REPLs running in vim windows are always destined to be crap, because vim doesn't really support asynchronous updates to windows

16:29 mattmoss: My biggest problem at the moment is forgetting emacs keys and remembering vim. :)

16:30 ohpauleez: mattmoss: emacs + clojure-mode + jack-in + EVIL if you really need it

16:30 or you just feel up for a real challenge?

16:30 mattmoss: I've been using emacs up until today. I had just gotten vim keys out of my system.

16:31 Problem is... something got corrupted or misconfigured when my power went down.

16:31 * Cr8 uses lein-tarsier/vimclojure right now, I keep trying to learn emacs but keep falling off the wagon

16:31 mattmoss: And now, for the life of me, I cannot get emacs/clojure/swank working again. clojure-jack-in does nothing.

16:31 Spent a full day trying to fix.

16:36 * foodoo uses vim+vimclojure+tslime+tmux

16:44 dgrnbrg: I 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:44 Oh, it changed to out-enc

16:44 Raynes: It's evil like that.

17:36 arkh: raynes: thanks for conch! It's not expect but looks handy ; )

17:37 Raynes: Heh.

17:37 You're welcome.

17:37 I write all my libraries specifically for you.

17:38 arkh: is that the plural and anonymous form of 'you'?

17:38 amalloy: he's looking you in the eye while he says it

17:38 guaranteed

17:38 * nDuff presumes that arkh hasn't been at a conj to pick up on the fact that Raynes constantly radiates sarcasm

17:39 nDuff: ...I think the rest of the room became more sarcastic simply by having him in it.

17:39 Raynes: I'm not sure I've ever been sarcastic at a conj. I mostly go inside of a tiny little shell at conferences.

17:39 I guess my talk might have had some sarcasm in it.

17:39 arkh: I 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:40 Raynes: Aw.

17:40 nDuff: *nod* -- it's the talk I was going by.

17:40 Raynes: They like me! They really like me!

17:40 nDuff: Of course we do. Other people can make us feel stupid by comparison, but only you make us all feel old _and_ stupid. :P

17:43 * nDuff redacts that "us" to a "me"

17:43 Raynes: Heh.

17:43 I try my best.

17:44 naeg: What talk are you guys talking about?

17:44 I like sarcasm to some extent and you made me curious

17:45 Raynes: I had a talk about clojail at the conj last year. I'm not really promising good and extensive sarcasm though.

17:45 amalloy: Raynes makes everyone curious

17:45 naeg: is that talk online?

17:45 Raynes: Yup.

17:46 foxdonut: Raynes makes all the computers in my house switch to the Sarcasm color scheme.

17:46 Raynes: Speaking of talks, I guess I should submit one for this year's conj. If they're still accepting them.

17:47 http://blip.tv/clojure/anthony-grimes-clojail-life-in-the-clojure-prison-5919720

17:47 naeg: found it already, thanks

17:47 Raynes: Looks like blip just went down though.

17:47 At least for me.

17:47 naeg: http://lanyrd.com/2011/clojure-conj/shhfb/

17:48 Raynes: Huh, Simpson. My twitter doesn't still say Simpson, does it?

17:49 D'oh well.

17:49 Also, I'm not fat up there. It's totally the angle of the camera. Puts on 100 pounds. I promise.

17:51 naeg: hehe

17:52 rkz: anyone know what the vimclojure altnerative to swank/break is?

18:10 holo: hi!

18:10 naeg: hi

18:10 ls3: hi!

18:11 naeg: Raynes: with what program did you create those slides?

18:11 Raynes: naeg: Keynote

18:17 holo: lein 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:19 Raynes: 1.4

18:20 In most cases, whatever you specify in project.clj overrides transient dependencies.

18:22 holo: Raynes, 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:26 Raynes: No. And you shouldn't need to remove 1.4 in the first place.

18:26 cljsbuild will probably work just fine with 1.4.

18:28 emezeske: I belive the latest version of lein-cljsbuild depends on 1.4.

18:29 Raynes: Don't get caught up in what things depend on unless they cease to work. ;)

18:29 holo: emezeske, how do you believe it? didn't you develop this plugin? o.o

18:30 emezeske: I didn't memorize the whole codebase, and I didn't take time to refer to it

18:32 holo: emezeske, 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:33 Raynes: "or above"

18:33 emezeske: holo: https://github.com/emezeske/lein-cljsbuild/blob/master/support/project.clj#L7

18:35 holo: Raynes, 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:40 emezeske, how can i specify to download the release of that commit 5 days ago?

18:42 emezeske: holo: You already did, that was in 0.2.5

18:49 naeg: nice talk Raynes

18:49 I'm outta here now, bye

18:57 mdeboard: Has anyone else been having any issues with emacs freezing up ? Running emacs-snapshot-gtk (emacs 24), lein 2

18:57 on ubuntu 12.04

18:58 This almost always happens when there's some autocomplete action taking place in the repl

18:58 (talking about clojure-mode here obv)

19:03 technomancy: mdeboard: do you mean M-TAB completion or specifically the autocomplete.el library?

19:06 mdeboard: technomancy: 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:06 technomancy: wow, never heard of anything like that

19:06 have you tried updating to the stable 24 release?

19:07 seancorfield: so I recently discovered jsql. is it still in crazy unstable experimental-land?

19:07 mdeboard: Not 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:08 technomancy: seancorfield: 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:08 SegFaultAX|work2: technomancy: Isn't that kinda what Korma is trying to accomplish?

19:08 xeqi: korma does alot of things

19:09 map -> sql, orm-ish foriegn key, connection pooling

19:09 technomancy: SegFaultAX|work2: yes, but for various reasons I prefer jsql's approach

19:09 SegFaultAX|work2: It's not exactly sexp compiliation; rather a DSL. But it's pretty close.

19:09 technomancy: I haven't heard of that before.

19:09 technomancy: or rather the approach discussed as a possibility for jsql

19:10 SegFaultAX|work2: I must have missed that discussion.

19:13 technomancy: some of it's here https://groups.google.com/forum/#!msg/clojure/VnNJbBwOv2o/PzXfJgWBiSMJ

19:13 (apologies for the shebang-style URL)

19:14 mdeboard: I'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:14 too. God I hate this library. So my question is, this library sucks.

19:14 But seriously, my question is, does anyone have a recommendation for how to gracefully manage this nightmare

19:15 (with-open) works great for the document, but not for the PdfWriter

19:22 Cr8: mdeboard: is this library iText?

19:22 mdeboard: Cr8: Yes.

19:22 Cr8: oh boy, I've used that before

19:22 not from clojure, mind

19:22 mdeboard: Dude, it's the worst.

19:23 Cr8: Not sure why with-open would not work

19:23 mdeboard: I'm literally about to rewrite the PdfWriter class :|

19:23 in Java.

19:24 because of how you have to invoke the close method or something.

19:26 I 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:26 wow, god.

19:26 Cr8: mdeboard: sometimes.

19:26 mdeboard: Why?

19:26 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

19:27 emezeske: mdeboard: Factory methods are often used in place of constructors, for various good reasons

19:27 mdeboard: Very common pattern.

19:27 mdeboard: I see.

19:27 ok

19:27 I will enhance my calm. Still very frustrating.

19:27 clojurebot: Huh?

19:28 emezeske: mdeboard: I don't understand your problem, exactly; can't you just call open and close from clojure?

19:28 mdeboard: emezeske: Not for the PdfWriter instance.

19:29 emezeske: mdeboard: But, it can be used from java?

19:30 mdeboard: Also, 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:30 emezeske: I guess I just don't understand what's stopping you from doing everything you need to do from clojure

19:30 It seems like if you couldn't do it from clojure, you couldn't do it at all

19:32 Cr8: so I'm looking at http://api.itextpdf.com/itext/com/itextpdf/text/Document.html

19:33 mdeboard: right

19:33 Cr8: If that example actually works, I think https://www.refheap.com/paste/4079 would be a reasonable translation. (with the necessare imports/requires)

19:34 mdeboard: You'd thik so

19:34 https://gist.github.com/1b4a85042d3185f4c625

19:36 amalloy: um, the latter isn't calling .close on the doc, and the former is

19:36 mdeboard: Where?

19:36 clojurebot: where is log

19:36 amalloy: in with-open. the whole point is it calls .close on everything when it returns

19:37 mdeboard: Oh, I thought it worked as a context manager. It kept things alive until the scope it enclosed was exited.

19:37 Cr8: mdeboard: 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:37 mdeboard: Well.

19:37 hiredman: they are not vars

19:38 Cr8: name

19:39 mdeboard: based on https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3394

19:39 I thought the body was executed before .close was called from reading the code there

19:39 amalloy: indeed, it is

19:39 and the body is just (.open pw)

19:40 wilfredh: I'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:41 mdeboard: amalloy: 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:41 technomancy: wilfredh: you need to use runtime resolution

19:42 ns-resolve inside the body of a function

19:42 wilfredh: you may also find the bultitude library useful

19:42 mdeboard: I'm not arguing with you because what you are saying is either obviously true or implausibly coincidental... just trying to unconfuse myself.

19:42 technomancy: wilfredh: something like this: https://github.com/technomancy/leiningen/blob/master/src/leiningen/help.clj#L13

19:42 rkz: in clojure regex where does the ?i go for case insensitive

19:43 amalloy: i 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:43 rkz: im trying to replace the space here

19:43 (clojure.string/replace-first "hello world" #"O\s" "")

19:44 (clojure.string/replace-first "hello world" #"O\s?i" "")

19:44 amalloy: also, i don't really agree with technomancy that the automatic solution here is runtime resolution

19:44 you could, for example, make each plugin be a function, where one of the function args is "all the plugins"

19:45 Cr8: mdeboard: hey, I just popped up a new lein project and this code successfully outputs a pdf

19:45 https://www.refheap.com/paste/4080

19:45 with lein run

19:46 rkz: oh it goes at the front

19:47 Cr8: mdeboard: https://www.refheap.com/paste/4081 better, this one does it without leaking the outputstream

19:48 mdeboard: Cr8: 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:48 Cr8: mdeboard: the doc, pdfwriter, and outputstream all get closed by with-open

19:48 in that order

19:48 wilfredh: technomancy: thanks.

19:49 mdeboard: Oh, god, ok.

19:49 Cr8: Thanks :)

19:49 Cr8: np :)

19:49 technomancy: it's interesting how low "Future staffing concerns" ranked in the list of concerns about Clojure

19:49 emezeske: technomancy: You can learn lisp on the bus ride to your job interview

19:49 technomancy: I'd consider that easily the #1 blocker of adoption in medium-to-large orgs.

19:50 emezeske: you can, but people you hire won't. =)

19:50 holo: emezeske, 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:50 anyways, i guess i shouldn't care so much about this. but if it's useful for you..

19:50 emezeske: technomancy: haha, I can't! just referencing some lisp joke I read a while back

19:51 technomancy: emezeske: oh, that was _implementing_ a lisp. totally different. =)

19:51 emezeske: technomancy: that was it! :)

19:52 technomancy: I guess the question was phrased in a way that emphasized personal frustration rather than uptake within an organization.

19:52 emezeske: holo: You might have to run a "lein cljsbuild ..." task first, I'm not sure

19:52 duck1123: I 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:52 Roxxi: Hey, 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:52 (Or some higher pom?)

19:52 technomancy: Roxxi: you can unquote in project.clj to eval arbitrary clojure

19:53 duck1123: Roxxi: the answer I got was to write out the version number as bart of the build process

19:53 technomancy: so (defproject foo "1.0.0" :some-value ~(System/getenv "SOME_VALUE"))

19:53 Roxxi: depends on whether you want it in the project map or at runtime I guess

19:53 mdeboard: Cr8: 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:54 Cr8: ha, yeah.

19:54 duck1123: Roxxi: this is what I was linked to git://github.com/clojurewerkz/route-one.git

19:54 oops

19:54 Cr8: Again, I've worked with iText before. It was two years ago, but I remember a little of it.

19:54 Roxxi: technomancy: 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:54 duck1123: https://github.com/geni/geni-gedcom/blob/develop/project.clj

19:54 xeqi: holo: 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:54 antares_: duck1123: are you trying out route-one? :)

19:55 mdeboard: Cr8: Regardless of how myopic I was being, it's still a really hairy API :P

19:55 duck1123: actually yeah, that was in my clipboard from last night

19:55 expect a pull request soon

19:55 Cr8: mdeboard: I don't disagree. It's quite quirky.

19:55 antares_: 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:55 *polish

19:56 Cr8: I'd used it for a project converting from some odd proprietary document format with its own annotations, bookmarks, etc. to PDF

19:57 lots of it really felt like jumping through hoops

19:57 duck1123: the 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:57 technomancy: Roxxi: middleware might be a good fit for that

19:57 antares_: duck1123: ok, using a ref is fine with me

19:57 Roxxi: thanks duck1123 and technomancy

19:59 duck1123: antares_: 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:59 antares_: also, the example for add-route is only valid in a route-map block

20:00 mdeboard: Cr8: 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:00 antares_: duck1123: I personally group routes in a single file but if you've made it possible to split routes, that's great

20:01 mdeboard: for clojure

20:01 duck1123: I used to have all my routes in a single file, but I have so many routes now, I had to split it up

20:01 mdeboard: ok, bragging rights for me

20:01 unfortunately I'm an idiot so it's taking a while. :)

20:01 antares_: duck1123: heavy users get heard ;)

20:09 holo: xeqi, 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:13 mattmoss: Anyone 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:14 casion: java 37242 audiolabs 33u IPv6 0xffffff8014384bc0 0t0 TCP localhost.localdomain:62107 (LISTEN)

20:14 mattmoss: ok... so yours says localhost

20:14 casion: correct

20:15 mattmoss: Mine is being opened like this: TCP [::]:64073 (LISTEN)

20:15 and then swine-connect tries to connect to localhost and fails.

20:15 casion: i had zero issue getting things working

20:16 holo: emezeske, 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:16 casion: emacs 24 from brew, installed clojure-mode from the package manager

20:16 emezeske: holo: cool!

20:16 casion: everything working from no emacs to clojure in about 3 minuets

20:16 mattmoss: I had it working before... but my machine shutdown un-cleanly once, and suddenly I'm missing some config or something is corrupt.

20:19 xeqi: holo: in this case you have a dependency chain of noir -> lib-noir -> clojure 1.4.0, so it downloads the pom

20:19 but an earlier dependency on 1.3.0 takes precedence

20:19 so it downloads the jar and uses that one

20:23 holo: xeqi, 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:25 emezeske: I think it's generally good practice to be explicit about the clojure version

20:25 casion: anyone use paredit with clojure?

20:25 xeqi: yeah, if you put a 1.4.0 dep at the top thats what you should end up with

20:25 can verify with `lein deps :tree`

20:25 casion: I'm wondering how to surround with []

20:28 technomancy: casion: just mark the region and hit [

20:28 casion: technomancy: that's what I thought, but it's not working :|

20:28 it is simply doing nothing

20:28 technomancy: are you using a slightly older version of nrepl.el?

20:29 casion: I believe I am

20:29 technomancy: the latest switches things around so clojure-mode's paredit adjustments apply; try upgrading

20:30 casion: ok thank you

20:40 jt360: I'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:42 hiredman: getting noir to work inside a war file (built by lein ring) is not just flipping a switch

20:43 technomancy: are you using tomcat in order to interoperate with some existing deployments, or for some other reason?

20:43 jt360: i'm new at all this, all I really want to do is get it to run on port 80 safely

20:44 weavejester: I'd suggest running an embedded Jetty server on an unpriviliedged port, with nginx acting as a proxy.

20:44 jt360: ok cool, I've actually done that before with apache. Thanks!

20:45 weavejester: Apache can be used as a proxy too, but nginx is more lightweight (and faster, I think?)

20:46 jt360: yeah, i've been meaning to try on nginx in place of apache next time I needed it anyway

20:50 technomancy: looks like central's metadata.xml file was fixed some time today

20:50 weavejester: hey, are you independent yet?

20:50 weavejester: technomancy: I am, yep!

20:50 technomancy: cool; how's that going?

20:52 holo: xeqi, thanks!

20:53 weavejester: technomancy: 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:54 technomancy: sure, good luck

20:55 weavejester: Thanks :)

21:26 rabidsnail: In 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:28 amalloy: in general you shouldn't resolve the symbol at all

21:29 rabidsnail: I don't want to resolve it, I want to convert it to a string with the namespace attached

21:33 casion: I 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:33 http://pastebin.com/Lmge9ESb

21:33 simply have those 2 'fight', remove damage at cooldown (assume a single unit of time), then print who won with how much remaining health

21:34 if anyone has a moment could they talk me through it or write a demo?

21:34 I can't seem to come up with a solution that doesnt liberally use swap!

21:37 amalloy: sketch 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:38 casion: hmm

21:39 rabidsnail: Answered my own question: (defmacro my-macro [s] `(symbol (.toString *ns*) ~(.toString s)))

21:53 casion: amalloy: unfortunately that doesnt make sense to me :|

22:00 tremolo: having 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:00 first one works fine

22:00 has anyone seen this issue?

22:01 basically the first route defined works but the second one does not

22:02 if I remove the first one, the second one starts working

22:04 amalloy: casion: okay, so a working detailed solution: https://gist.github.com/3280677

22:06 casion: amalloy: thank you, I will look through it shortly

22:07 amalloy: the 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:12 xeqi: tremolo: my guess is :body is an InputStream and it can only be read once

22:12 so the second wrap-multipart-params doesn't read any data, and sets them to {}

22:19 muhoo: best ascii art in clojure sourcecode, nomination: https://gist.github.com/2046375

22:21 tremolo: xeqi: thanks, that was the issue

22:52 casion: I can't figure this code out at all amalloy :(

23:02 muhoo: there is no can't. there is only haven't, yet. :-)

23:03 casion: It's very frustrating :|

23:37 Peregrine: Hmm light table helps shed some light on amalloy's code casion.

23:38 uvtc: Crafty pun there, Peregrine. :)

23:38 Peregrine: Also taking the call to first out helps because then you see the entire list of results

23:38 Lol it was unintentional.

23:38 uvtc: :)

23:44 Peregrine: It's definitely some dense code though and takes some time to look into.

23:44 Yay for light table and repl's.

23:45 Raynes: Yay for misplaced apostophe's!

23:45 uvtc: I often put in the extra paren, myself. Ex. REPL's instead of REPLs.

23:45 (for acronyms)

Logging service provided by n01se.net