#clojure log - Mar 21 2010

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

0:19 DTrejo: does anyone use a combination of leiningen and counterclockwise?

0:19 I suppose it's not much of a combination since it's not really one or the other.. nvm

2:20 JonSmith: if anyone is awake, what do people use for video games in clojure (i'm not looking to make video games per-say, merely applications more interactive than swing or awt can do...)

2:23 rfg: JonSmith: I am using LWJGL for one project (a game) and JOGL for some scientific rendering in another project.

2:24 If you want to use LWJGL, you should probably check out penumbra.

2:25 JonSmith: yeah i've played with penumbra it is pretty neat

2:25 i downloaded clj-processing and thatis cool too

2:25 kind of doing a survey to figure out what i want i guess

2:26 i want to do a GUI client type thing, but I want it to be more than just a plain old buttons and drop-downs GUI

2:27 i should take a second look at penumbra though as it has been a while since i used it

3:46 psykotic: currently there doesn't seem to be a way to merge futures

3:48 for example, if you have a list of futures and want to process them in 'finishing order'.

3:48 hiredman: you need a futureM

3:48 psykotic: hm?

3:49 i noticed that you could use promises, since they allow you to check whether they have been delivered yet or not. but even then, i don't see how to write an _efficient_ merge.

3:49 i don't want to have a thread that spins until one of the promises is delivered.

3:50 hiredman: you can build a blockingqueue on promises, or just use from j.u.concurrent

3:50 psykotic: right, i've done this kind of thing with normal parallel primitives before. i was just checking whether this (bog standard) problem had a solution in core i overlooked.

3:51 hiredman: I tend to use lbq a lot

3:52 * psykotic thinks the right interface is to take a list of futures and return a future which returns the future first to complete, which can then be dereferenced.

3:52 psykotic: with that, you can easily build a loop that processes the futures in completion order.

3:52 wait for the next future to finish; remove it from the outstanding list, deref it, rinse and repeat, until no futures left.

3:53 hiredman: no, best would be writing your own future macro that would stick the result into a queue when it's done

3:54 psykotic: blockingqueue looks nice

3:54 LauJensen: Morning crew

3:54 hiredman: hello

3:57 rfg: Hello

4:01 LauJensen: I'm suffering from these completely silent failures in futures, is there any way to fix that except running the code in the main thread?

4:03 hiredman: (future (try … (catch Exception e (-> e .getMessage println))))

4:04 LauJensen: lemme try

4:05 hiredman: you can also create a logging function or macro or use the logging stuff from contrib

4:06 LauJensen: Yea, that would be last resort, but your example above works perfectly, thanks

4:06 hiredman: :(

4:06 people are watching lein-gae, I should delete it

4:07 LauJensen: I made an empty repo called Clabango - Had quite a few watchers as well :)

4:26 I know I'm stretching my luck here, but is there a javalib for capturing a graphics object and storing it as a frame in an animated gif ?

4:27 (if so, please send it to me with a lein-string attached)

4:36 vy: LauJensen: You'd have more luck in ##java

4:42 LauJensen: Or perhaps ##google

4:42 Anyway, doesnt hurt to ask

4:50 Recently I've been seeing this a lot when doing slime-load-file

4:50 swank.util.io.proxy$java.io.StringWriter$0 cannot be cast to java.io.PrintWriter

4:50 Anybody know what thats about?

4:58 hiredman: some library somewhere expects *err* to be a PrintWriter

4:58 I forget the details

5:01 LauJensen: So its a matter of waiting for an update for swank-clojure ?

5:02 hiredman: http://groups.google.com/group/swank-clojure/browse_frm/thread/36cc0c9d325a9c76/e7602744e126102b?tvc=1#e7602744e126102b

5:03 *shrug*

5:03 LauJensen: great, theres already a patch and its only a problem when tracking reflections

5:52 zab: Hi all. Just writing something that takes a Java InputStream and copies it to an OutputStream. Is this the idiomatic way of doing it in Clojure? http://paste.lisp.org/display/96708

5:53 (I am unsure of using `def` to represent the Java object that will be returned.)

5:55 rfg: Why not: http://paste.lisp.org/display/96708#1

5:55 ?

5:55 Chousuke: that doesn't work

5:55 rfg: Oh sorry

5:55 Wait

5:55 Chousuke: you need to use let

5:56 LauJensen: zab: As far as human possible, avoid modifying anything outside your functions body

5:56 +ly

5:57 Chousuke: so you should just do (let [os (ByteArrayOutputStream.)] (Streams/copy ...) os)

5:58 zab: The return value of Streams/copy is not what I want returned from the function. I want the 2nd argument returned. The new ByteArrayOutputStream will be populated with the input stream.

5:59 So in Java, you would declare the OutputStream first, and then mutate it within the function call, and then return it. But in Clojure I do not know how to do the equivalent.

6:00 LauJensen: Yeah I thought so. Hence my hesitation with the `def`. :( There has to be a better way?

6:00 Chousuke: use let within the function

6:00 ie. make the outputstream in the function and just return it

6:00 LauJensen: zab: What Chousuke said. If you define something within a function and mutate it there, its still considered a pure function in regards to the rest of your program

6:01 Chousuke: though that's not a pure function even if you did that

6:01 zab: Chousuke, LauJensen: Ahh okay. I was unsure if that would work because I know you cannot rebind using let. But that wouldn't be rebinding anyway.

6:01 Chousuke: because it presumably affects the inputstream

6:02 zab: Chousuke: Would there be any way to achieve a pure function with my problem? Or is this something that I have to live with seeing as I am playing in Java land?

6:02 Chousuke: I don't think so.

6:02 it's pretty difficult to clone an inputstream :/

6:03 I mean, you can do it, but it will still have side-effects

6:04 zab: Chousuke: Okay cool. I'll stick with this approach then. :)

6:04 How about function naming conventions. Is this function named right? `new-output-stream`

6:05 Chousuke: but not all of your functions need to be pure. if most of them are, you're doing good.

6:05 rfg: "What's in a name?"

6:05 Chousuke: zab: what's the function for, exactly

6:06 zab: takes an InputStream and creates a new OutputStream object for it

6:07 Chousuke: so it's like a unix pipe? I'm not sure if I understand the semantics of the copy operation right :/

6:07 it's not just creating a new output stream, it's copying stuff

6:07 and I think that should be apparent in the name

6:08 zab: yeah it's copying the InputStream to the OutputStream and returning that.

6:08 just a hoop I have to jump through to get it to play nice with app engine

6:09 Chousuke: maybe name the function according to what the outputstream represents instead

6:09 I think as it is, it may be a bit too generic.

6:10 zab: hmm okay. I see your point.

6:10 Chousuke: or you could name it make-output-from

6:10 which would read pretty nicely

6:11 zab: Nice. Sort of like how Objective-C methods are named, read like a sentence. make-output-from [input-stream]

6:12 thanks for the help Chousuke, LauJensen, rfg :)

6:13 rfg: My help was substandard, but thank you :)

6:13 zab: rfg: heh you gave it a shot

6:44 patrkris: what is the nicest way of checking a series of let-bindings that are serially dependent, i.e in (let [a expr1, b expr1] ...) b is dependent on a not being nil? I want sort of the behavior of if-let, i.e. the body is not evaluated unless both a and b are non-nil/non-false. Hopefully it makes sense.

6:45 noidi: the maybe monad does exactly that

6:45 afaik

6:45 patrkris: noidi: cool, will check it out

6:45 noidi: in contrib?

6:45 noidi: http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/

6:46 patrkris: thanks

6:46 noidi: so you want b to be evaluated only if a is non-nil, and the body evaluated only if b is non-nil?

6:47 patrkris: noidi: exactly

6:47 noidi: "Anyway, the idea is that whenever a computational step yields nil, the final result of the computation is nil, and the remaining steps are never executed."

6:47 from the tutorial

6:47 so maybe monad should do the trick

6:49 patrkris: sounds like it!

6:49 i would have thought that this is such a common scenario that it would be in core

7:43 ttmrichter: I saw an interesting question on StackOverflow that I'm curious about the answer to myself: http://stackoverflow.com/questions/2486752/in-clojure-how-to-define-a-variable-named-by-a-string

7:44 Is there a way to assign values to symbols generated from strings?

7:51 psykotic: you can do it if the (parts of the) string are known at compile time

7:52 and there is always eval when that isn't the case

7:52 though that's good to avoid :)

7:52 * Chousuke is writing a reader again :P

7:52 Chousuke: this time, it's restartable.

7:54 (def cont (second (read-one (seq "\"foo")))) -> (second (cont (seq "bar\""))) -> "foobar"

8:00 I'll need to find some way of managing the "continuations" if I want to make this feasible :/ right now I have a vector parser and a string parser and they both have a cond checking whether they need to "save" their state or not.

8:08 ttmrichter: Whoever sepp2k is on StackOverflow, thanks for the succinct and helpful answer. I completely forgot about the ~ construct.

8:08 psykotic: can anyone recommend a good on the standard java API (io, net, collections, etc) that isn't just a reference but also a "best practices", tricks and pitfalls, etc, kind of thing?

8:08 a good book even

9:46 ivan: is there any sane way to write clojure while using variable width fonts in (any) editor?

9:47 LauJensen: ivan: The font you use shouldn't affect your ability to write clojure-code :)

9:47 Fossi: why would one do that? :D

9:47 well, it helps the indention if it's mono

9:47 ivan: well, variable width makes it impossible to align code in a dumb editor, yeah

9:48 and I think they're nearly all dumb

9:59 maybe elastic tabstops, heh

10:00 psykotic: ivan: i don't like proportional fonts, but as long as the "alignment" consists entirely of spaces, it works fine

10:00 the problem is when you have a mix of spaces and non-spaces

10:00 Raynes: ivan: Emacs think's you're dumb. :|

10:01 esj: Raynes: emacs keeps proving that I'm dumb ;)

10:01 ivan: psykotic: well, if I align things for my variable width font, it's be misaligned for most people

10:01 s/it's/it'll/

10:01 Raynes: clj-sandbox keeps proving that I'm dumb.

10:04 Waiting for an email is the most agonizing thing in the world to do when have absolutely nothing to do but sit.

10:04 I wish everybody I knew lived in the same timezone as me. It would make this stuff so much easier.

10:05 esj: but you live in your own timezone, waking up at 5pm :)

10:05 Raynes: esj: Yeah, and that's usually convenient because everybody else I know is waking up when everybody in my timezone is going to sleep. :|

10:07 I swear, this timeout stuff will be the death of me.

10:36 bobo_: could someone take a peek at http://github.com/bobo/Retwis-clj/blob/master/src/retwis/view/view.clj and give me some tips on what to learn/do to improve the quality of the code?

10:48 The-Kenny: bobo_: First of all: *Never* put the closing-parens in an empty line. That looks so awful

10:48 Raynes: That's a Cism that doesn't work out in Lisp.

10:54 Fossi: hmm. i try to compile a gen-class with lein, but it only says "All :namespaces already compiled"

11:01 Licenser_: greetings

11:04 ,(loop [] (recur))

11:04 clojurebot: Execution Timed Out

11:05 Raynes: Licenser: Hai!

11:06 Licenser: You should probably look at thunk-timeout in clojurebot's sandbox.

11:06 I tried to fix it myself, but I faileded. :p

11:06 Licenser_: hrm hmr

11:06 ah you're the Raynes :) greetings

11:06 Raynes: Greetings, sir, and thank for you clj-sandbox. :>

11:06 Licenser_: yes I figured the problem, was trying out if clojure bot has the same problem, fortunately not

11:07 the s-seq function is the evil doer

11:07 and you're welcome :)

11:08 Raynes: Licenser: Once we get this fixed, I'll finish up what I'm doing and issue a pull request detailing what I've done. I think you'll like the modifications I've made. :>

11:09 create-sandbox and create-sandbox-compiler were just screaming for optional keyword arguments.

11:09 Licenser_: Yes you are totally right

11:09 I git attacked by the evil 'own purpose blindness' :P

11:09 Raynes: I:p

11:09 :p*

11:11 Just got your email.

11:11 * Raynes reads

11:11 Licenser_: *nods*

11:12 Raynes: Licenser_: Alright. I'll be watching for the push. Once that's out, I should be able to toss a pull request your way sometime tomorrow.

11:12 Licenser_: :) great!

11:17 Raynes: Licenser_: I'll also point out that most of the problems with the doc-strings were merely typos and not actual the result of your English.

11:18 And the other ones really just needed to be reworded a bit.

11:18 Licenser_: Raynes: ^^ Thanks

11:19 lets see if this fixes the issue

11:20 Raynes: I thought about going ahead and dropping the class-tester function in there and adding some java.lang classes to the whitelist, but we might have different definitions of what is 'secure', so I figured I'd let you handle that.

11:20 Licenser_: My definition of secure is mostly 'what comes to mind'

11:21 Raynes: Most of what I added to my own whitelist are just java.lang.String and other similar classes.

11:24 Fossi: lein is driving me nuts. should have a verbose option :(

11:33 Licenser_: Raynes: fixed :)

11:33 Raynes: Awesome!

11:33 :D

11:34 In that case, I might be finished enough to send you a pull request tonight even.

11:34 Licenser_: I'll add another comment and then push

11:35 Raynes: :D

11:39 Licenser_: Raynes: pushed

11:39 I love the partial commit thing from git

11:39 that is so great

11:39 I really could make 3 atomic commits out of the changes I made to the file, much cleaner

11:39 Raynes: Neat.

11:41 Licenser_: now I'll take a shower, eat a burger and see if I add the class stuff next

11:56 ,(loop [_ (def x 1)] )

11:56 clojurebot: DENIED

11:56 Licenser_: nice :)

12:25 hmm I really would need a second livetime :(

12:36 Raynes: Licenser: It still doesn't seem to be working right.

12:36 When I tried (loop [] (recur)), it gave me a NullPointerException, and (range 1 100000000) just kept on going until the heap ran out of space.

12:38 programble: hello

12:38 is there a clojure equivalent to java's import java.io.* ?

12:39 Licenser_: Raynes: I tried the loop recure ad it worked, very odd

12:40 Raynes: Licenser: What about (range 1 1000000000)?

12:40 Licenser_: can you give me the exact code you ran (with creating the sandbox and all.

12:40 Raynes: Yeah, one moment.

12:40 Licenser_: http://gist.github.com/339388 This code is mostly from my bot.

12:40 Licenser_: thanks :)

12:41 arohner: programble: there's no equivalent

12:41 programble: :(

12:42 Raynes: programble: (:import (java.package Class1 Class2 Class3)) is close enough.

12:45 Huh. And now it seems to be throwing a security exception for every piece of code.

12:45 This is confusing.

12:46 Licenser_: Wow

12:46 Raynes: I'd love to fix this, but I need some kind of test case to work against :(

12:47 Raynes: Licenser_: http://gist.github.com/339394

12:47 Licenser_: ah sorry

12:47 I id miss that

12:47 Raynes: That is with a clean pull from your repo.

12:47 Licenser_: meh

12:49 Raynes: Licenser_: Having all sorts of trouble today. :p

12:49 Licenser_: Raynes: that is good, allows me to improve the library!

12:49 do you have a .java.policy file?

12:49 Raynes: Yeah.

12:50 Licenser_: okay

12:50 so that is not the problem

12:51 Raynes: Licenser_: You can't reproduce the example I pasted above? :o

12:51 Licenser_: Raynes: No, I had to make a .policy file myself :P

12:53 actually no I can't reproduce it o.O

12:53 Raynes: Oh joy.

12:54 Licenser_: http://grab.by/3cLO

12:54 Raynes: http://gist.github.com/339397

12:55 The exact code I'm using and the exact error I'm getting.

12:55 * Raynes sighs

12:56 Licenser_: Raynes: I don't know what is wrong with your copy

12:56 Raynes: Nor do I.

12:56 * Raynes reclones for the hell of it.

12:56 Licenser_: http://grab.by/3cLR

12:57 Raynes: Licenser_: A hah!

12:57 It's working now.

12:57 Licenser_: aha?

12:57 clojurebot: Paul Graham is the creator of the other new lisp

12:57 Licenser_: what did you do?

12:57 Raynes: Something must have happened to my clone.

12:57 I just re-cloned the repo.

12:57 LauJensen: C evaluates math exprs left to right, right?

12:57 Licenser_: pew okay that makes me happy :)

12:57 Raynes: Now let's see if the loop example works now.

12:58 Licenser_: :D

12:58 Raynes: Alright (loop [] (recur)) times out correctly, but (range 1 1000000) does not.

12:58 So, everything is working except that.

12:59 hiredman: what about (iterate inc 0)

12:59 Licenser_: Raynes: okay I'll work on the range

13:00 Raynes: hiredman: Same thing.

13:00 Licenser_: aha I think I know the problem!

13:00 :d

13:00 Raynes: :>

13:03 Licenser_: Raynes: actually for me it runs through :P

13:03 999999

13:03 no error at all

13:03 Raynes: I probably have a smaller heap.

13:04 Test with (iterate inc 0).

13:04 Licenser_: *nods*

13:04 Raynes: Same thing.

13:04 Licenser_: not exactly

13:04 a Heap exception is expected if you eat too much heap

13:04 it seems to be 'fast enough' not to trigger a timeout

13:04 hiredman: I imagine the lazy seq is being realized outisde of the sandbox

13:05 Raynes: hiredman: Bingo.

13:05 Licenser_: hiredman: yap it is, just fixed that :)

13:06 Raynes: :)

13:06 Licenser_: Raynes: I write a few tests and push a fix

13:07 Raynes: Alright.

13:07 Licenser_: I'm going to have to redo the changes I made, but I wont be able to do that until later. However, expect a pull request later tonight.

13:08 Licenser_: Raynes: cool thanks!

13:24 Raynes: Licenser_: If you get a chance, ping me when you get that pushed.

13:24 Licenser_: Raynes: of cause i'll give you a qry OK?

13:25 Raynes: Kay.

13:25 <3

13:25 Thanks.

13:28 Licenser_: I'm found a box in the create sandbox code I'd want to fix before pushing

13:50 programble: hm...

13:50 oh nvm

13:55 Licenser_: Raynes: you'll like how I implemented the class stuff :)

14:58 LauJensen: Is there a nice little util where I can inject a (debug-here) to get a repl once that code is eval0red ?

15:23 TobiasR: hey :)

15:23 im kinda new to clojure and got some trouble with compojure anyone able/willing to help me out for a couple minutes?

15:25 dnolen: TobiasR: ask way

15:25 Raynes: Licenser_: Doing (loop [] (recur)) does timeout correctly, but it doesn't stop. I don't think the thread is actually being stopped.

15:26 TobiasR: i built clojure/clojure-contrib and compojure from source and put all jars into a lib folder (subfolder of my project folder)

15:26 Raynes: Licenser_: Do (loop [] (recur)) and then watch your cpu.

15:26 dnolen: TobiasR: any reason you are not just using lein?

15:27 TobiasR: i think i got confused by it somehow but no, no real reason

15:28 LauJensen: ~google reddit clone in 91 lines of clojure

15:28 clojurebot: First, out of 64 results is:

15:28 Reddit Clone in 10 minutes and 91 lines of Clojure | BEST IN CLASS

15:28 dnolen: TobiasR: if you decide to do things from scratch you'll learn a lot but it will definitely be more confusing than just using lein.

15:28 clojurebot: http://www.bestinclass.dk/index.php/2010/02/reddit-clone-in-10-minutes-and-91-lines-of-clojure/

15:28 LauJensen: TobiasR: Go check that out :)

15:28 TobiasR: okay tyvm ill do that

15:38 Raynes: Licenser_: I'm going to toss you an email, just in case you don't get this.

15:48 notallama: i just put my monad library on git, because the contrib one isn't magical enough. http://github.com/hclarke/clojure_combinators

15:48 basically, i hacked a bit of type inference on. examples and more combinators will come later, probably.

15:54 jwr7: So I've been trying to dig into enlive, but just doing (html-resource "home.html") gives me a NullPointerException (enlive_html.clj line 38). Hmm.

15:55 dnolen: jwr7: enlive looks up resources on the classpath

15:55 jwr7: incidentally, I also get a NullPointerException when doing a C-c C-c in SLIME. C-x C-e works just fine, though.

15:56 dnolen: jwr7: I usually make a directory called resources under src. I use lein to manage the classpath. if you're using netbeans or an IDE, it should handle this for you as well.

15:56 jwr7: dnolen: bingo! Thanks! Though it actually _was_ in the classpath... after I moved it to where my other clj files were, it worked.

15:57 dnolen: I use SLIME. Actually, scratch that. I fight SLIME. By the way, what version of SLIME should I be using so that it works with swank-clojure and clojure-1.1?

15:58 I've been having all sorts of issues and I wonder what people actually use.

15:58 dnolen: jwr7: I got tired of fighting. I use ELPA to install SLIME and swank-clojure

15:58 jwr7: dnolen: Hmm... I could try that. I got used to using SLIME from CVS when working with CL.

15:59 dnolen: one downside is you have to do some work to get the ELPA SLIME to work with other Lisps. I'm playing around with other CLs at the moment so it's a minor annoyance for me.

15:59 I'm not playing around I mena

16:01 jwr7: dnolen: ok, thanks for the hints. I'll try using the ELPA versions and see where that'll get me.

16:01 dnolen: jwr7: should just work. usually take only a couple of minutes to setup.

16:02 jwr7: dnolen: it'll likely take more, as I have a huge baggage of .el customizations back from CL hacking days.

16:02 …but I'll give anything for a reliable SLIME and swank-clojure.

16:04 Licenser_: Raynes: I'm here :)

16:05 Raynes: Licenser_: Hi.

16:05 :)

16:05 I'll be leaving for a while soon, so I sent you the email anyways in case you didn't get what I said earlier.

16:06 Licenser_: *nods* Just read it :) thanks for the hint I fear you're right

16:06 Raynes: Licenser: One good thing: I think this might be the last bug you have to fix for a while. :)

16:10 Licenser_: Raynes: that makes me a sad Licenser, fixing bugs means people are using the code which gives me the fluffy feeling of being needed :P

16:11 Raynes: Hehe.

16:11 Licenser_: clj-sandbox is really important to me at this point. It provides a clean solution for my bot.

16:11 TobiasR: One more (probably stupid) question. The reddit clone worked fine. now i cut out everything except the import and the basic server stuff. Renamed the file etc. Edited the project.clj. But when i try lein compile i get "All :namespaces already compiled." lein clean doesn't work either and if i run the jar from ueberjar it doesnt find the class. Any idea what i might be doing wrong?

16:11 Raynes: Otherwise, I would have had steal hiredman's sandbox.

16:12 Licenser_: :) Raynes, I did the stealing for you :P so actually I'd call it borriwing since I asked ^^

16:12 Raynes: :p

16:12 Licenser_: hrm

16:12 future-cancle isn't a solution

16:13 Raynes: Licenser_: You might have to do what thunk-timeout does.

16:13 I'm not sure you can fix this with futures.

16:13 Licenser_: Raynes: I fear I might, but I'd had hoped that I would not have to get another peace from clojurebot, also I found the futures a cleaner less javaish solution

16:13 Raynes: Indeed.

16:14 But you need to be able to stop the thread.

16:14 Licenser_: I know

16:15 Raynes: Licenser_: I have to take off for a few hours. Good luck with the fixing of the code. :p I'll pull it and finish up when I get op.

16:15 home*

16:16 Licenser_: thanks, for the testing/help Raynes, I'll have the timeouts fixed by the time you get back :) take care and have a good time

16:17 hoeck: TobiasR: you could try to manually delete the classes and lib folders, and then try to lein compile or lein uberjar again

16:27 TobiasR: hoeck: did that already, still nothing

16:28 hoeck: i just run lein from the directory with the project.clj dont i?

16:28 Licenser_: Raynes: I fixed it, it seems future really isn't the solution, gladly hiredman solved the problem already, or actually Chousuke when I get it right from the comments

16:32 hmm how are futurs working exactly, it seems not usable to calce tasks, is that a feature or a bug

16:32 ?

16:33 dnolen: Licenser: calce tasks?

16:33 Licenser_: cancel sorry

16:34 dnolen: it create a new Future object which has a cancel method from what i can see looking at the source

16:34 ,(source future-call)

16:34 clojurebot: java.lang.Exception: Unable to resolve symbol: source in this context

16:38 Licenser_: hmm hmm

16:38 I tried feature-cancle but it didn't work

16:38 jwr7: Ok, so enlive is really, really cool. I'm trying to find out how to construct selectors at runtime and can't see a way to do it. I need to be able to select and do something to [:div.widget#widget-id], but I will know the actual widget-id at runtime.

16:39 hoeck: TobiasR: so your lein compile still gives the same "all :namespaces already compiled" message?

16:39 Raynes: ~def future-call

16:39 TobiasR: hoeck: yeah it does

16:39 i created a new lein project now

16:39 hoeck:but still, i guess i configured somethign wrong

16:40 Raynes: Licenser_: About to leave, but chouser and rhickey told me why it didn't work yesterday, or the day before. They'll be able to tell you.

16:40 Licenser_: okay thanks Raynes :)

16:40 hoeck: when invoking a lein on already compiled files, it does not print anything here, just silently quits

17:23 defn: hello everyone

17:23 'lo Licenser_

17:23 Licenser_: hi defn

17:23 how is your parser going?

17:23 defn: not much new in the last day or so

17:24 im gonna play with it right now i think

17:24 Licenser_: cool :)

17:24 defn: since we last talked i did make it output HTML

17:25 i think my next move is to weight code blocks which were said by people who a contributors

17:25 Licenser_: that is discriminatig :P I'll sue you if you do that

17:25 defn: :X

17:25 :)

17:25 * Licenser_ is just kidding of cause)

17:26 defn: hehe yes i know

17:27 Licenser_: you could run the code and wight in if a exception is trhown or not ;P

17:27 defn: wight?

17:27 ohhhh i see what you mean

17:27 Licenser_: weight sorry

17:28 defn: yeah i actually considered that

17:28 Licenser_: I am writing a sandbox library right now if you want to do that :P </advertisment>

17:28 defn: as long as the code ran in a handy little sanbdox and didnt do anything like write to files or execute anything

17:28 yeah!

17:28 gimme gimme Licenser_ !

17:28 :)

17:28 Licenser_: http://github.com/Licenser/clj-sandbox

17:29 defn: awesome

17:29 * defn is excited

17:33 * Licenser_ is glad to hear that

17:33 defn: now i just need to wake up

17:33 * defn smacks himself a couple of times with a cold fish

17:33 Licenser_: ewww I hate fish

17:34 defn: why do you think im smacking myself with one?!

17:34 Licenser_: you're a masochist?

17:34 defn: haha

17:42 Licenser_: defn: so if you want to use the lib feel free to ask me or annoy me :P

17:47 jneira: hi folks!

17:48 @clojurebot

17:49 Licenser_: hi jneira

17:50 jneira: , (use 'clojure.contrib.json)

17:50 clojurebot: java.io.FileNotFoundException: Could not locate clojure/contrib/json__init.class or clojure/contrib/json.clj on classpath:

17:50 jneira: jum where is json in clojure-contrin 1.1.0????

17:51 i am a bit confused with that

17:51 Licenser_: jneira: json-read json-write

17:51 that are what the libs are called

17:51 jneira: jum thnx but then i have a problem

17:52 Licenser_: jneira: shoot?

17:53 polypus: stylistic question: when you want to write the empty list, say in a recursive function with it as a base case. what do you guys write; (), '(), (list), nil ?

17:55 Licenser_: polypus: I personally would go with '()

17:56 defn: yeah, that's my sense also

17:56 polypus: that was my first choice. () seems a bit naked

17:56 Licenser_: yea I didn't even know that () works :P

17:56 and (list) seems unnessessary

17:57 Chousuke: and nil is not the empty list :P

17:57 polypus: no but it'll work as a base case for cons

17:57 Chousuke: right.

17:57 in that case I usually use nil

17:57 though most often that ends up being implicit due to use of when or something similar

17:58 Licenser_: Chousuke: the thunk-timeout function comes from you right? I wonder do you know why it does not work with future?

17:58 polypus: k thx guys

17:58 Chousuke: maybe futures are run in a threadpool or something (guess) :P

17:59 Licenser_: hmm

17:59 +

17:59 and the thread pool won't terminate when I tell it to? Sneaky sneaky

18:00 Chousuke: I wrote that function a long time ago. I don't remember what I did :P

18:00 Licenser_: heh

18:00 Chousuke: but I do remember that the thing uses a deprecated API to kill the thread

18:00 Licenser_: :(

18:00 Chousuke: so if there is a threadpool involved, that might not work.

18:01 But there's no way to kill a non-cooperating thread in java other than the stop method, which is deprecated :/

18:01 Licenser_: narf that is evil

18:01 KirinDave: hiredman: You around?

18:04 technomancy: futures run in the agent thread pool

18:04 Licenser_: ah and the thread pool stuff prevents them from being stopped, sneaky

18:05 technomancy: shutdown-agents would stop them, but then there's no way to start them again

18:08 Licenser_: technomancy: but that would stop all agents right not only the one that runs my task?

18:08 technomancy: Licenser_: yeah, it's a shotgun approach

18:08 sorry, not paying attention to context

18:08 Licenser_: heh :)

18:08 technomancy: no worries your answers are helping a lot

18:09 * Licenser_ could build a API to a power cutter and make the thread power down the computer when the timeout is reached

18:09 Licenser_: that would be the shoting approach :P

18:10 technomancy: beats an EMP

18:11 defn: Licenser_: would you mind taking a look at something for me when you have a chance? I am getting weird java heap sapce problems in my walton code all of a sudden and dont know where they came from

18:11 KirinDave: not for style points ;0

18:11 Licenser_: defn: I'd love to :)

18:11 defn: :)

18:12 Licenser_: ust drop me a link

18:12 *just

18:13 Chousuke: the shotgun approach would be to connect the computer to a machine that fires a shotgun.

18:13 I suppose that would kill the thread for sure :P

18:14 technomancy: Chousuke: lots of edge cases to consider though

18:14 Chousuke: yes. it might also kill the operator

18:14 technomancy: running out of ammo; damage being absorbed by the keyboard and display, etc.

18:14 defn: Licenser_: http://github.com/defn/walton/blob/master/src/walton/core.clj -- I swear the stuff from extract-code -> was working before -- but for some reason it breaks my REPL every time i use it now

18:15 Licenser_: Chousuke: is there a Java API for shotgins? And more importently can we model a clean functional layer around a shotgin? After all they do have a state pretty directly

18:16 defn: if there is not a shotgun library we need to build one

18:17 (defn pull-trigger [shotgun, direction] ...)

18:17 KirinDave: ugh. Annotations are the sand in my shoes.

18:17 Licenser_: defn: did you try to take a new repl?

18:17 KirinDave: Clojure + lots of interop annotations = misery.

18:17 defn: Licenser_: ive made a new repl like 4-5 times

18:17 it breaks every time i call the extract-code fn

18:18 find-lines works, but extract-code breaks it

18:18 but as i said, this was working fine before or i wouldnt have committed it

18:19 Licenser_: okay just to get sure :)

18:19 defn: *nod*

18:22 Licenser_: defn: did you add the sorted set method just recently?

18:23 that means your entire map gets computed, I think

18:23 that can fill your heap quickly I guess

18:25 defn: Licenser_: yeah, although just running find-lines without limiting my *print-length* makes it go nuts

18:26 Licenser_: heh

18:27 defn: i mean, i was able to run sorted-set before without any issue

18:27 just trying to figure out what changed

18:27 Licenser_: hmm

18:27 more data?

18:27 bigger search results?

18:27 defn: it should be the same data :\

18:27 can you run that without it breaking on you?

18:28 Licenser_: let me clone that

18:29 do you have the link to the data still=

18:29 defn: yeah it should be in the README

18:29 http://www.devinwalters.com/clojure-logs.tar.bz2

18:30 Licenser_: ah okay

18:30 *Gets the data*

18:32 defn: I get java.io.FileNotFoundException: Could not locate clj_html/core__init.class or clj_html/core.clj on classpath: (core.clj:1)

18:33 defn: you ran lein deps?

18:33 Licenser_: ah yea :P

18:33 good point

18:33 narf

18:33 defn: hehe :)

18:33 KirinDave: hiredman: Reping

18:33 Licenser_: I hoped lein repl would do that :(

18:33 KirinDave: uhg, bad word merge

18:33 defn: Licenser_: i got it to work after removing the sorted-set and reducing my print-length to 10

18:34 Licenser_: hmm

18:34 defn: ah-ha, if i add sorted-set it breaks

18:34 you were correct

18:35 Licenser_: :)

18:35 I keep getting no results, I wonder why

18:35 defn: M-x slime-set-default-directory

18:36 and then set the project root as your directory

18:36 Licenser_: you should not have your local thing as the defaullt ;)

18:37 better

18:38 and yes I got a OOM exception too

18:38 I guess you just find too much so it is odd

18:38 Mec: is it a problem to put a conditional before a call to swap! or do i need to put it inside the swap! call?

18:39 Licenser_: hmm hmm I even get it for an no hut situation

18:40 unless I'm mistaken and there is a lot of discussion about the concatcatcat function

18:41 I think apply might be the evil doer here

18:42 technomancy: Mec: "a conditional" is pretty vague

18:42 defn: i dont like evil doers

18:42 technomancy: Mec: if the condition affects the atomicity of the change it should be inside the call to swap

18:43 * Licenser_ tries something

18:43 Mec: technomancy: sorry, i check if the map has a key, and if not then i swap! with assoc

18:43 Licenser_: nope happens with set too

18:44 technomancy: Mec: in that case I think it's more correct to perform the check inside the swap to avoid (very unlikely) a race condition

18:45 Licenser_: wow I even get the problem when I remove the set thing

18:45 defn: Licenser_: yeah i just saw that as well

18:45 Mec: technomancy: ok thanks, i thought so

18:45 defn: Licenser_: something is very wrong here....

18:45 Licenser_: aye and I wonder what :)

18:47 okay even when returning the sort results I get this error, which is odd

18:49 defn: Licenser_: yeah it is a very angry piece of code

18:49 :(

18:49 Licenser_: we'll find the bad bad memory eater don't worry

18:49 defn: junkies!

18:49 jinkies! rather

18:51 Licenser_: defn: heh

18:52 it seems the data set is too big for the repl

18:52 (reduce + (map count parsed-logs)) creates a out of memory exception

18:52 defn: uh oh...

18:52 Mec: Is there a pastie site specific for this channel?

18:53 defn: Mec: everyone uses gists on github

18:53 Mec: they give nice syntax hilighting taboot aboot!

18:53 Licenser_: defn: if we can make it entirely lazy we should be happy

18:53 defn: Licenser_: yes, when does it become *un-lazy*

18:54 Licenser_: in the moment you search it

18:54 defn: oh! right! :)

18:54 Licenser_: im able to use find-lines

18:54 Licenser_: you are?

18:54 defn: i just need to make sure i have my *print-length* very low

18:55 i have it at 10 right now

18:55 (set! *print-length* 10)

18:55 Licenser_: defn: I used (def _ (find-lines ...)) so no output should have been given

18:56 defn: maybe print-level?

18:59 Mec: technomancy: could you see if this looks right? http://gist.github.com/339625

18:59 Licenser_: defn: no it's not a print issue, def does not print anything

19:00 technomancy: Mec: you might be able to perform the same thing with merge

19:01 defn: Licenser_: I just magically got this to work: (map #(re-find *regex* %) (find-lines "zipmap" parsed-logs))

19:01 where *regex* is: (def *regex* (re-pattern (str "\\(.*" "zipmap" ".*\\)")))

19:01 Licenser_: defn: fixed it :)

19:01 technomancy: (doc merge)

19:01 clojurebot: "([& maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result."

19:01 technomancy: merge the hash with {location {}} in such a way that the original hash "wins"

19:02 Mec: technomancy: ok, thanks

19:02 defn: Licenser_: i changed the map in parsed-logs to a pmap, but that's probably not that big of a difference

19:02 Licenser_: defn: making your search a global variable does not really seem like a solution :)

19:02 Mec: technomancy: lacking a merge function is that how you would do it or is there a cleaner way?

19:02 defn: Licenser_: heh

19:03 Licenser_: give me a second and I post you something

19:04 defn: it seems like it is working now after i removed the (remove empty?...)

19:05 technomancy: Mec: yeah, if I didn't have merge I'd do it like you pasted

19:05 Licenser_: 0.5s to run the query and no heap problems

19:05 hardly eats any memory

19:06 I'll fork and change it :9

19:06 defn: apply sorted-set and remove empty? both absolutely kill it

19:07 jneira: well people im stuck with java.lang.VerifyError: class xxx overrides final method meta.()Lclojure/lang/IPersistentMap

19:08 hi Licenser_

19:08 Licenser_: hi jneira

19:08 jneira: and everyone

19:08 Licenser_: defn: o.o forgot about the sorted set, testing right now

19:08 1.5s but no heap problem

19:09 jneira: i think is related to versioning ..

19:09 defn: i can live with that

19:09 Licenser_: was it the with-out?

19:09 im interested to see this

19:09 Licenser_: defn: no with everything :)

19:09 defn: haha d'oh

19:11 Licenser_: let me know when you make the pull request, and thank you again for helping me :)

19:11 Licenser_: defn: :) no worreis and yes I always wanted to try out that pull request thing :P

19:14 ericthorsen_: anyone know if the clojure assets on build.clojure.org are built with 1.5 or 1.6 ?

19:14 defn: hah Licenser_

19:15 i know the feeling

19:15 Licenser_: defn: sory that you are my guiny pig here :P

19:16 defn: Licenser_: Collaborating is fun

19:16 * Licenser_ just gives it a final test before pushing

19:17 Licenser_: defn: yap, sadly I hand't had the change to recolaborate that often yet :) so I am happy to finaly try out this pull requests

19:17 defn: *nod*

19:18 * defn eats a ginger snap

19:19 Licenser_: defn: you got a pull request.

19:20 jneira: mmm the error was caused for classes of a prev compilation

19:21 i guess

19:22 but i think errors continue being unfriendly

19:22 in clojure

19:24 defn: Licenser_: pulled

19:24 Licenser_: defn: and working for you too=

19:26 jneira: yeah! (public-timeline) working with core/contrib 1.1.0

19:27 Mec: is there a keybind to eval a whole buffer in emacs?

19:27 defn: Licenser_: yes it is :)

19:27 it was the with-out, huh?

19:27 jneira: c^c c^r

19:28 i think

19:28 Licenser_: without wat?

19:28 what?

19:28 clojurebot: what is short for ,(doc ...)

19:28 defn: Licenser_: errr with-open

19:28 * Licenser_ pushed again, have a look at the next commit :)

19:28 Licenser_: defn: this opens a file and ensures it is closed at the end of the (with-open) form again

19:30 Mec: jneira: thats just giving me a weird error

19:30 jneira: jum

19:30 defn: Licenser_: tricky! added the sandbox! :)

19:30 Licenser_: yap ;)

19:30 jneira: first you hava to select all buffer

19:30 Mec: oh

19:30 Licenser_: just wanted to see if it works, and it actually does, with hardly 5 LOC

19:30 defn: awesome!

19:31 Licenser_: so I can't guarantee that it actually is secure, or will not block coreckt code

19:31 jneira: M^< C^spc M^> and C^c C^r

19:31 well you can select all buffer with ...i dont remeber

19:32 defn: Licenser_: I can live with that for now :)

19:32 Mec: as soon as i hit C-c it deselects the buffer

19:32 Licenser_: so it is kind of coll that you only get examples that work actually

19:32 defn: yeah although one of them may run some java code that deletes your / partition

19:32 ;)

19:33 Licenser_: defn: that is very unlikely :P

19:33 * technomancy is interested in feedback from project maintainers, contributors, and potential contributors on a blog draft: http://p.hagelb.org/contributing.yml.html

19:33 jneira: jum

19:33 Licenser_: if you enable jvm security it should block that

19:33 technomancy: (heading out for a while, but please msg or email me with your thoughts if you have a chance to review it.)

19:33 Licenser_: and in theory the sandbox is quite tight since it's only letting you use a whitelist of functions

19:34 and I did not (partition-hard-disk) in there

19:34 jneira: C^x h to select all buffer

19:34 Mec: same thing, after that C-c deselects it

19:34 defn: Licenser_: hahaha, touche

19:35 Licenser_: but you can add that yourself if you liek the trhill

19:36 jneira: mmm C-c deselects? i am afraid not for me

19:36 defn: im all about the thrill Licenser_

19:36 :

19:36 :)

19:36 Licenser_: defn then you can use the debug-tester :P

19:37 that lets through all code

19:37 * defn gets out an old machine

19:37 defn: i think ill run it in a VM for now ;)

19:37 Licenser_: :P

19:38 defn: I /think/ even with that it should not whie your hard disk

19:38 so I have the feeling that 'thinking' is not good when it comes to security

19:38 Mec: jneira: ah i've got CUA turned on

19:39 jneira: cut & paste evil

19:41 defn: Licenser_: haha

19:42 Yes I think that thinking can be exactly the problem with security (I think)

19:43 Licenser_: don't think so much, just trust in the force!

19:43 defn: hahaha

19:43 Licenser_: I am your father.

19:43 Licenser_: no you're not :P

19:44 defn: okay time to go play with this walton code now that it's not breaking my REPL :)

19:44 thanks again Licenser_

19:44 Licenser_: you're welcome defn :)

19:54 defn: Licenser_: haha this sandbox is great

19:55 Licenser_: it turns 106 lines of matched code into 40

19:55 much better examples

20:07 Licenser_: defn: I'm really glad to hear that :D

20:07 There are so many applications for a sandbox that I just keep seeing them everywhere now

20:08 * Licenser_ thinks everyone should have one ;)

20:49 Mec: is there a way to use dissoc-in without it removing an empty map

20:51 chouser: the purpose of dissoc-in is to remove (dissoc) something -- why behavior do you want instaed of removing?

20:51 s/why/what/

20:52 Mec: i want to remove the inner key/val but not the map if it results in being empty

20:53 so like (dissoc-in {:a {:b :c}} [:a :b]) -> {:a {}}

20:54 chouser: oh, I see.

20:54 ,(update-in {:a {:b {:c :d}}} [:a :b] dissoc :c)

20:54 clojurebot: {:a {:b {}}}

20:56 Mec: oh nice, thanks

21:07 I read the description of update-in but it was hard to grasp

22:14 Raynes: Licenser_: I'm about to issue a pull requestion.

22:14 request*

22:25 Where is clj-io hosted?

22:25 I sees it, but I don't has it.

22:36 technomancy: Raynes: I don't think there's much difference between clj-io and clojure.contrib.io (and hopefully clojure.io in the future)

22:38 it's on clojars anyway if you don't want to pull in the rest of contrib

22:47 Raynes: technomancy: I was asking because I had no idea what it actually was.

22:48 Not because I wanted to use it. :P

23:22 rads: when I try to use congomongo in a leiningen task, I get this error: Exception in thread "main" java.lang.ExceptionInInitializerError (coerce.clj:1)

23:22 any ideas on what that means?

23:34 technomancy: Raynes: it was a way to propose clojure.io for inclusion in clojure itself before the clojure.lib idea came up

Logging service provided by n01se.net