#clojure log - Sep 24 2011

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

0:24 amalloy: jli: (into s1 s2)

0:36 zippy314: I'm finding that when I run single tests if I refer to the fully qualified name of a function, the test fails complaining that the class doesn't exist, but if I run all my tests this doesn't happen. How do I get those classes from other namespaces to compile for testing?

0:37 (the fully quallified name is a of a function in a different namespace than in the test)

0:44 ibdknox_: jli: you there?

1:20 brehaut: if i specify "[1.2.1],[1.3.0]" in a dependency's version number, that means it will work with either 1.2.1 or 1.3.0 right?

3:06 Iceland_jack: k

3:30 jli: ibdknox_: now I am, but I'll guess you're not? :)

3:51 bj0ern: Good morning, gentlemen.

3:53 bsteuber: it's nice to wake up, switch on the computer and see clojure 1.3

3:53 a bit like xmas :)

3:57 angerman: yea kinda.

4:31 webusnix: what's the difference between clojure.jar and clojure-slim.jar ?

4:34 morphling: webusnix: clojure-slim is smaller since it does not contain precompiled binaries, only the necessary (clojure) source files

4:35 webusnix: is clojure-slim or clojure better for use in REPL ?

4:36 morphling: webusnix: clojure should start faster

5:26 mikera: ,(+ 6 7)

5:26 clojurebot: 13

5:26 mikera: ,(int 0xFF6080A0)

5:26 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: 4284514464>

5:28 mikera: anyone know how to specify big hex literals in Clojure 1.3? I actually *want* to overflow the int because it is a hex colour value......

5:29 brehaut: mikera: if you are asking how you get unsigned primitive ints in the jam, you can't

5:29 goddamn autocorrect

5:29 in the jvm

5:30 mikera: the common answer is to use a larger number

5:30 mikera: brehaut I know that, I want the result to be a negative signed int to pass into a Java library...... I just have the unsigned hex values as input :-)

5:31 it worked in Clojure 1.2.....

5:32 Chousuke: maybe you could make a macro that takes 4 numbers/symbols as parameters, parses them and returns a signed int :P No idea if macros can return primitives though

5:36 mikera: (defn hex-to-int [l] (if (> l 0x7FFFFFFF) (- l 0x100000000) l)) seems to work for my case but is ugly.....

5:40 fliebel: mikera: What are you trying to do?

5:42 Ugh, what is clojure.lang.ILookupHost supposed to be? I get ClassNotFoundException when I change my proj to 1.3

5:42 mikera: just looking for a good way to convert unsigned hex literals into Java ints, when they are needed for a Java library

5:45 fliebel: mikera: Since when does Java have unsigned numbers?

5:47 mikera: Oh, wait, I think I know what you mean. Have you seen bit-test?

5:48 mikera: it doesn't, but I want to coerce it into a 32-bit signed integer (i.e. I want it to overflow into negative numbers). This is what the Java library expects (it's a 32-bit ARGB colour so this is standard practice)

5:49 hmmm i think I have seen bit-test but how does that help?

5:50 ,(bit-test 0xFF6080A0 31)

5:50 clojurebot: true

5:50 mikera: ,(bit-test 0xFF6080A0 0)

5:50 clojurebot: false

5:54 mikera: OK I think I've got it:

5:54 (defmacro coerce-int [v] `(int ~(if (bit-test v 31) (- v 0x100000000) v)))

5:54 thanks!

5:55 fliebel: mikera: You're welcome. Though I still don't really get what you are doing.

5:59 mikera: Basically I want to be able have an unsigned hex value (like 0xFF6080A0) as an input and get the equivalent java int value as an output (-10452832). Graphics libraries often expect colours to be handled this way, they need to fit in 32 bits for performance reasons so they "cheat" and use the same bit pattern in Java ints even though Java ints are technically signed..

5:59 fliebel: Solution to my ILookupHost question: Don't try 1.3 with a dep that depends on old contrib.

6:00 mikera: Oh, right, so you're basically doing <<< iirc. That is like bit-shift without regarding the sign bit.

6:00 mikera: @fliebel - just spent an hour myself updating a load of dependencies. worth it for 1.3 though!

6:00 bj0ern: Sweet, 'The Joy of Clojure' arrived.

6:03 mikera: yep that's right, it's something like <<< because you're effectively ignoring the sign. Clojure is still a bit tricky to use for bit-twiddling hacks :-)

6:03 fliebel: mikera: http://www.java-samples.com/showtutorial.php?tutorialid=60 < not available in Clojure

6:06 mikera: Is now: (defn >>> [v bits] (bit-shift-right (bit-and 0xFFFFFFFF v) bits))

6:10 though you do sometimes need to have the native JVM version for performance..... guess I'm still going to be stuck for a while using Java as my "assembly language" for Clojure

6:14 fliebel: mikera: How do you do this in java? Because 0xFFFFFFFF does not fit an integer.

7:22 mikera: @fliebel - you can assign 0xFFFFFFFF into an integer in Java, it interprets it as -1. I just wanted to do the same in Clojure.

7:23 fliebel: mikera: Oh, hm. So maybe unchecked math has something for you then?

7:29 gko: for 1.3, what happen's for clojure.contrib? I read that it went to clojure repo in github... does it mean that now, only clojure.jar is needed and most useful things (of contrib) got into clojure?

7:30 mikera: fliebel - ah, that also seems to solve the issue - thanks! a(int 0xFFFFFFFF) => -1 now......

7:31 after (set! *unchecked-math* true) that is....

7:35 @gko - see http://dev.clojure.org/display/design/Contrib+Library+Names

7:36 contrib got broken up into chunks.

7:41 gko: mikera: are these chunks in the standard clojure jar or they have to be retrieve separately?

7:44 for ex, command-line is in tools.cli, does tools.cli is in standard jar or ...?

7:45 grrr... is tools.cli in standard jar, i meant...

7:46 mikera: you need to get them separately I think, there are in separate repositories. See https://github.com/clojure. I personally just use Maven to pull in all the dependencies needed from clojars.org

7:49 gko: ok... thanks.

8:07 cactuskid: quit

8:45 anildigital: Anyone know how to run projects main when you are connected with clojure-jack-in

9:13 Netpilgr`: Isn’t it an error that the doc string for = says “compares numbers … in a type-independent magger” but ##(= 1 1.0)?

9:13 lazybot: ⇒ true

9:13 Netpilgr`: ? In my REPL this yields false.

9:14 I’ve tested it first with Clojure 1.3.0 then again with 1.2.1 to make sure it wasn’t new behavior.

9:15 michael_campbell: false for me in 1.3-rc0 also. Getting 1.3 now; just saw the announcement

9:15 Are the 2 hashes an indicator for the bot to evaluate the expr?

9:15 Netpilgr`: Yes.

9:18 michael_campbell: I'm brand spanking new to clojure so apologies for the newb question... in the repl, is there a canonical way to exit? ^D works, and I'm even a little proud of myself for thinking of (and looking up how) to (System/exit 0), but wondered if I'm overlooking something.

9:22 Netpilgrim: michael_campbell: I use emacs with slime, but exiting a REPL with ^D should be fine. That’s how I exit unix shells.

9:22 michael_campbell: I'm an emacs guy too and thinking of getting slime set up this weekend.

9:26 Netpilgrim: michael_campbell: It’s easy enough if you follow the instructions at https://github.com/technomancy/swank-clojure.

9:26 anildigital: michael_campbell: these steps might help you https://gist.github.com/1239262

9:27 michael_campbell: Thanks, both. I heard this week someone at strangeloop noted that crafting ones .emacs is like building your own lightsaber.

9:27 Netpilgrim: michael_campbell: Probably more like building your own spaceship. :)

9:28 michael_campbell: There's enough moving parts; that's for sure. Looks like I'm going to have to tackle leiningen too.

9:29 I've decided to go to clojure/conj. I at least want to be up on this enough to understand what's going on.

9:30 having written about 15 lines of clojure in my entire career, and most of it in the repl, as I read what goes on here =)

9:30 Netpilgrim: michael_campbell: For working on Clojure code in Emacs: If you’re not already using paredit-mode (http://www.emacswiki.org/emacs/ParEdit), install it now. It makes a world of difference!

9:31 michael_campbell: I'm not trying to instigate a holy war or anything, and I'm committed to learning clojure, but do you guys have any opinions on Scala? (if this subject is akin to C brace styles or emacs/vi, I'll leave it alone. Was curious as to your thoughts.)

9:31 thanks Netpilgrim

9:32 Netpilgrim: michael_campbell: And have a look at http://4clojure.com/. It’s a fantastic way to learn clojure.

9:33 michael_campbell: It looks like I'm going to need a lazy infinite list of "thanks..."

9:34 Netpilgrim: michael_campbell: I’m still very new to Clojure myself. So you’ll be able to give tips to newbies here in no time, too. Just help growing the community.

9:35 michael_campbell: <nod> gotcha. Community is very important. Some I gel with instantly (getting that impression here), and some I do not.

9:36 I spent a lot of time on EFNet #unix years ago which was full of crazy smart people, but very polarizing.

9:37 Netpilgrim: michael_campbell: I don’t know much about Scala but I guess the two languages are different enough to prevent a holy war. (type system, immutability, syntax, …)

9:38 michael_campbell: On the other hand emacs and vi are two very different editors. :)

9:39 michael_campbell: the differences are one reason I wanted to do clojure first; I know java pretty well, and from what I'm told it's easy (too easy) to fall into bad java habits with scala. Clojure is a "throw into the water to swim" kind of situation. I know a little lisp from emacs hacking, so I kind of "get it" with the syntax and evaluation semantics and such, but not the whiz-bang or thinking in the language yet.

9:40 Chousuke: Clojure doesn't look much like Java so if you start writing Java in Clojure you will notice it :P

9:40 it looks ugly

9:41 Netpilgrim: michael_campbell: Same for me, I wanted to learn a functional language (though nor purely functional, so I can get things done). I’ve worked with enough OOP languages, and they are all so similar.

9:44 michael_campbell: Netpilgrim: yeah, that's where I'm coming from. My company is financial services (yes, I know), so we're way behind even the *java* curve on tech. I had a very humbling job interview recently, and realized my 10-12 years experience is 2-3 years, repeated 3-4 times. So I'm on a tear now trying to both catch up, and to keep learning ... SOMETHING. FP seemed a good choice to stay relevant. (Wife calls; gotta run. Thanks

10:10 rjack: newbie here: I installed counterclockwise on eclipse, and after updating to 1.3.0 I keep getting a 1.2.0 REPL

10:23 * gfredericks tries to figure out if the clojure.walk functions consume stack space

11:13 licenser: hi everyone :)

11:13 jjido: hi

11:15 licenser: Has anyone here used in canter for creating charts for the web and could get me a hint? I want to include the 'values' of the pie pieces in the image but I don't find anything about this, any hints where to look?

11:17 kjeldahl: licenser: I've only used it a tiny bit, but I think it uses jfreechart which definitively supports this. Usually, the clojure interfaces to java libraries mostly pass options etc right through to the underlying java libraries, so I think it should be doable.

11:18 licenser: oh my good I have to read jdoc? :P

11:27 Okay the jfreechart thing was a good hint, but it seems to require to creat a class and ugly things … :.(

11:40 khaliG: licenser, it's kinda nicer if you use incanter

11:44 oops i missed the earlier convo. licenser if you're doing web stuff, check out the google charts, it makes really nice charts!

13:22 bsod1: anyone knows how to fix indentation in counterclockwise eclipse plugin?

13:22 fliebel: bsod1: What's broken?

13:23 bsod1: fliebel: after wrapping some code with more parens I cant fix indentation(or removing some outer parens)

14:08 cemerick: bsod1: hit tab on the lines you want to re-indent

14:09 bsod1: is there a function for lazy seq of cartesian products of collections?

14:09 cemerick: I've already tried that, it doesn't work on eclipse indigo(I'm using viPlugin, I don't know if it matters)

14:10 cemerick: bsod1: Not sure here, either.

14:13 amalloy: bsod1: contrib.combinatorics has that, i think; and if you know the number of collections at compile time it's easy to do with just a (for)

14:29 fliebel: https://twitter.com/#!/abedra/status/117634999590727680 :) Who's using Clojure professionally as a primary language in Europe?

15:03 khaliG: are there people writing swing apps with clojure or am i the only one?

15:04 ibdknox: khaliG: there's also this guy: https://github.com/daveray/seesaw

15:05 khaliG: ibdknox, excellent. I need to read some code :)

15:05 if you know of any others please let me know

15:06 wow mindblown, seesaw sounds really interesting

15:07 ibdknox: ahh the wonders of the internet :)

15:14 khaliG: doesnt look like it handles any 'difficult' problems though :/

15:28 amalloy: ~source delay

15:36 fliebel: amalloy: ?

15:37 amalloy: fliebel: just easier than looking in the repl, and there weren't any conversations i was butting into

15:38 bsod1: I'm getting "key must be an integer" error when I run this: (some #(% [1 1]) #{[1 1] [2 2]}) can anyone help me?

15:38 amalloy: you're trying to call ([2 2] [1 1])

15:40 fliebel: Which is actually short for (get [2 2] [1 1])

15:40 bsod1: amalloy: how? I've tried to wrap this set with (seq) but got same error

15:41 amalloy: &'#(% [1 1])

15:41 lazybot: ⇒ (fn* [p1__8617#] (p1__8617# [1 1]))

15:41 amalloy: you're mapping that function over the elements of the set

15:41 fliebel: bsod1: What do you want to do?

15:42 bsod1: fliebel: I have a vector with some sets in it, and I want to filter sets that contain a pair

15:44 ah, found it..

15:44 trying to implement an algorithm which has lots of state..

15:44 * fliebel wishes pattern matching was a core part of Clojure

15:46 amalloy: fliebel: fortunately, making stuff look like a core part of clojure *is* a core part of clojure

15:47 fliebel: You know, like (fn ([[[a a] & t]] true) ([nil] false) ([[f & r]] (recur r))

15:48 amalloy: (macrolet [(fn [& args] `(matching-fn ~@args))] ...)

15:48 fliebel: amalloy: Okay, it'll probably work to ad clojure.match to my cake template by default.

15:52 amalloy: Is macrolet in clojure, or in amallow-utils?

15:52 amalloy: fliebel: tools.macro

15:53 way too complicated for me to have written it :P

15:53 fliebel: amalloy: What? You just defmacro it privately, Python style, and then let the result :)

15:54 amalloy: i don't understand enough python to get the joke, i guess?

15:54 fliebel: Python style = __method = some_obfusctaed_method_name

15:55 amalloy: fliebel: that doesn't actually work, though, is the point. the compiler doesn't recognize lets of macros

15:57 fliebel: It does, you just define a macro with a gensym, and the walk the let body to replace that with the actual symbol.

15:58 amalloy: fliebel: right, but walking the body is the complicated part

15:58 because you have to allow for the user writing (macrolet [(foo [] nil)] (let [foo +] (foo)))

15:58 fliebel: (let [foo (some macro)] (foo)) -> (do (defmacro G__310 (some macro)) (G__310))

15:59 hm, maybe

15:59 amalloy: fliebel: macrolet in both clojure and CL does allow that, so i wouldn't really be happy with a half-solution

15:59 fliebel: In that case, I'm just going to sleep. Good morning!

15:59 amalloy: heh, night

16:00 fliebel: Or does UGT include a clause where it allows you to have evening upon leaving?

16:01 amalloy: fliebel: that's the idea, yes

16:01 when you say hello, it's morning; when you say goodbye, it's evening/night

16:01 fliebel: ah "and it is always late night when person leaves" okay, good night :)

16:03 Or I'll just stick to Truman

16:08 rata_: hi

16:09 does anyone know how to put binary data in a mongo db using congomongo?

16:25 patchwork: hey all, stoked about 1.3! I tried to upgrade my project today and I got an error about the new "Can't dynamically bind non-dynamic var" thing. it is in the clojure.contrib/pprint module I believe, which actually I don't include directly. Is there a new version of this available?

16:26 gfredericks: patchwork: can you use clojure.pprint instead?

16:27 (I suspect it's the same thing, but can't say that authoritatively)

16:27 patchwork: gfredericks: Sure, if I could find out what library requires it ; )

16:28 possibly json?

16:28 so have things like this been moved into core?

16:28 possibly that is the problem

16:28 gfredericks: oh, I skipped over the "don't include directly" part

16:28 amalloy: patchwork: i think a better approach than this exists, but you can get an idea with $ mvn dependency:tree

16:28 (after lein pom, of course)

16:30 duck1123 recommended setting a global exclusion of contrib in your project.clj, and then seeing what happens

16:33 patchwork: amalloy: I don't see it in mvn dependency:tree

16:33 amalloy: so just remove the dependency on clojure-contrib? or is exclusion another kind of thing?

16:33 that seems like it will break things : )

16:34 amalloy: yep, it will break things: "don't let any downstream library have contrib"

16:34 then at least you will know who you need to fix

16:34 patchwork: amalloy: sorry, I must have missed something, are we not using contrib anymore?

16:35 gfredericks: patchwork: sorta not

16:35 amalloy: contrib is not 1.3-compatible, and for months has been "trying to" break up into lots of smaller libs

16:35 there will be no new releases of contrib, so it certainly won't become 1.3-compatible

16:36 patchwork: hmm... so is there another place I require things like json?

16:36 not sure what else I use, I will have to check

16:36 interesting

16:37 gfredericks: patchwork: e.g., https://github.com/clojure/data.json

16:37 patchwork: I see, so those libraries are still going to exist, they will just live on their own?

16:37 I panicked for a second there

16:38 gfredericks: patchwork: most of them yes. I think some of the lonelier libraries are in purgatory or something

16:38 amalloy: patchwork: they will exist iff someone does the work to make them exist

16:39 patchwork: Aha. I am willing to bring some things up to date if I need them. any idea what has been left behind? anything significant?

16:40 gfredericks: I think I only hit up against one library, but it was a while ago and I don't remember what it was. I think combinatorics.

16:40 that sounds like something nobody but me cares about

16:40 patchwork: hey! combinatorics are great, didn't realize we had a library for it

16:40 Or had, I guess

16:40 gfredericks: :-D

16:41 I doubt it'd be hard to bring it up to date

16:42 looks like the whole thing is barely 100 LOC: https://github.com/clojure/clojure-contrib/blob/master/modules/combinatorics/src/main/clojure/clojure/contrib/combinatorics.clj

16:42 amalloy: most things are easy to bring up to date. the clojure.core "machinery" of jira management, and contributor-only committers is the hard part

16:43 gfredericks: I'm a contributer now

16:43 patchwork: amalloy: sorry, what does this mean? contributor-only committers? jira management?

16:43 gfredericks: I'd be rather surprised if conmbinatorics had to be updated at all...

16:44 patchwork: excuse my ignorance, I've only been using clojure heavily for the past two months

16:44 ibdknox: the problem for me is that I have no interest in maintaining them long term

16:44 I'd be happy to update them

16:44 lol

16:44 duck1123: sometimes that's all they need for now

16:45 amalloy: $google clojure jira

16:45 lazybot: [Clojure - Clojure JIRA] http://dev.clojure.org/jira/browse/CLJ

16:45 gfredericks: the part I don't know about is who does/ought-to own it, how to distinguish between the 1.2 version and the 1.3 version, etc...

16:46 amalloy: ibdknox: so don't try to make them part of new "contrib". make it your own clojar labeled "1.3 port of contrib.foo, never going to be maintained"

16:46 gfredericks: I need to make a new clojars account so I'm not locked out anymore

16:46 patchwork: yeah I don't see anything in this combinatorics library that should prevent it from running in 1.3

16:47 just change the namespace, right?

16:47 amalloy: I know that jira is a bug tracker, I guess I don't see why jira management would be an issue for upgrading to 1.3?

16:48 duck1123: algo.combinatorics ?

16:48 patchwork: duck1123: that sounds good

16:49 amalloy: if you want your project ot be part of contrib, you can't take patches except from people with signed contributor agreements, and those patches have to be submitted via jira and attached to a ticket

16:49 duck1123: Is that for all history of it?

16:50 patchwork: signed contributor agreements? odd, why would that be necessary?

16:50 gfredericks: lawyers?

16:50 duck1123: It's so they can be free to relicense as needed

16:50 patchwork: sorry, should I be fearing lawyers by contributing to clojure?

16:51 ibdknox: you can't contribute to Clojure without signing the agreement

16:51 lol

16:51 yes

16:51 duck1123: basically you say that anything you give to clojure, is clojure's

16:51 amalloy: duck1123: were you asking me? yes. when dnolen's match got promoted to contrib, they had to ask everyone who'd contributed any code to officially give away their code

16:51 duck1123: amalloy: good to know.

16:51 ibdknox: you have to be explicit about who owns the IP

16:52 * gfredericks walks off into an empty room to rant about IP

16:52 patchwork: who does own it? are some of these things not an open source license to begin with??

16:52 lazybot: patchwork: Uh, no. Why would you even ask?

16:52 amalloy: heh

16:52 patchwork: heh

16:52 thanks lazybot

16:53 gfredericks: I guess we have AI now

16:53 amalloy: patchwork: rich owns it

16:53 patchwork: clojure is open source right?

16:53 amalloy: yes

16:53 gfredericks: certainly in the most plain literal sense

16:53 duck1123: Clojure and Contrib and ilk are CPL

16:53 ibdknox: Open source does not mean without ownership

16:54 duck1123: At one point it was all EPL, Rich was able to change that in part because of the CA's

16:55 patchwork: interesting, this is far more complicated than I thought.

16:55 duck1123: This is only if you want to contribute to an official library. If you want to make your own library in clojure, you're free to do whatever you want

16:56 gfredericks: unless you accept contributions from another person without having him sign your own CA, in which case a lawyer will shoot you while you sleep.

16:56 duck1123: well... there is that

16:58 patchwork: gfredericks: really? is this something I should worry about? great. So the fact that the project already has a license when the person contributes, that license does not apply to their code?

16:58 that is kind of insane

16:59 gfredericks: patchwork: actually I have no idea what I'm talking about.

16:59 patchwork: gfredericks: that would make github a very dangerous place

16:59 amalloy: patchwork: gfredericks is just causing trouble

16:59 you can do whatever you want with your own library

17:00 patchwork: : ) alright, got nervous for a second

17:00 gfredericks: amalloy: it's an interesting question though -- what danger is clojure avoiding that somebody who doesn't do similarly is exposing themselves to?

17:00 I certainly don't know

17:00 patchwork: So, rich owns contrib as well?

17:00 that makes sense

17:01 gfredericks: I should also add that I would like to know, if anybody would like to share :)

17:01 amalloy: gfredericks: i write a bunch of code, clojure accepts my pull request, and then a year later when clojure is a million-dollar industry, they notice that i used a sneaky license

17:02 i imagine this is what rich is worried about

17:02 patchwork: amalloy: so a pull request can have a different license from the project that pulls it?

17:02 how does that work?

17:02 gfredericks: by "used a sneaky license" you mean that you stuck a different license at the top of...your file?

17:03 amalloy: gfredericks: or something like that

17:03 patchwork: interesting

17:03 amalloy: *shrug*

17:03 i'm certainly not an IP lawyer, but situations kinda like this could conceivably arise

17:03 duck1123: That's why you always read the pull request

17:03 gfredericks: at least the commit message.

17:04 maybe just review the sha.

17:04 patchwork: Well, I would hope you would read the pull request anyway : )

17:04 amalloy: duck1123: or, years later, "I emailed them that patch in confidence, I had no idea they would incorporate my private code into their public project"

17:04 etc etc

17:04 patchwork: just pulling arbitrary stuff into your project seems sketchy

17:05 amalloy: something like github which mediates these exchanges could prevent that possibly?

17:05 duck1123: Rich has a piece of paper somewhere with my name on it that says I won't try to pull that

17:06 amalloy: *shrug* github won't want to get their lawyers involved in this dispute, and i can rewrite the commit message someone sends me. they can claim i did that

17:06 (assuming i'm rich, in this case)

17:06 dtvanny: This is about the GPL, but the general comments on enforcing the license seem generally applicable to the discussion: http://www.gnu.org/licenses/why-assign.html

17:07 amalloy: a piece of paper giving away all rights to any of my code that appears in clojure obviates the problem

17:07 i think, personally, that it's a huge pain, and it causes me to contribute less to clojure than i'd like. but i can see why rich wants it anyway

17:07 duck1123: amalloy: You can't rewrite the message without changing the hash of the tree. Although you certainly can before a push

17:08 gfredericks: do lawyers trust hashes?

17:08 amalloy: gfredericks: it doesn't matter if they do

17:08 patchwork: amalloy: Yes, that sounds like a pain. I think I will release my libraries separately ; )

17:08 amalloy: either side of the transaction could change *their* half of the commit, and the hashes would differ. but you can't tell who did it

17:08 patchwork: I see why everything is moving out of contrib

17:09 duck1123: perhaps we need bitcoin for git commits

17:12 gfredericks: I've thought that a global timestamp server would be nice.

17:13 napping: Should I be able to (use) libraries from lein repl?

17:13 patchwork: napping: yes

17:14 though you have to quote them

17:14 gfredericks: napping: yes, generally with the (use 'foo.bar) syntax

17:14 patchwork: So okay, where did str-join go?

17:14 it was in clojure.contrib.str-utils

17:14 amalloy: clojure.string/join

17:14 gfredericks: clojure.string

17:14 patchwork: awesome

17:16 I'm glad they upgraded that one

17:16 amalloy: well, that got promoted a long time ago

17:16 last august, i think?

17:16 patchwork: did it? my sources must be out of date

17:16 duck1123: still a lot of code to fix

17:16 amalloy: patchwork: stuff got moved into core, but not deleted from contrib

17:17 duck1123: I've patched so many libs for that one

17:17 patchwork: that is one thing I've found, clojure changes so fast it is hard to know what the authoritative source for information is

17:17 google hits from 2010 are sometimes misleading

17:17 gfredericks: irc

17:18 patchwork: yeah, well good thing I'm here! : )

17:18 duck1123: hopefully with the new structure, that'll stabilize a bit

17:18 napping: the standalone form works better with the quote, but tools.cli is still not working

17:19 lein accepts a [org.clojure/tools.cli "0.1.0"] dependency, I see tools.cli-0.1.0.jar in libs next to other dependencies

17:19 gfredericks: napping: what's the error?

17:20 amalloy: napping: you're probably using the wrong namespace

17:20 duck1123: the file names don't tell the whole story

17:20 amalloy: https://github.com/clojure/tools.cli/blob/master/src/main/clojure/clojure/tools/cli.clj#L1

17:20 duck1123: you can always open up the jar and look at the pom to see what version it really is

17:21 napping: just realized the names might not match and took a look in the jar,

17:21 user=> (use 'tools.cli)

17:21 FileNotFoundException Could not locate tools/cli__init.class or tools/cli.clj on classpath: clojure.lang.RT.load (RT.java:430)

17:21 amalloy: napping: please follow my link

17:22 patchwork: thanks all for helping out by the way. I just got into clojure recently but I love it. I'm using it for a larger project now so I'm grateful this channel is so friendly : )

17:22 some channels, not so much

17:23 gfredericks: friendlier topic?

17:23 napping: thanks, clojure.tools.cli works. Now, how should I have already known this?

17:24 gfredericks: napping: where did you find out about the lib?

17:24 duck1123: always look at the code or docs of a lib you want to use

17:24 napping: http://dev.clojure.org/display/doc/Clojure+Contrib

17:25 gfredericks: napping: I don't see the ns noted anywhere prominently. I always look for it in the readme. Not seeing it there I would check the source, rather than guess that it's the same as the repo name.

17:27 napping: is it based off the namespace, or the path to the file?

17:27 gfredericks: napping: (from your link I simply had to click on the library name to get to the github repo)

17:27 napping: they generally coincide, but the ns is usually declared at the top of the file, so check that to be sure

17:27 napping: yeah, I was looking at the github page also, but not into the source

17:27 gfredericks: thus amalloy's link

17:30 kjeldahl: So any shortcuts for removing the outer part of an s expression in Emacs clojure mode, i.e. a simple keystroke to make "(dbg (my-func 1 2 3))" become "(my-func 1 2 3)", by pressing some magic key at the first parens or anywhere inside the outermost scope?

17:30 patchwork: found another one: clojure.contrib.prxml

17:30 this one still alive?

17:31 amalloy: kjeldahl: M-UP, M-s, or M-r, depending on exactly what you want

17:31 duck1123: prxml makes me mad, it causes all of my dynamic warnings

17:31 kjeldahl: usually M-s

17:31 amalloy: not M-s, i guess

17:31 heh

17:32 patchwork, duck1123: prxml is now part of data.xml, but that's not released

17:32 duck1123: I've been living dangerously and am using data.xml

17:32 amalloy: (dbg |(my-func 1 2 3)), M-s => |(my-func 1 2 3)

17:33 duck1123: but one of my older libraries used prxml, so it's still a dependency

17:33 patchwork: not released? yet you can still use it?

17:33 clojurebot: No entiendo

17:33 amalloy: duck1123: you published your own release of it, or what? i know ninjudd did that

17:33 duck1123: you have to build it

17:33 kjeldahl: amalloy: Nothing happening at my end unfortunately.

17:33 amalloy: dangit, i typed M-s but meant M-r

17:33 try that

17:33 duck1123: I think I have a copy in my maven repo

17:34 napping: after reading "Compilation and Class Generation" carefully, it makes some sense

17:34 patchwork: duck1123: put it on clojars? : )

17:34 is there a reason it is not released yet?

17:35 amalloy: one of the tests fails, even though it passes when i run it locally

17:35 duck1123: I haven't done that. build.jiksnu.com

17:35 kjeldahl: amalloy: M-r here toggles cursor position from middle of screen, bottom of screen, top of screen etc. I'm on Emacs 24. Any custom bindings in your .emacs?

17:35 amalloy: kjeldahl: do you have paredit mode enabled?

17:35 napping: I guess I'm confused by lein's name for the package. Do I have to learn Maven to understand those?

17:35 kjeldahl: amalloy: Ah, no.

17:35 patchwork: gotta have paredit

17:36 amalloy: kjeldahl: dooooo it. paredit is king

17:36 duck1123: napping: They're maven names, so you have to at least know how maven names stuff

17:37 I would have to change the group id to push it to clojars, right?

17:37 amalloy: *nod*

17:38 duck1123: but you can just use the one ninjudd already pushed

17:38 http://clojars.org/org.clojars.ninjudd/data.xml

17:39 patchwork: hey look at that! I'll give it a spin

17:39 gfredericks: don't change the group id to be your clojars user id

17:40 duck1123: That's why I just host my own Archiva repo for stuff like this

17:41 kjeldahl: amalloy: Got it, thanks for the hint.

17:41 amalloy: gfredericks: what would you change it to?

17:41 gfredericks: amalloy: don't know, I just know there's a bug in clojars that locks your profile if you ever do that

17:42 amalloy: hah

17:45 napping: duck1123: thanks, I guess I'll check out a bit

17:45 Maven looks like a huge confusing mess. Is it worth understanding it all if I don't really care about Java?

17:46 gfredericks: napping: I don't understand it all and I've gotten by

17:46 napping: "low power to weight ratio", is the impression I get

17:46 gfredericks: I don't know if those who _do_ understand it have some kind of hidden bliss that I'll never know...

17:46 duck1123: You need to know the basics, but there's a LOT to Maven

17:47 napping: Yeah, I think I need to know enough to understand lein

17:47 duck1123: I just recently made the switch from Maven back to Lein

17:49 patchwork: hmm... so this new data.xml does not work the same as prxml

17:49 I just want to make xml out of arbitrary nested maps

17:50 amalloy: patchwork: it has the same features prxml does

17:50 napping: thanks. That should be enough for a while, and I need to be off

17:50 amalloy: (or it should; i added them for just that reason) what are the inputs and outputs you want?

17:50 duck1123: patchwork: If your xml needs are simple, you may also want to check out hiccup

17:51 patchwork: amalloy: how does emit relate to the old prxml function?

17:51 amalloy: or is it another function I am missing?

17:51 amalloy: (emit (sexp-as-element (some-data))) should be roughly the same as (prxml (some-data))

17:52 patchwork: amalloy: {:thing {:b 33}} => <thing><b>33</b></thing>

17:52 amalloy: aha, I was missing the sexp-as-element

17:52 amalloy: patchwork: i don't think prxml ever worked like that. you're thinking of vectors, not maps

17:52 anyway, data.xml works in a more formalized tree of :tag/:attrs/:content nodes; sexp-as-element is the hook i added to convert prxml/hiccup-style data to that format

17:53 patchwork: amalloy: aha, you are correct

17:53 I see this whole to-xml conversion function I wrote to turn maps into prxml vectors

17:53 that I forgot I wrote

17:53 amalloy: that's dreadful

17:53 patchwork: nice! this looks perfect

17:53 amalloy: yeah

17:54 gfredericks: patchwork: always maps with single keys?

17:54 patchwork: amalloy: this new situation is way better

17:54 gfredericks: nope, they can have multiple keys

17:54 I was just banging out a quick example

17:54 gfredericks: patchwork: what does {:foo {}, :bar {}} generate?

17:55 patchwork: <foo></foo><bar></bar>

17:55 amalloy: gfredericks: teaching the world what a bad idea it is to write your own xml library

17:55 gfredericks: what if I wanted <bar></bar><foo></foo>?

17:56 amalloy: how else will we store the data that we encrypted with our custom algorithm?

17:57 rata_: does anyone know how to put binary data in a mongo db using congomongo?

17:57 patchwork: gfredericks: hence the vectors of prxml, yet I had a bunch of maps

17:57 amalloy: patchwork: his point is that maps aren't ordered

17:57 i'm not sure from your response whether he made that clear

17:58 rata_: do I just do (insert! :collection (java.io.InputFile. ...))?

17:58 patchwork: amalloy: yeah I got that, I see why prxml uses vectors, but I already had maps I wanted to output

17:58 amalloy: mkay

17:58 patchwork: I didn't care about ordering really

17:59 are you saying that there is a better way to output maps as xml I overlooked, or that I should only output ordered things in xml?

17:59 gfredericks: I guess if it's not a true xml library and is just an ad-hoc function to transform your data...

18:01 amalloy: if you don't care about ordering, then maps are a fine way to do it

18:01 well

18:01 if you don't care about ordering *or* being able to repeat elements

18:05 rata_: sorry, (insert! :collection (java.io.FileInputStream. ...))

18:05 but it doesn't work

18:05 anyone know how to do it?

18:36 technomancy: amalloy: I submitted a patch to do aot-less -main namespaces for clojure 1.2, but it was ignored until 1.3

18:36 re: the issue you were having with 4clojure

18:36 amalloy: technomancy: thanks. so it's actually in 1.3?

18:36 technomancy: amalloy: yeah, you can do java -cp myjar.jar clojure.main -m my.main

18:37 so there's a little more boilerplate in the java invocation, but it's usually worth the tradeoff

18:37 amalloy: heh. i remember seeing that in the source, and was actually trying the -m option, but it didn't work on the 1.2 jar, of course

18:37 so now i know whose fault it is that i expected it to work!

18:38 technomancy: indeed

18:41 Zolrath: I'm having an issue with lazy-cat as I'm trying to make a vector of maps but let's say I take 4 from it

18:41 The first entry is the seed entry and it correctly pulls the data for making the second entry

18:42 but instead of adding the map as a whole to the list it's adding each key/value pair of the map as its own vector

18:42 so take 3 takes the first entry and the first two keys from the second entry

18:47 Oh I guess thats totally what lazy-cat should do.. hm

18:50 Guess I'll just wrap the results in a list

18:52 shintaku: is this the right vimclojure: https://bitbucket.org/kotarak/vimclojure/ ?? if you look at the src, all the vim stuff is in vim/ and i'm not sure that will work with pathogen, or at least it isn't for me. any ideas?

19:02 zakwilson: Using drop forces evalutation of the items being dropped, doesn't it?

19:03 amalloy: yes

19:04 zakwilson: Is there a way to get a range from a lazyseq without evaluating the front of it?

19:04 amalloy: no. given the definition of a lazy seq, it's not possible

19:06 * zakwilson thought not.

19:12 amalloy: zakwilson: you can do...some similar things, given some constraints that your application might or might not meet

19:16 zakwilson: amalloy: it's a one-off thing. Not important enough.

19:19 amalloy: ,(binding [*print-dup* true] (pr 1180591620717411303423))

19:19 clojurebot: 1180591620717411303423N

19:20 gfredericks: ,(type 7N)

19:20 clojurebot: clojure.lang.BigInt

19:22 Zolrath: Okay I definitely have a fundamental misunderstanding on how lazy-cat works as in my head (def go-up (lazy-cat [1] (inc (last go-up)))) would concat incrementing numbers as far as you take from it

19:23 gfredericks: Zolrath: what do you expect (inc (last go-up)) to do?

19:23 oh I think I see what you're doing

19:23 Zolrath: I was thinking it would get the current result of (last go-up), increment it, and add that to the end

19:24 But I am incredibly wrong

19:24 gfredericks: Zolrath: one way of thinking of it is that if go-up is supposed to be an infinite sequence, then last would never return

19:24 or rather, that's one reason that won't work

19:25 amalloy: no, it looks like he's trying to do something that almost works but isn't very idiomatic clojure

19:25 gfredericks: amalloy: he could use last in that manner?

19:26 amalloy: maybe not

19:26 Zolrath: I'm not actually planning on using that function I just have another function where the next result relies on a key from the result prior to it

19:26 And I'm trying to figure out how to actually get that information

19:26 gfredericks: Zolrath: not sure what you're wanting to learn here, but you might be interested in clojure.core/iterate

19:27 amalloy: yes, iterate, or a recursive function. *not* a recursively-defined var

19:31 Zolrath: Hm I'll look into doing it another way I suppose, thanks!

19:32 Odd that you can't really extract information directly from entries prior though

19:33 gfredericks: Zolrath: that's what iterate gives you

19:33 pcerrato: It would seem that unless go-up is defined already in an enclosing or dynamic scope that def would not be able to eval it ... unless I'm missing something here ...

19:33 gfredericks: pcerrato: recursively defined vars work fine, it's just the 'last' that breaks it

19:33 try (def jake (lazy-cat [5] jake))

19:34 pcerrato: it's because lazy-cat delays evaluation until later, at which point the def has already happened

19:40 pcerrato: got it .. thanks !

19:41 amalloy: Zolrath: two easy ways to do this would be (defn go-up [n] (lazy-seq (cons n (go-up (inc n))))), or (defn go-up [n] (iterate inc n))

19:42 gfredericks: noting that in amalloy's versions go-up is now a function returning the seq instead of the seq itself

19:49 Zolrath: amalloy: Thanks!

19:50 My actual function is using enlive to pull data from a page and put it in a map, and in order to get the next page I have to use the key :prev as the url arguement in the next iteration

19:50 and I want to end up with a list of all the maps, n pages deep

19:51 gfredericks: this implies that you could easily create a lazy seq of the entire internet.

19:51 I think that's a more compelling lazy-seq example than just "all the numbers" :)

19:51 (defn internet [] ...)

19:51 Zolrath: haha

19:52 Yeah my actual issue is grander than the go-up example that was just the most simple way of trying to use data from a previous iteration that I could think of

19:52 Which I still couldnt do hah

20:33 kd4joa: Sorry to bother you all with something that is probably right in front of my eyes, but I'm not seeing it.

20:33 Since clojure-contrib is gone, how does one write a line to a file? I have a java.io.writer but can't seem to locate the function that will actually write to it.

20:34 gfredericks: kd4joa: spit is too specific for you?

20:35 kd4joa: also do you know about clojure.java.io?

20:35 kd4joa: yeah, that's what I meant instead of java.io.writer

20:35 I was using clojure.java.io to setup the writer

20:36 gfredericks: the java docs say that if you have a writer you can (.write writer s)

20:36 kd4joa: let me look at spit again.

20:36 I thought I tried that and it complained. let me try it again

20:37 gfredericks: kd4joa: I'm looking at this specifically: http://download.oracle.com/javase/6/docs/api/java/io/Writer.html#write(java.lang.String)

20:38 kd4joa: Can I use a clojure.java.io/writer with that?

20:39 gfredericks: clojure.java.io/writer is a function that should return a writer

20:39 once you have that writer, you can call .write on it

20:39 I didn't quite understand your question, so I just summarized

20:41 kd4joa: I have a list of maps that I want to write to a file in json format with a newline between each of the maps

20:41 gfredericks: kd4joa: if there aren't too many and you don't care about efficiency, you can assemble the output in a string and just spit it

20:42 though actually using the writer is probably just as easy

20:42 what part are you hung up on?

20:43 kd4joa: finding a function that will actually write a string to a file. using .write on the clojure.java.io/writer throws an exception

20:43 gfredericks: what exception?

20:43 kd4joa: No matching method found: write for class java.io.BufferedWriter

20:43 gfredericks: what are you passing it?

20:44 * gfredericks just tried it and it worked

20:44 kd4joa: right now just a single string

20:44 hmm. ok. I'll try closing everything down and starting up again

20:45 gfredericks: kd4joa: https://gist.github.com/1240064

20:45 you're doing something like that?

20:47 kd4joa: yes. at least I thought so. when I simplify it down to a string instead of my function that's returning a string it's working like you said

20:48 so something in the string that's getting generated through the function I wrote is making it puke

20:48 gfredericks: kd4joa: I suspect your function isn't returning a string

20:48 kd4joa: at least that's some progress. I know what it's not

20:48 gfredericks: as the method lookup is failing

20:49 kd4joa: must not be. it sure looks like a string though

20:49 unless it's in a list. aha

20:49 gfredericks: :)

20:49 it's always the damn little details

20:50 kd4joa: yep. that was the problem.

20:50 damn. forgot that map returned a list

20:51 thanks for the help

20:51 gfredericks: np

20:51 alandipert: kd4joa: there's also spit, which might meet your need

20:52 kd4joa: nevermind, scrolled up

20:53 kd4joa: ultimately what I want to do is output all these maps as json through a web service continuously until the client breaks the connection

20:54 gfredericks: that's sounds like a use case for not spit if I've ever heard one

21:01 amalloy: this is the first programming problem gfredericks has ever heard of that's not solved by spit

21:02 gfredericks: spit: who knew it wasn't turing-complete?

21:11 patchwork: so I have tracked an error down in some library code to what seems to be a type hint for an int-array, ^ints

21:11 Unable to resolve classname: clojure.core/ints

21:11 it's in a macro

21:11 [~'img ~'x ~'y ~'w ~'h ^ints ~'arr]

21:11 arr is an int-array

21:11 is this something to do with the 1.3 upgrade?

21:12 something about it being a type hint in a macro?

21:14 shep-home: While trying to run my tests, I get this error: `No matching field found: getRoot for class clojure.lang.Var`

21:14 This is with emacs / clojure-test-mode / swank

21:15 A quick Google doesn't seem to have anything relevant

21:16 And I am trying to run my tests with C-c ,

21:19 srid: where is the new "substring?"? (from clojure.contrib.string)

21:20 and where is to-byte-array?

21:20 I cannot find them at http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

21:21 amalloy: subs

21:22 and to-byte-array sounds like a bad thing to have anyway; what's it supposed to do?

21:22 srid: read from an input stream into array of bytes

21:22 http://dpaste.com/620476/

21:26 i then slurp the return value

21:26 ibdknox: you can slurp streams directly

21:27 srid: ah, right.

21:29 shep-home: With the move away from monolithic contrib, where should I get contrib.test from if I'm starting a new project?

21:29 I think my error might be caused by incompatibilities with contrib and 1.3

21:44 jli: shep-home: hm, isn't it just clojure.test?

21:45 shep-home: jli: yes, I realized that just a second ago :-)

21:45 jli: :)

21:45 shep-home: no wonder I can't find it in contrib!

21:45 jli: yeah

21:45 shep-home: downside is, that doesn't solve my problem :-\

21:45 jli: why?

21:45 clojurebot: why not?

21:46 shep-home: My original problem is that *something* blows up when I try to run my tests from inside emacs

21:47 and I found some random pages that point to it being a contrib 1.2 / clojure 1.3 issue

21:50 and I found some random pages that point to it being a contrib 1.2 / clojure 1.3 issue

21:50 doh

21:50 slipped key

21:53 jli: blows up because it can't find test?

23:43 andar__: is there a clean way to reload dependencies from lein when using lein-swank in emacs? I've just been running sayoonara in slime repl, then killing the *swank* buffer (since there seems to be a bug re-running clojure-jack-in if that buffer exists)

23:44 er when using clojure-swank and clojure mode's 'clojure-jack-in' to be more precise

Logging service provided by n01se.net