#clojure log - Sep 02 2010

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

0:03 sleepynate: ugh.. classpaths. anyone use vimclojure? i'm trying to get the AOT compile of the pretty print thing in clojure-contrib

0:17 technomancy: sleepynate: if you can at all avoid it, don't compile contrib yourself

0:17 sleepynate: technomancy: you're telling me :D

0:17 i always forget exactly how i get it working

0:17 then i need to set it up again

0:17 technomancy: why do you need to set it up?

0:18 sleepynate: http://kotka.de/projects/clojure/vimclojure.html <---

0:18 but for now i just pipe it to a jline repl in tmux

0:18 technomancy: sleepynate: do you know about http://build.clojure.org/releases ?

0:19 sleepynate: technomancy: i don't.. but that doesn't have this pretty printer mod, does it?

0:19 technomancy: oh, you're trying to add your own modifications to contrib

0:19 gotcha; that is one of the few legitimate reasons to build it yourself

0:20 most people complaining about contrib build issues have no good reason to be trying in the first place.

0:20 sleepynate: Could not locate clojure/contrib/pprint__init.class or clojure/contrib/pprint.clj on classpath:

0:20 this is the actual one i'm getting

0:20 and i know i've fixed it before :)

0:21 ahh well.. i'll stick with my tmux pipe for now

0:21 just nice to get slime-like functionality in a *cough*decent*cough* editor

0:21 technomancy: tmux pwns

0:23 sleepynate: ya

0:24 technomancy: well, if you use vim, check out tslime :)

0:24 it ferries stuff back and forth to tmux

0:24 it's just not form/s-expression aware

0:26 technomancy: thanks but no thanks.

0:42 Bahman: Hi all!

1:02 replaca: sleepynate: what are your plans for pprint, out of curiousity

1:02 ?

1:05 sleepynate: replaca: none specifically, just vimclojure wants the one from contrib compiled

1:06 replaca: sleepynate: ahh, that's probably cause vimclojure is using an old version of contrib

1:06 sleepynate: pprint used to require compilation in 1.1

1:06 sleepynate: oh poop

1:07 i'm using 1.2 snap

1:07 replaca: so maybe you just want to grab a 1.1 contrib for vimclojure

1:07 sleepynate: git pull didn't yield anything new

1:07 fair enough

1:07 replaca: in what sense? There were a bunch of changes.

1:08 sleepynate: replaca: no no, no changes since i last compiled :D

1:08 replaca: but in 1.2, they should really be using clojure.pprint which is the new version

1:08 sleepynate: sure

1:08 replaca: not too many changes from c.c.pprint, though

1:09 sleepynate: maybe later i'll look at the build script

1:09 fix it for him :D

1:10 but that makes sense why i could before but not now

1:10 replaca: cool. good luck!

1:11 sleepynate: heh. thanks? :)

1:12 hmm, what's the clojure equiv of "all" in haskell

1:12 true if all in collection meet conditions of predicate

1:13 tomoj: every?

1:13 clojurebot: everybody looks good in a sheinhardt

1:13 sleepynate: (all? (zero? %) (0 0 0 0 0 0 0 0 0 ))

1:13 tomoj: ,(every? zero? [0 0 0])

1:13 clojurebot: true

1:13 sleepynate: tomoj: thanks

1:13 tomoj: i knew it was something not far off :D

1:19 rdeshpande: hi all

1:23 rubydiamond: technomancy: hey

1:23 what mode do you use for rhtml ?

1:23 rdeshpande: hey

1:24 which city ?

2:56 LauJensen: Good morning all

2:59 Raynes: Morning.

3:03 LauJensen: Raynes: What are you working on these days?

3:22 Raynes: LauJensen: Mostly sexpbot lately. That and Irclj.

3:22 LauJensen: Alright

3:22 Raynes: I have a little toy web development project that I've been neglecting, but plan to get back to soon.

3:23 LauJensen: Whats it about?

3:23 Raynes: Pastebin-like thingy.

3:24 It's mostly a learning thing.

3:24 LauJensen: Ah so you're doing some syntax highlighting? :)

3:24 Raynes: Try-clojure isn't really something I can cut my teeth on. I want to make it better, but I need experience for that.

3:25 LauJensen: Pretty hefty project for your first web app

3:25 Raynes: Actually, I've been considering that. I planned on highlighting with syntaxhighlighter, at least at first.

3:25 LauJensen: But it turned out okay

3:25 Raynes: Thanks to you.

3:25 :p

3:25 LauJensen: ha

4:21 jave: I have a little compojure project, that starts a jetty server in the background. when I reload the ns, the jetty is still running so it cant get the port and I get errors

4:22 is there some idiomatic way of handling this? I thought maybe using a global singleton

4:22 bobo_: jave: defonce instead of def i think solves that.

4:22 jave: ah

4:22 bobo_: on the jetty calling method

4:24 Raynes: jave: Yeah, defonce, or just put the code to run the jetty server in another ns.

4:24 LauJensen: usually it makes sense to have core/main start the server, and server/start-server to actually boot it

4:25 jave: hmm ok

4:25 something like this should work at leas then? (defonce dummyserver (future (run-jetty (var unibet-dispatch-routes) {:port 9090})))

4:28 Raynes: -> (letfn [(U [f] (f f))] ((U (fn [f] (fn [n] (if (= 0 n) 1 (* n ((f f) (- n 1))))))) 5))

4:28 sexpbot: => 120

4:28 Raynes: _fogus_: ^ Lovely monstrosity you got htere.

4:28 there*

4:28 esj: you can also use atoms: http://github.com/swannodette/enlive-tutorial/blob/master/src/tutorial/template1.clj

4:28 Raynes: Makes me want a roast beef sandwich.

4:32 esj: Raynes: where on earth did you excavate that ?

4:32 Raynes: esj: Twitter. It's fogus'

4:32 esj: you been messing with necromancy again ?

4:32 oh, then its correct ;)

4:34 although his partner is crime did try to destroy the universe yesterday...

4:41 raek: jave: don't forget to specify the handler function as "#'handler" and not "handler"

4:42 the latter takes the value that the #'handler var had at that time, and remembers that

4:42 the former lets the server remember the var itself

4:43 LauJensen: ie. so you can redefine it at runtime

4:43 raek: (vars when used as functions do a deref on themselves and call that)

4:44 jave: (defonce dummyserver (future (run-jetty (var #'unibet-dispatch-routes) {:port 9090}))) ?

4:45 hmm or not even the (var .. )

4:45 raek: exactly.

4:45 oh

4:45 #'foo = (var foo)

4:46 ,(var (var inc))

4:46 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol

5:00 jave: whats the idiomatic way of writing a config file? a java properties file? a separate ~/app.clj file outside the uberjar?

5:01 Raynes: I usually do something similar to the latter. Most of my configuration is just a map in a file that I read-string in the application.

5:01 kumarshantanu: jave: perhaps an external appconfig.clj and do an eval to get the properties?

5:01 LauJensen: jave: That comes up a lot, and it usually comes down to whatever makes the most sense for your ready

5:01 bobo_: i think lein does it nice?

5:01 LauJensen: s/ready/reader/

5:01 sexpbot: jave: That comes up a lot, and it usually comes down to whatever makes the most sense for your reader

5:02 LauJensen: Raynes: That function should append the (name) of the one who said it for quicker reads

5:03 Raynes: LauJensen: Like <LauJensen> message here?

5:03 That makes sense.

5:03 LauJensen: yea

5:03 Raynes: Good idea.

5:04 fliebel: do you guys keep logs of this channel somewhere?

5:04 LauJensen: Thanks

5:04 Raynes: fliebel: Yessir.

5:04 LauJensen: clojure-log.n01se.net

5:04 clojurebot: where are the logs?

5:04 clojurebot: make a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive

5:04 LauJensen: clojurebot: where is the log?

5:04 clojurebot: reverse psychology is even less rigorous than forward psychology

5:05 LauJensen: clojurebot: the log is at http://clojure-log.n01se.net

5:05 clojurebot: Alles klar

5:05 LauJensen: clojurebot: where is the log?

5:05 clojurebot: logs is http://clojure-log.n01se.net/

5:05 LauJensen: good boy

5:06 Raynes: I really need to set up my bouncer. ._.

5:07 $learn clojure-logs clojure-log.n01se.net

5:07 sexpbot: My memory is more powerful than M-x butterfly. I wont forget it.

5:26 kumarshantanu: rql looks interesting -- http://github.com/MrHus/rql

5:32 Chousuke: I don't like the bang functions.

5:32 they seem to be doing nothing more than (alter theref non-bang-fn args)

5:32 (in a dosync)

5:41 LauJensen: Chousuke: which bang fns are you refering to ?

5:42 Chousuke: the ones in the rql library

5:42 LauJensen: oh ok- I thought you wanted swap! reset! etc to be removed :)

5:43 Chousuke: heh, nah. those have no trivial replacement :P

5:43 I just think hiding alters and especially dosyncs in trivial functions is unidiomatic in Clojure :P

5:43 LauJensen: no, but Im sure Rich would remove them right away if you werent comfortable with them :)

5:44 Chousuke: yes, I'm sure :P

5:48 raek: bangs for functions that are safe to use in transactions?

5:51 Chousuke: yeah, that too :P

5:51 LauJensen: Has anybody had this issue with Miglayout? http://migcalendar.com/miglayout/cheatsheet.html states that "gab 5px" is a valid component contraint, yet adding it to a single components gives me a Illegal Constraint: 'gab 5px' Unknown keyword called from 0: net.miginfocom.layout.ConstraintParser.parseComponentConstraint(Unknown Source)

5:51

5:52 Chousuke: gab? not gap?

5:52 tomoj: seems a bit weird that the bang fns are called "persistent variants"

5:54 LauJensen: Chousuke: Its a pleasure to have you on board, thanks for catching my typo :p

5:54 Chousuke: LauJensen: you need more coffee :P

5:54 LauJensen: Haha!

5:54 cruel...

5:55 fliebel: LauJensen: Coffee diet?

5:55 LauJensen: http://bestinclass.dk/index.clj/2010/08/developer-productivity--the-red-pill.html

5:55 (for odd reasons, my most popular blogpost yet)

5:56 Even beating my Tribute to Steve Ballmer I think :)

5:56 fliebel: (not so odd at all…)

5:56 LauJensen: Well, I wrote it because I had promised to do so, I was feeling more inspired to blog about Clojure, so it felt like 'work' doing it, where many of the others have been pure fun

5:57 raek: Clojure is all about pure fn for me ;)

5:59 fliebel: LauJensen: You read those articles about digg mafia and vote rings? It's all about getting the first 5 votes fast, which happened to you by accident by the kind people of #clojure. I'm sure that if you manage to get some other posts on the frontpage of HN, they'll be just as popular.

6:00 LauJensen: fliebel: Naah I haven't heard about them

6:00 But yea, it was definitely lifted by #clojure

6:01 fliebel: raek: defnitely!

6:09 jave: load-file doesnt seem to be very good in a program, why is that?

6:09 I wanted to load and eval a config file

6:13 Raynes: (doc load-file)

6:13 clojurebot: "([name]); Sequentially read and evaluate the set of forms contained in the file."

6:13 Raynes: It seems to do the trick.

6:14 LauJensen: As long as a hacker cant get to the config file, otherwise you're in a lot of trouble

6:15 Raynes: LauJensen: Couldn't a hacker just as easily modify the code of the Clojure application itself, assuming it isn't AOT compiled?

6:16 LauJensen: 'assume'

6:17 Raynes: People rarely AOT compile their code. At least, I thought.

6:17 If you say 'thought', I'll come to Denmark and hunt you down.

6:17 LauJensen: 'hunt'

6:17 Raynes: :-)

6:17 LauJensen: On some projects, its not an option to deploy with the source

6:18 Raynes: Fair enough.

6:18 esj: and some java interop requires AOT

6:18 Raynes: It still isn't that common.

6:18 esj: yeh - izza pain in the bum

6:19 Raynes: Most of what I've seen AOT used for in open source projects is for a main class for executable jars.

6:19 There is a ticket to add a parameter to clojure.main to do something similar without AOT.

6:20 I was hoping it would get into 1.2.

6:20 LauJensen: Raynes: You can do it yourself with Cake

6:21 Raynes: I'm not surprised.

6:21 Cake is pretty impressive.

6:22 LauJensen: Yes Im thorougly impressed by it myself

6:22 And I dont even think I can spell that

6:22 Raynes: throughly?

6:23 LauJensen: yea

6:23 esj: i missed cake - that looks truly nice

6:23 Raynes: I've been using it for a while.

6:23 LauJensen: esj: The way it handles task dependencies is übercool

6:23 Raynes: I was actually supposed to work on lowering memory usage in that thing a bit tonight. I forgot about it. ._.

6:23 LauJensen: So you can extend 'compile', 'uberjar' etc

6:23 Raynes: Just buy more RAM

6:24 esj: that's really nice.

6:24 Raynes: LauJensen: RAM is costly on VPSs.

6:24 esj: I'm currently committed to learning Maven properly. One build tool at a time :)

6:24 Raynes: They're going to switch to Ivy in cake soon.

6:25 LauJensen: esj: After that you should really learn QBasic as well, that another outdated technology

6:25 And then maybe... maybe try Pascal, the DOS version

6:25 Thats awesome too

6:25 esj: LauJensen: this is a fair point

6:25 Raynes: LauJensen: What about FORTRAN?

6:25 LauJensen: True, you cant learn Maven and not Fortran

6:25 bobo_: except, maven isnt awesome

6:25 * esj actually has some consulting work in Fortran currently. No jokes

6:26 esj: maven is nice because it has an ecosystem

6:26 bobo_: indeed

6:26 esj: so i can get a lot done with it chop-chop

6:26 LauJensen: esj: like a sweathy shoe after a good work-out, it also has a little ecosystem :)

6:26 esj: yummmmmmmm

6:30 noidi: there must be something wrong with me, but I actually quite like maven :)

6:31 I bit the bullet and tried it after reading this article, and after the steep learning curve it's been just fine http://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer

6:31 esj: noidi: yup, me too.

6:32 LauJensen: Hmm. nice, so you actually get over the 10k lines of XML ?

6:32 noidi: hehe, it's not that bad with nxml-mode :)

6:32 bobo_: my question is just why?

6:32 leinigen is so easy, so much less text

6:33 one good thing with maven is, that you can open the project in netbeans/eclipse/idea, but thats about it

6:33 LauJensen: bobo_: Dont compare with lein, compare with cake

6:34 fliebel: cake?

6:34 clojurebot: cheesecake is delicious.

6:34 LauJensen: I would say Maven would have been my choice for a cross platform build if Cake wasn't around

6:34 bobo_: oh, cake can cross platform?

6:34 LauJensen: fliebel: http://github.com/ninjudd/cake

6:34 bobo_: yea, amazingly simple

6:34 bobo_: i need to stop working, so i have time for everything

6:34 esj: currently I use it because it plays nicely with my CI, repositories etc

6:34 LauJensen: And I have one customer, who requires the build to run on a Windows server, so cake saved me from the XML

6:34 http://github.com/ninjudd/cake/wiki/Cake-on-Windows

6:35 noidi: well, maven has plugins for pretty much everything

6:35 LauJensen: noidi: cake lets me do tasks in clojure, so I dont need your plugins

6:35 esj: (by repositories, I mean a local binary artifact repo)

6:36 LauJensen: esj: cake is no different, you can also install local artifacts

6:36 noidi: maven vs make-like systems (where you write your own tasks) is like word vs latex

6:36 LauJensen: with a single command, and you dont need to spend 5 minutes writing up the xml documentation afterwards

6:36 noidi: please dont bring MS products into this

6:37 esj: LauJensen: I phrased that poorly, twice. Up late last night. I'm trying to say, Nexus.

6:37 LauJensen: Anyway, if you guys like your XML and you can actually find people who are happy to see you sit there and write out <start></stop> tags all day, Im happy for you, but if you get fed up, try Cake :)

6:38 fliebel: LauJensen: So Cake is like Nailgun for Leiningen? (they should add that to the thisisforthat site)

6:38 esj: LauJensen: I absolutely will, of course. But Maven does currently scratch my itches.

6:38 LauJensen: fliebel: thats part of it

6:39 Another big part is the gem based install, another is their unique way to handle tasks and dependencies

6:39 noidi: I pretty much only modify my pom.xml manually when adding a new dependency

6:39 LauJensen: But ready the github page, they did a good job of documenting

6:39 noidi: and even then I copy and paste the <dependency> tag from a web page, so it's really not painful

6:39 LauJensen: -y

6:39 fliebel: LauJensen: Strange thing to write a Clojure package manager in Ruby...

6:40 LauJensen: fliebel: Not strange at all. Its an expressive cross platform language

6:40 Makes a lot more sense than bash

6:40 fliebel: LauJensen: How about another nice language called Clojure? :P

6:40 LauJensen: fliebel: Most of it is written in Clojure

6:41 its the bootstrap and install stuff thats in ruby

6:41 noidi: I was just about to say that dismissing Maven for XML is like dismissing Cake for being written in Ruby ;D

6:41 LauJensen: the same stuff thats in bash for lein

6:41 fliebel: LauJensen: Make sense… Ruby is strange though, tried to learn it yesterday…

6:41 LauJensen: strange? its like python just with more syntax :)

6:42 python is like PHP, just with less dollar signs :)

6:42 PHP is like a ... a free ride when you're already late? :)

6:42 noidi: the biggest difference between Python and Ruby are the cultures

6:42 fliebel: Clojure is like Ruby, only with more parens, and IMMUTABLE stuff!

6:42 noidi: I prefer Ruby as a language but Python as a development cultrue :)

6:44 fliebel: Actually, Clojure is the anti-Ruby, is Armageddon nearby?

6:44 LauJensen: Ive always found Python to be the most clean language of the two

6:44 mrBliss: Clojure is also a ****load faster than Ruby and Python

6:44 LauJensen: mrBliss: Naah, I dont think we can keep up with Python

6:44 noidi: mrBliss, for long running tasks yes, but for things like the cake launcher, the startup cost of the JVM is prohibitive

6:45 LauJensen: noidi: not even for long running things, Python is blazing

6:45 fliebel: Nailgun?

6:45 LauJensen: and mutating is a lot faster than path copying

6:45 mrBliss: show me some benchmarks

6:45 LauJensen: http://bestinclass.dk/index.clj/2009/12/clojure-vs-ruby-scala-transient-newsgroups.html

6:45 noidi: well, start a hello world in python and clojure

6:45 :)

6:45 mrBliss: but without the startup time

6:45 LauJensen: At the bottom, someone contributed a very nice Python solution, which blew all the other languages out of the water

6:46 I saw several attempts in F#, but ultimately nobody could produce a working program

6:46 noidi: + Ruby and Python have loads of modules to make shell scripting type of stuff easy

6:47 I think Ruby is just about the best choice for writing the launcher for a cross-platform Clojure build tool

6:47 AWizzArd: It seems python and ruby are supported natively on Android.

6:47 LauJensen: noidi: agreed

6:48 noidi: it would be a with Python, but the default Ruby install comes with Gems and Python's Setuptools need a separate install :)

6:48 AWizzArd: While Clojure can be introduced through some other ways. But it will run without jit and might not be very fast. Hopefully this will change soon.

6:48 noidi: *would be a tie

6:49 cemerick, I just linked to your article about building Clojure projects with Maven. Thanks for writing it, I've been a happy Maven user since reading it 5 months ago :)

6:50 cemerick: glad to hear it :-)

6:50 mrBliss: I'm not talking about the best choice for a build tool, but Clojure is faster than Python.

6:50 http://shootout.alioth.debian.org/fastest-programming-language.php?java=on&python=on&python3=on&yarv=on&calc=chart

6:50 You could say clojure is 1.5~3x slower than Java

6:51 noidi: I think the more relevant question is "is this language fast enough for my use case"

6:51 and 90% of the time any language will do

6:52 mrBliss: noidi: you're right

6:52 cemerick: alioth numbers are here, so all our questions are answered :-P

6:53 mrBliss: it's only *a* benchmark, but still ;-)

6:54 * AWizzArd thinks that languages can not be fast.

6:54 * esj taps his hat to AWizzArd's clear thinking

6:55 LauJensen: mrBliss: Why do you keep saying that Clojure is faster than Python?

6:56 AWizzArd: LauJensen: he is talking about specific implementations of those langs, not the langs themselves

6:56 LauJensen: Ok

6:56 mrBliss: Is Python interpreted?

6:57 noidi: yes

6:57 mrBliss: so it is slower than Clojure IMO

6:57 (not talking about the aptness as a build tool)

6:57 esj: no, as LauJensen points out, things like mutabality trump that.

6:58 LauJensen: hehe

6:58 AWizzArd: Tho there are trillions of mutable containers for Clojure too.

6:58 esj: LauJensen: see, sometimes I can agree with you :)

6:59 LauJensen: esj: I know - Every time you're right about something :)

6:59 esj: took the keystrokes right off my fingertips....

6:59 fliebel: So, my super reliable benchmakr says Python is faster than clojure with printing hello world 1000000 times.

6:59 mrBliss: btw Python has the GIL

6:59 fliebel: that's true

6:59 LauJensen: mrBliss: 1) Its being fixed rapidly, 2) You dont have to use it

7:00 fliebel: Python: 4.7540531158447266 Clojure: 32294.985

7:00 Why this huge difference?

7:00 mrBliss: JVM startup time

7:00 AWizzArd: fliebel: depends on how you measured

7:01 fliebel: Python: timeit.Timer('print "hello world"').timeit() Clojure: (time (dotimes [n 1000000] (println "hello world")))

7:02 LauJensen: The benchmark on my site is good, because you see both numerical crunching, IO and multithreading

7:03 mrBliss: What I'm trying to say is: Java and also Clojure are closer to C/C++ in speed than Python/Ruby/Perl

7:03 LauJensen: I'll try to come up with a faster Clojure version ;-)

7:03 AWizzArd: fliebel: was this really your test? If yes then I don’t understand why this python code writes one mio hello worlds

7:03 LauJensen: mrBliss: Thats just silly

7:03 fliebel: mrBliss: So how do you explain things like JRuby?

7:03 LauJensen: You cant compare the performance of Ruby with Python, they are completely different beasts

7:03 Python is much closer to C++ than Clojure

7:04 mrBliss: JRuby is something different

7:04 fliebel: AWizzArd: timeit defaults to that value.

7:04 mrBliss: LauJensen: Python also closer to C++ than Java?

7:05 LauJensen: mrBliss: In some cases - There's no one answer fits all with benchmarking

7:05 Sometimes Java is faster than C++

7:05 fliebel: LauJensen: Where's the benchmark on your site?

7:05 LauJensen: http://bestinclass.dk/index.clj/2009/12/clojure-vs-ruby-scala-transient-newsgroups.html

7:06 AWizzArd: fliebel: what needs to be imported so that I can try your example?

7:06 fliebel: AWizzArd: improt timeit

7:06 *improt

7:06 *i-m-p-o-r-t

7:06 AWizzArd: and for you this runs in 4.75 milliseconds?

7:07 LauJensen: http://download-llnw.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html

7:07 fliebel: AWizzArd: seconds

7:07 LauJensen: Any idea what these Bevels are that they are using ?

7:18 esj: What do you fine gentlemen use for grids on webpages ? I'm currently use this: http://dhtmlx.com/docs/products/dhtmlxGrid/ but wonder what else out there is good ?

7:20 AWizzArd: fliebel: one reason I could think of: does the Python version flush after each print?

7:20 For me (time (dotimes [i 10000] (println "hello world"))) and (time (dotimes [i 10000] (println "hello world") (flush))) take the same amount of time.

7:21 mrBliss: printing to stdout involves interrupts

7:24 noidi: esj, years ago, when I still did web stuff, our designers used this http://www.blueprintcss.org/

7:25 esj: noidi: merci.

7:25 noidi: ack, ignore that

7:25 I didn't check your link before pasting mine

7:26 I thought you meant this http://en.wikipedia.org/wiki/Grid_(page_layout)

7:26 LauJensen: Does anybody have an exhaustive list of Swing Components with pictures?

7:26 cemerick: esj: I found http://960.gs the simplest, when I was looking some months ago.

7:27 noidi: phew, I wasn't the only one who made the same mistake ;)

7:28 cemerick: esj: hah, sorry :-) I don't think of tables as "grids".

7:28 esj: cemerick: :)

7:29 cemerick: esj: In that case, http://datatables.net/ :-)

7:29 alienscience: esj: I used the ExtJs grid about a year ago and wasn't impressed

7:29 esj: alienscience: thanks.

7:30 cemerick: Datatables' API is not pleasant, but it's jquery interop makes up for it.

7:30 LauJensen: Thanks for nothing : http://download.oracle.com/javase/tutorial/ui/features/components.html

7:38 AWizzArd: fliebel: Can you please import sys and see if timeit.Timer('print "hello world"; sys.stdout.flush()').timeit() makes any difference?

7:42 fliebel: AWizzArd: sure

7:43 5.3126370906829834

7:44 AWizzArd: ok, so only a mild difference

7:44 fliebel: AWizzArd: I did notice that Python prints one line at a time, while Clojure seems to print random(and smaller?) chunks

7:45 defn: fliebel: I just got your email and wrote a short response

7:45 fliebel: I've been /really/ busy this week, my last week of work at this job, moving to a new apartment, and starting school

7:46 Raynes: Does requiring namespaces with the :reload option have a tendency to build up memory?

7:46 defn: if you give me until Sunday I can respond on basecamp and we'll get started

7:46 fliebel: defn: great :)

7:46 defn: Take as mutch time as you need, but just let me know what's up :)

7:46 defn: I'm excited to have some time to finally commit to it -- this job has been draining me :)

7:46 fliebel: will do! now, time to move a couch!

7:47 fliebel: *gives defn a CouchDB*

7:47 defn: {:couch_location "other apartment"}

7:52 AWizzArd: fliebel: I think this comes from the Buffer that println uses. It contains, say, 1024 bytes, and then flushes, even if one line is not fully written.

7:53 fliebel: AWizzArd: So would it be faster to use other java output functions?

7:55 AWizzArd: I am not sure. If printing is really important one could use a StringBuilder into which one writes the hello worlds and then outputs that one.

7:56 Licenser: morgen

7:56 fliebel: Licenser: Moguh

7:57 Licenser: morgen fliebel

7:57 AWizzArd: fliebel: Probably Javas print methods do a good bit more extra work under the hood, but with some low level optimizations one should be able to reduce the time.

7:58 fliebel: (Licenser: Where are you from?)

7:58 Licenser: fliebel: germany

7:59 fliebel: AWizzArd: Let's focus on more interesting things...

8:00 Licenser: Ah, I was hoping I had found another Dutch Clojurer. Well, it's at least the same continent.

8:01 Licenser: Ah you're not that far away fliebel ;)

8:01 mrBliss: fliebel: I'm from Belgium!

8:02 * AWizzArd lives very close to the Netherlands (Maastricht) and Belgium (Liège)

8:02 fliebel: mrBliss: Even closer, language-wise :)

8:02 mrBliss: inderdaad

8:03 fliebel: *having thoughts about Clojure conferences and stuff*

8:05 Licenser: the conference is too far away :(

8:05 even so I'd love to go

8:05 fliebel: where is it?

8:05 citizen428: and i'm from austria. we should have a clojure conf somewhere around here :-)

8:06 fliebel: yea...

8:06 Licenser: fliebel: in the US

8:06 fliebel: Okay, lets do an EU conference! :)

8:07 Licenser: that I'm all for, we thought about doing something in germany already

8:07 lets come all to berlin :P it's a nice place

8:09 fliebel: Sure :)

8:10 Or how about Loenen? It's a bit small, but I know a school we could use :)

8:11 bobo_: we all know stockholm is the best place in europe

8:11 fliebel: uh… oh… really? Well, fine with me :)

8:11 Licenser: bobo_: berlin is!

8:12 bobo_: :-p

8:12 noidi: berlin's awesome :)

8:12 bobo_: berlin is probably the only town in germany i havent been in

8:13 fliebel: bobo_: So how can you teel stockholm is better?

8:13 bobo_: i live here?

8:14 fliebel: then Loenen is equally good, if not better, because I live here and we have the highest waterfall of the whole netherlands, which is a good laugh.

8:14 bobo_: how big is it? =)

8:15 fliebel: bobo_: I think I'm the only Clojure programmer who lives here, and the same is probably true for a lot of things.

8:15 But thuse I'm also the best Clojure programmer in town :)

8:15 Licenser: fliebel: 2 meters?

8:15 and I thought rick lives in the US

8:16 fliebel: Licenser: I'm about to fin out… we have NBS to keep track of those things.

8:16 Licenser: NBS?

8:16 Netherland Broadcasting Service?

8:17 fliebel: CBS… Central office for statistics

8:17 Licenser: Oh

8:18 well but yes we should do it in Loenen, might be the last chance before it gets flooded :P

8:18 so on the other hand, yes we should really do a european clojure conference

8:19 fliebel: There's 8000 people in Loenen I think.

8:19 Licenser: Yea, we should :)

8:19 Licenser: yes but it is in the netherlands, you all will get flooded

8:20 fliebel: Licenser: Not in Loenen, we're on top of a hill, at least 4m above sea :D

8:20 Licenser: Oh cool, then we might not have to do it there and can stay in Berlin :P

8:23 fliebel: Licenser: Okay… Will you organize everything?

8:23 Licenser: given it happens when I am actually in Berlin I'd be glad to help :)

8:24 bobo_: i could most likely help asweel, whatever i can do from sunny sweden that is

8:24 raek: count me in too!

8:24 (+ what bobo_ said)

8:24 fliebel: bobo_: That sunny part sounds good, maybe we should do it in sweden? Only rain down here...

8:24 Licenser: wow sweedish clojurans

8:25 bobo_: Licenser: there are loads of sweedish clojurans!

8:25 fliebel: I only know sweedish cooks :)

8:25 Licenser: *snickers*

8:25 bobo_: about 15-20 people attending the stockholm clojure user group!

8:25 Licenser: I envie you bobo

8:26 AWizzArd: Licenser: soon we will manage this in Germany too :)

8:26 Licenser: AWizzArd: I hope

8:28 fliebel: Awesoe, didn't know that..: http://groups.google.com/group/amsterdam-clojurians

8:29 But yea, I also want to help + what bobo_ said

8:30 krl: Licenser: there's been some berlin lisp meetings with clojure involved

8:31 Licenser: I know there was one but I wasn't aware they were frequent

8:31 krl: well. they're not very frequent :)

8:31 Licenser: krl: you're from berlin?

8:31 krl: yeah

8:32 or, i live there rather :)

8:32 Licenser: wooh a neighbour

8:32 same thing, once you arrive here you get assimilated

8:32 krl: Licenser: http://netzhansa.com/mailman/listinfo/lisp-berlin

8:33 a bit dead

8:33 Licenser: nice thanks :)

8:33 berlin also has a erlang community I learned recently

8:34 krl: next meet should be 7th sep

8:34 fliebel: So, krl, Licenser, When's the first EU Clojure Conj?

8:35 alienscience: An EU Clojure conj would be supercool - I'm in Nuernberg

8:35 Licenser: good question, I'd say after the US one, we should not bundle them too tightly ^^

8:36 raek: is it ok to use a -jure name if you came up with it before technomancy's leiningen patch that prohibits it? :-)

8:36 fliebel: Good :)

8:38 Licenser: raek: you can stil do them just o lein new blajxre and then rename it :P

8:39 fliebel: Licenser: Or we do it at the exact same time, so we can have live video from one continent to the other, :D

8:39 Licenser: nah that would be taking away people to go to the US not sure if that is good

8:39 fliebel: okay

8:40 raek: I know... but will people get angry if I do it? :-7

8:41 alienscience: raek: I think it would be cool. From what I understand the jure thing wasn't done in that much seriousness.

8:42 If you really wanted some fun you could right a newjure plugin for leiningen

8:42 s/right/write/

8:42 sexpbot: <alienscience> If you really wanted some fun you could write a newjure plugin for leiningen

8:43 Raynes: Or use cake.

8:46 esj: Raynes: wait ! I know the answer to this one :)

8:55 cemerick: technomancy: I'd be interested to hear what you have to say on this topic: http://bit.ly/cB8HtG

8:56 raek: is there anything like clojure.string/blank? that uses Character/isSpaceChar instead of Character/isWhitespace?

8:57 raek: focus on the *real* problem. there isn't time to be a Unicode perfectionist all the time...

10:44 pdk: ,(/ 1280 720)

10:44 clojurebot: 16/9

10:45 pdk: ,(/ 384 224)

10:45 clojurebot: 12/7

10:52 _na_ka_na_: hey guys I have a question regarding clojure transactions.. suppose i have.. (dosync (when (= val @aref) (alter aref ...))) .. will clojure hold the lock on aref even if (not (= val @aref)) ?

10:53 I want compare-and-swap kind of semantic for aref

10:53 it has to be ref only . .can't use atom ..

10:55 kumarshantanu: any counterclockwise user here? I need to understand how auto-reload works

10:56 _na_ka_na_: i am

10:57 kumarshantanu: _na_ka_na_: the auto-reload feature is new in 0.62, which I don't understand how to use: http://code.google.com/p/counterclockwise/wiki/ReleaseNotes

10:57 lpetit: Hi there

10:57 _na_ka_na_: Maybe I can help

10:57 _na_ka_na_: ofc lpetit :)

10:57 lpetit: what's the question exactly ?

10:58 _na_ka_na_: i'm still at 0.0.60 ..

10:58 kumarshantanu: lpetit: how can I run a file with auto-reload ON?

10:58 I am doing some web developoment using compojure, and need auto-reload to be ON

10:58 lpetit: you cannot

10:58 you must start the Clojure JVM from the project's node.

10:59 kumarshantanu: lpetit: when I run (use 'my.ns) in the repl, it works

10:59 lpetit: You should see the builder do its stuff in the background, and all your namespaces will have been loaded for you in the Clojure VM

10:59 kumarshantanu: lpetit: ah okay

10:59 _na_ka_na_: lpetit: are you not making release announcements anymore? i didn't even get a 0.0.60 release notice

11:00 lpetit: I've set the defaults along this rationale: you start the CVM (Clojure VM) from the project's node = you are in "project mode" => auto reload is ON. You start from anything else (specific file, specific editor) => auto reload is OFF.

11:01 kumarshantanu: lpetit: so, do I need to (use 'my.ns) in the REPL to actually run my project?

11:01 lpetit: _na_ka_na_: you're right. 0.0.60 was shipped ~ 10 minutes before I went to holidays => quick release, no announcement. And 0.0.62 (I skipped by error a version number) was lazily shipped without release announcement. but I'll start again with good habits, I promise

11:02 kumarshantanu: if you're doing "select the project node" > trigger the contextual menu > Run as Project Clojure VM, then no

11:03 _na_ka_na_: lpetit: okay - i stumbled upon 0.0.60 by mistake .. when installing ccw on my friend's m/c ..

11:03 lpetit: kumarshantanu: if you're doing "select myproject/src/my/ns.clj" > trigger the contextual menu > Run as Clojure VM with specified file loaded, then no. (but then you won't have auto-reload)

11:03 kumarshantanu: lpetit: I got it, thanks

11:04 lpetit: it's awesome

11:04 lpetit: kumarshantanu: if what I said above doesn't work for you, then there's a bug somewhere :)

11:05 kumarshantanu: lpetit: it's working fine (project mode)

11:05 lpetit: feww :)

11:06 kumarshantanu: lpetit: I understand the project mode loads all namespaces (and keeps reloading)...is that right?

11:06 lpetit: yes

11:06 from the project > you want to load the project. And auto-load makes sense since you wanted to load everything at startup

11:06 _na_ka_na_: ooh 0.0.62 has cntl+click .. nice .. i've to check it out!

11:07 lpetit: from the file > you want to load the file, but just the file. auto-load as a default makes less sense, so it's off.

11:07 kumarshantanu: lpetit: that's terrific for interactive development -- I am using compojure and ring-jetty-adapter and I can add routes dynamically and do whatever and it gets reflected on the browser

11:08 lpetit: kumarshantanu: you're on the side of people who like to save and forget -as I generally do- :)

11:08 _na_ka_na_: and "documentation hover" is around the corner, 75% done locally :)

11:09 _na_ka_na_: ctrl+click is pretty young feature, please test and report issues :-)

11:10 _na_ka_na_: lpetit: even though i would love to help with development of ccw .. i only have 24 hours in a day :( ... why don't you make a way so people can donate for ccw!

11:11 lpetit: _na_ka_na_: mmm, let's me think about it :)

11:13 _na_ka_na_: lpetit: btw i'm 'ka' who responds on ccw google groups (if you remember)

11:14 lpetit: oh yes, ok. If you change your nicks for every channel, it'll be difficult to follow :)

11:14 kumarshantanu: lpetit: with all these features the CCW version can be easily bumped to 0.1 (if not higher) :-)

11:15 _na_ka_na_: kumarshantanu: maybe lpetit wants to remain modest :P

11:15 kumarshantanu: 0.0.62 is injustice to the current CCW feature set

11:16 _na_ka_na_: do you know any people who think - oh its not even 0.1 ? i wont use it ?

11:17 kumarshantanu: _na_ka_na_: not really; even I have been using CCW since its early clojure-dev days

11:18 lpetit: kumarshantanu: I'm currently following the simple idea of correctly identifying versions. And since I do not intend to have several maintenance branches, it works just well. Insisting on just growing one number tries to make it clear that the number for itself means is nothing more than an identifier.

11:19 But you're right, someday I'll switch to the classical 0.65.0 so that it's easier to spot bugfix-only releases from feature(+possibly bugfix) releases

11:19 _na_ka_na_: lpetit: one suggestion .. can we have indent whole block .. i.e. I select a block and press tab or cntl+I .... it would be really useful

11:20 currently it works only line by line

11:20 lpetit: _na_ka_na_: I know that :)

11:20 _na_ka_na_: it's in my head already. If you want to add it as a separate entry in the issue tracker, you're welcome

11:22 _na_ka_na_: lpetit: its coz my project partner uses emacs with some wierd config ... which messes up the whole indentation for me (introduces tabs etc.) .. but it looks just ok on his emacs .. then i have to do it line by line

11:22 i like that ccw has a single policy .. only 2 space config by default

11:22 lpetit: i'll add to issue tracker

11:23 lpetit: _na_ka_na_: it's as it is partly because it's opinionated, partly because of lack of time for making it configurable :-p

11:23 _na_ka_na_: lpetit: that's ok, but the default shouldn't change from 2 spaces .. :)

11:25 kumarshantanu: lpetit: _na_ka_na_ wants <Ctrl+Shift+F> (under "Source" menu in Java files) implemented it seems ;-)

11:25 for Clojure that is

11:26 lpetit: huh ? I thought I had disabled this feature ...

11:26 _na_ka_na_: lpetit: he means similar to the java one

11:26 lpetit: no it won't be "format block", but probably "reindent block"

11:26 at least in a first release

11:26 _na_ka_na_: ya I want re-indent block

11:26 simard: what should I use as an array in clojure ? say I want to code... conway's game of life..

11:27 lpetit: So it will be Ctrl+Shift+I I guess

11:28 _na_ka_na_: lpetit: I would also like code formatters like present for java projects :)

11:28 lpetit: But I intend to make "indent line" more powerful first: it will not indent the line, but also all the children of the first form of the line, and also all the following siblings (and recursively the children of the siblings ...)

11:30 _na_ka_na_: lpetit: I'm not sure if that's a good thing .. coz some people might like to indent only one line ..

11:30 lpetit: I'm getting ... Project Hosting is currently READ-ONLY for network maintenance.

11:31 lpetit: maybe you can keep separate shortcuts .. tab/cntl+I for one line .. cntl+shift+I for a form

11:32 lpetit: _na_ka_na_: interesting, cntl+shift+I with no selection could have the above described behavior , indeed

11:33 _na_ka_na_: yup

11:33 lpetit: _na_ka_na_: I was in fact more thinking about auto-indent when adding a newline. I then almost always wish that it reindents correctly the sibling forms

11:34 _na_ka_na_: lpetit: maybe this .. keep separate shortcuts cntl+I (one line), cntl+shift+I (form) ... and make tab configurable either ident off or cntl+I or cntl+shift+I .. :D

11:40 anyone answer my aref question from above?

11:42 lpetit: _na_ka_na_: it's sometimes pleasant to be able to be the person with the final choices in his hands :-)

11:42 _na_ka_na_: :)

11:43 lpetit: only sometimes though :)

11:43 lpetit: :)

11:44 _na_ka_na_: one of the ted video is about this, I'm forgetting which one

11:56 arkh: is the syntax to dereference something in a defrecord '(deref (:thing record)))' ?

11:58 lpetit: arkh: sure. Think incrementally: record -> (:thing record) -> and if it is a ref, then just call deref / @

11:59 arkh: so this is ok too? @(:thing record)

12:01 ,(let [sth {:keyword (atom true)}] (prn @(:keyword sth)))

12:01 clojurebot: true

12:01 arkh: I guess I just hadn't seen that syntax before. lpetit: thanks

12:02 _na_ka_na_: lpetit: any remote chance your team works on #134 next ?

12:03 lpetit: Now is time to explain me what exactly #134 means. I'm not totally sure to know what the command does (I have several conflicting ideas in my mind)

12:04 OK, I've got it.

12:04 Little chance for it to be next

12:05 _na_ka_na_: hmm

12:05 lpetit: sorry :-(

12:05 _na_ka_na_: no prob .. I'll just keep on searching for the var in the project till then

12:06 lpetit: maybe you can answer my aref question from above, noone else seems to be around

12:07 lpetit: _na_ka_na_: I didn't see it, maybe you posted id before I connected

12:07 _na_ka_na_: suppose i have.. (dosync (when (= val @aref) (alter aref ...))) .. will clojure hold the lock on aref even if (not (= val @aref)) ?

12:07 yes i did

12:07 technomancy: cemerick: specifically about alt. swank clients? it was discussed and decided against in the past because swank-clojure was GPL'd, but I relicensed it to EPL, so it's an option. the gain would be iffy though if you're porting slime.el anyway; I wouldn't be surprised if it were easier to start from scratch.

12:07 _na_ka_na_: I want compare-and-swap kind of semantic for aref

12:08 technomancy: there's lots of baggage in the slime protocol; just steal the interesting bits from swank-clojure without taking the whole protocol with it

12:09 cemerick: technomancy: Thanks. That's basically where I've landed as well.

12:09 hiredman: _na_ka_na_: the stm is implemented using locks, but they are transactions

12:09 don't worry about locks being held

12:10 they are not some thin facade over locks

12:10 cemerick: I'd fundamentally like to see *all* Clojure environments using the same REPL backend, but that probably won't gain a lot of traction with the emacs crowd. :-)

12:10 _na_ka_na_: hiredman: that's right, I'm only asking if my code from above has compare-and-swap sematics

12:10 hiredman: no, you asked if a lock was held

12:10 technomancy: cemerick: I'm no fan of maintaining swank-clojure myself... but it's slightly easier than writing a bunch of brand-new elisp.

12:10 _na_ka_na_: hiredman: ok sorry I put my question wrongly

12:11 hiredman: transactions as a whole are compare and swap

12:11 technomancy: cemerick: once emacs is a clojure compilation target we can talk.

12:11 cemerick: heh

12:11 technomancy: surely there are the requisite hooks in slime to swap out the underlying protocol being used?

12:11 hiredman: if the value of a ref touched by the transaction has changed by the commit point of the transaction the transaction is retried

12:12 technomancy: cemerick: I doubt it, though it would probably be feasible to lift certain portions of UI code wholesale.

12:13 elisp doesn't really have a strong engineering culture to say the least; there's no notion of modularity or componentization.

12:13 cemerick: heh, yeah, I figured that one out ;-)

12:14 technomancy: kind of like JS in that regard; it's mostly just used for building UIs and talking to things that are smarter than it is.

12:14 cemerick: In any case, my current goal is to make sure that at least ccw and enclojure are using the same REPL library.

12:14 Even that is turning into more of a project than I thought though :-)

12:15 At the moment, I'm tempted to chuck it all and just have every server running on top of jetty.

12:15 technomancy: what's the draw of HTTP apart from being able to get around firewalls?

12:16 I don't really see myself using anything but SSH for remote repls.

12:18 cemerick: managing protocols is a crummy way to spend one's time. With HTTP, at least the wire is taken care of for us.

12:19 arkh: any recommendations on a simple db for use with clojure? I know there's quite a few options out there. My goal is fast implementation. K/V store vs. SQL doesn't matter. Performance is secondary right now.

12:20 cemerick: That said, basic auth + SSL so that ssh could be avoided for many things would be very convenient.

12:20 hiredman: arkh: http://db.apache.org/derby/

12:20 arohner: arkh: mongodb, congomongo

12:20 cemerick: Using HTTP introduces nontrivial dependencies though, which will be a problem for people.

12:20 Anyway, we'll hopefully come to some agreement over the weekend, etc.

12:21 _na_ka_na_: hiredman: suppose the when part of code is running in one thread (T1) with val=15, it derefs aref and gets 10 .. now it starts making comparison .. at exactly the same time parallelly in another thread value of aref is updated to 15 (committed) .. in this case the transaction in T1 wont get re-started

12:21 lpetit: cemerick: plain socket. ssh tunneling with keys for people wanting to do so

12:21 mrBliss: _na_ka_na_: look at (doc ensure)

12:21 cemerick: lpetit: Sure, ssh isn't always a problem, but when it's a problem, it's a *big* problem.

12:21 hiredman: _na_ka_na_: it will be if the ref is ever written to or as mrBliss suggests ensured

12:22 cemerick: In any case, avoiding ssh is hardly my tenth reason to be considering HTTP. *shrug*

12:22 _na_ka_na_: mrBliss: that's exactly my question is ensure necessary for compare-and-swap semantics for ref?

12:23 lpetit: cemerick: do you imagine things other than clojure clients connecting to the future repl server ?

12:23 _na_ka_na_: (dosync (when (= val (ensure aref)) (alter aref ...)))

12:23 is this necessary?

12:24 lpetit: cemerick: if not, then "HTTP the standard" does not buy a lot if along with the serverrepl a full clojure IDE-free dependency free client is shipped.

12:24 cemerick: lpetit: Who knows? Not requiring Clojure on the client side wouldn't be a horrible thing, certainly. Consider ajaxy calls into a sandboxed REPL server running over HTTP...

12:24 lpetit: cemerick: any clojure implementation from dot net to javascript .. would then be able to connect to your server, and "HTTP the standard" becomes an implementation detail again.

12:24 mrBliss: _na_ka_na_: I think so, or you could use alter

12:24 clojurebot: alter is always correct

12:25 lpetit: cemerick: you're right

12:25 cemerick: lpetit: There's no such thing as a "pure clojure" implementation of a wire protocol. You're always going to be touching the host for stuff like DataOutputStream et al.

12:25 lpetit: how did I miss that one

12:26 cemerick: That's probably reason #2 for HTTP IMO. :-)

12:26 Everything with an HTTP client API can play.

12:29 lpetit: let's introduce some engineering in it: split the server code so that the serving protocol is interchangeable. HTTP when the project affords to add jetty dependency or even servlet-based service, something simple based on sockets.

12:29 cemerick ^^

12:30 hiredman: if you are doing that you may as well just use the socket version and have a jetty based client

12:31 cemerick: lpetit: just to avoid the dependency?

12:31 hiredman: a jetty-based *client*?

12:31 i.e. invert things like X does?

12:31 KirinDave: cemerick: I had a crazy idea last night in the gym shower. Rest easy, it did not involve anatomy.

12:32 cemerick: What if we...

12:32 cemerick: *wait for it*

12:32 hiredman: cemerick: the socket server for everyone and a client for the socket server that translates it to http

12:32 KirinDave: cemerick: Used thread locals and exceptions and some additional syntax to implement conditions and restarts?

12:32 lpetit: cemerick: it's probably not hard to create a protocol agnostic interface for a message-based "abstract" protocol. Then all the intelligent feature is behind the interface, and the real server part is configurable

12:33 cemerick: KirinDave: as in, error-kit?

12:33 KirinDave: cemerick: Does error-kit go all the way though?

12:33 And register them?

12:33 cemerick: oh, you mean with slime? No idea, I don't do emacs. :-)

12:34 KirinDave: No

12:34 I mean internally

12:34 Yeah I don't think error-kit is quite where I wanted to go.

12:34 Anyways, I'll POC after my wedding and show it to you.

12:34 i think we can do everything

12:35 lpetit: cemerick: I've thought about inverting things and make ccw the server and the remote VM the client. But I don't believe in it.

12:35 SirNick: What happens if you put a (defmacro) inside a (defn) and call the defined function? Wouldn't that require macro expansion and compilation at runtime?

12:36 lpetit: cemerick: Not sure why I came to that conclusion, though. Maybe something to do with the fact that then remote VM has the responsibility to maintain the connection.

12:36 cemerick: and it seems "silly" to expect some google app engine based application try to connect to my eclipse inside my enterprise :)

12:37 cemerick: hiredman: I think you just took all the usefulness of HTTP out of the mix :-)

12:37 SirNick: (hopefully that didn't send multiple times. I was having some connections problems)

12:37 cemerick: feh, stupid wifi

12:37 hiredman: I think you just took all the usefulness of HTTP out of the mix

12:37 (not sure if that one got through)

12:38 lpetit: it did

12:38 arohner: does anyone have slime-tramp working, so you can C-c C-l files on a remote box?

12:38 lpetit: SirNick: it won't

12:39 SirNick: lpetit: It wont require macro expansion and compilation, or it wont work?

12:39 cemerick: lpetit: the handy thing about jetty as far as ccw is concerned is that it's already in eclipse :-)

12:40 lpetit: SirNick: not totally sure about the details, but it will macro expand, evaluate. During evaluation, fns are compiled. Calls to def are immediately emitted

12:40 cemerick: which Eclipse :)

12:41 cemerick: lpetit: in mine, anyway :-) I thought it came with the platform all the time?

12:42 lpetit: cemerick: maybe, I don't know. I wanted to spot that it may be an internal detail of Eclipse.

12:47 cemerick: while I understand your wish to use HTTP, I would really like to keep it optional and have most simple protocol socket based . e.g. the command is one clojure sexp as a string (of course!), doubled by the length of the string. This can translate easily to an HTTP POST later. And the rest of the server code does not know about this and just receives the clojure sexp. I have made the server response in serverrepl.clj a litt

12:49 oh, we lost cemerick

12:52 cemerick: did you see my last message ?

12:52 cemerick: while I understand your wish to use HTTP, I would really like to keep it optional and have most simple protocol socket based . e.g. the command is one clojure sexp as a string (of course!), doubled by the length of the string. This can translate easily to an HTTP POST later. And the rest of the server code does not know about this and just receives the clojure sexp. I have made the server response in serverrepl.clj a litt

12:52 jfields: is there anything in clojure like: (defn +? [& more]

12:52 (apply + (remove nil? more)))

12:53 i keep encountering this situation where I want to (update-in m [k1 k2] + 14) and it always fails if there is no current value.

12:53 lpetit: (doc fnil)

12:53 clojurebot: "([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."

12:54 lpetit: ,(update-in [] (fnil + 0) 14)

12:54 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: core$fnil$fn__5585

12:55 lpetit: ,(update-in [] 0 (fnil + 0) 14)

12:55 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

12:55 lpetit: (doc update-in)

12:55 clojurebot: "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."

12:55 jfields: ,(update-in {} [:a :b] (fnil + 0) 14)

12:55 clojurebot: {:a {:b 14}}

12:55 edbond: how to reload enlive deftemplates on every compojure request?

12:55

12:55 lpetit: jfields: yep

12:56 jfields: lpetit, thanks. looks kind of meh, but if that's what I've got, I'll roll with it.

12:56 lpetit: cemerick: must leave, will let you answer (if you wish) by email. cu all

13:08 _na_ka_na_: mrBliss hiredman: I've been trying but haven't been able to reproduce a case where the code without ensure would not show compare and swap semantics ... ofc this doesn't mean it will always ..

13:35 I should ask the question more precisely .. here's another attempt

13:35 [1] (dosync

13:35 [2] (if (= @a 10)

13:35 [3] (ref-set a 20)

13:35 [4] (..do something time consuming ..)))

13:35 Is it guaranteed that Clojure will re-try the above transaction if 'a' is written to while [4] is executing?

13:37 LauJensen: _na_ka_na_: Yes, if a new value of 'a' is committed, this transaction will retry.

13:38 _na_ka_na_: LauJensen: thanks

13:39 LauJensen: that's the case even if [4] is not trying to write to 'a', right?

13:39 LauJensen: _na_ka_na_: ref-set marks this transaction as affecting 'a' so yes.

13:40 There is a great article on the commit process online somewhere, lemme see if I can find it

13:40 http://java.ociweb.com/mark/stm/article.html#STM

13:40 Worth reading

13:40 _na_ka_na_: LauJensen: that was my confusion, in the transaction since a is written conditionally .. does clojure optimize and write to 'a' only if it was really written to

13:41 ..reading now..

13:42 oops .. that came out wrong ... *does clojure optimize and *retry the transaction* only if 'a' was really written to

13:42 LauJensen: _na_ka_na_: My memory is failing me... Try to read the article, otherwise we'll have to check the code. I think it actually only retries if the conditional is true

13:43 _na_ka_na_: LauJensen: hmm

13:43 LauJensen: do you mean that's an implementation detail ?

13:44 LauJensen: yea I guess you could say that - but like I said, its been a few months since I looked at it

13:45 kumarshantanu: how can I transform this? -- [:a 10 :b 20 :c 30] --> [:a 10] [:b 20] [:c 30]

13:46 semperos: zipper functionality?

13:46 dnolen: ,(into [] (map vector (partition 2 [:a 10 :b 20 :c 30])))

13:46 clojurebot: [[(:a 10)] [(:b 20)] [(:c 30)]]

13:46 dnolen: oops

13:46 noidi: ,(map vec (partition 2 [:a 10 :b 20 :c 30]))

13:46 clojurebot: ([:a 10] [:b 20] [:c 30])

13:47 dnolen: ,(into [] (map vec (partition 2 [:a 10 :b 20 :c 30])))

13:47 clojurebot: [[:a 10] [:b 20] [:c 30]]

13:47 hiredman: be sure to use partition-all

13:47 dnolen: ,(doc partition-all)

13:47 clojurebot: "([n coll] [n step coll]); Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end."

13:47 hiredman: ,(partition 2 [:a 10 :b])

13:47 clojurebot: ((:a 10))

13:48 hiredman: ,(partition-all 2 [:a 10 :b])

13:48 clojurebot: ((:a 10) (:b))

13:48 LauJensen: or regular partition with padding

13:48 kumarshantanu: noidi: dnolen: hiredman: LauJensen: thanks

13:48 hiredman: it's easier to add padding with a map after partition-all then it is before a partition

13:49 LauJensen: ,(doc partition)

13:49 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

13:49 LauJensen: notice the 3rd arity hiredman

13:50 hiredman: I see

13:50 LauJensen: , (partition 2 1 [9] [1 2 3])

13:50 clojurebot: ((1 2) (2 3) (3 9))

14:05 _na_ka_na_: LauJensen: This kind of proves that Clojure will not re-try the transaction always .. http://gist.github.com/562631

14:09 pjstadig: when are we going to be able to register for the ClojureConj?

14:10 LauJensen: _na_ka_na_: Yea, I was assuming to find something in Ref.set which would show that the STM is alerted to the change, but its not there. I think your theory is correct though

14:12 _na_ka_na_: LauJensen: hmm ... so the way to correctly implement compare-and-set for ref is : (dosync (when (= val (ensure a)) (ref-set a ...)))

14:12 LauJensen: (on the phone)

14:14 _na_ka_na_: ensure is effectively a writer lock, is that what you want ?

14:14 _na_ka_na_: LauJensen: I want an atomic compare-and-set for ref ..

14:14 LauJensen: _na_ka_na_: Actually, this is probably parallel to an issue AWizzArd faced, which he ended up solving with Cells - AWizzArd got an oppinion on this?

14:15 aavram: testing

14:38 I am using clojure.contrib.sql to talk to a netezza database. I have 2 sql queries, each of which run fine outside of clojure. The first query is a simple SELECT statement that returns data correctly via the with-query-results function. The second query is similar to the first but contains a GROUP BY statement and though valid, fails via clojure with the following error, "org.netezza.error.NzSQLException: Driver can process one query

14:38 time (NO_SOURCE_FILE:1)" Any help appreciated :)

14:45 perhaps there is underlying concurrency that netezza is complaining about?

14:48 kumarshantanu: can anybody let me know how can I provide 1 docstring per variadic arg version of a function?

14:49 hiredman: can't

14:49 kumarshantanu: hiredman: ah okay...any plans to include in a future Clojure version?

14:50 hiredman: nope

14:50 hoeck: aavram: maybe you forgot to close the first query before issuing the second one

14:51 aavram: looks like your jdbc driver cannot handle more than one open query

14:52 aavram: i guess it is a driver issue, because if I start a new repl and try the group-by query alone, it still fails

14:54 hoeck: aavram: clojure.sql uses plain jdbc, basically in the same way as using it from java, only with less LOCs :)

14:55 aavram: I'm basically doing the same thing as step #4 here http://stackoverflow.com/questions/613929/how-do-i-connect-to-a-mysql-database-from-clojure but using Netezza connection info

14:58 hoeck: thanks for your help, hoping for a work-around :)

15:01 hoeck: aavram: never heard of netezza, and step #4 works for the first query?

15:02 aavram: hoeck: yes step #4 works for all simple queries involving only SELECT...FROM but no GROUP BY

15:02 Netezza is from netezza.com developed from postgres i believe

15:04 I suppose I could do the group-by step in clojure... but when the data is large that may be unwise. It would be better if the database would do what it normally does and pass results to clojure...

15:06 hoeck: aavram: mhh, even a group-by is just a plain ResultSet from a jdbc point of view

15:08 aavram: ok, not sure how to debug further though.

15:09 hoeck: aavram: to be 100% shure wether its a clojure or jdbc thing, you could download sql-workbench/j and try the select-group-by there

15:09 http://www.sql-workbench.net/index.html

15:09 aavram: hoeck: thanks for the link, I'll check it out :)

15:09 hoeck: used it once to test my own clojure jdbc driver

15:10 aavram: cool.

15:13 LauJensen: Does anyone know if the Swingset 3 source is available?

15:19 hoeck: LauJensen: you mean this: https://swingset3.dev.java.net/source/browse/swingset3/ ?

15:20 LauJensen: I think thats the one hoeck, thanks a lot

15:27 _fogus_: cemerick: I didn't understand your tweet :-(

15:29 LauJensen: _fogus_: What are you doing here man? You're supposed to be out hating on all those coding in poor style :(

15:31 cemerick: _fogus_: oh, just giving you a hard time about adopting stranded languages :-)

15:34 _fogus_: cemerick: Well, it was either langs or defunct OSes, but I thought the former was a little more reasonable. ;-)

15:34 LauJensen: My days as paren-police are over

15:36 cemerick: _fogus_: Qi (on top of Clojure, of course) would probably be where I'd go first, but I'm in no position to be expanding my language tinkering.

15:36 _fogus_: Qi is coming to Clojure

15:37 (well, next gen Qi)

15:37 cemerick: do you know of news in that regard? I remember it being talked about, but the fork of it seemed to go dead.

15:38 _fogus_: cemerick: You'll notice however that I totally passed the buck to the Twitter-verse. I have enough defunct languages on my hands :-p

15:38 dnolen: Tarver's been posting every couple weeks about the progress of Shen on the Qi ML, seems like the core is done.

15:40 _fogus_: http://groups.google.co.uk/group/qilang/browse_thread/thread/fe07f6a5032d5d47

15:46 arohner: so what's the point of Qi now that clojure is taking off?

15:52 cemerick: The optional static typing and pattern matching stuffs AFAIK.

15:54 mcav: Is there a recommended way to deploy compojure apps? Some tutorials use uberjar, some use rsync, and others recommend deploying to a WAR file. Any reason to prefer one way over another?

15:55 ordnungswidrig: hia ll

15:56 LauJensen: hi

15:57 * ordnungswidrig doesn't want to do java anymore, can I haz a clojure project, pleaze...

15:57 LauJensen: mcav: war files for tomcat/jboss, rsync when you dont want to precompile, uberjars when you just want a single jar-file (with or without source)

15:57 cemerick: mcav: Compojure webapps are java webapps, so all the same rules apply -- e.g. deploying using a .war file is far preferable in almost every case IMO.

15:58 mcav: thanks, makes sense. Having had no java experience, I'm just now learning what Java apps do for deployment as well.

15:59 cemerick: mcav: FWIW, war packaging is built-in to maven, if you happen to be using it for your builds.

15:59 * LauJensen giggles

15:59 cemerick: I think there's a war file plugin for lein

16:00 LauJensen: ..and cake

16:00 mcav: There are 2 Clojure based build tools you might want to have a look at, one is Leiningen (lein) the other is Cake

16:00 ordnungswidrig: all those j2ee stuff... Did anybody some EJB3 with clojure? If yes, I assume it was done for fun.

16:00 mcav: I'm using leiningen

16:00 ordnungswidrig: huh, cake?

16:01 mcav: have only heard about cake once or twice recently

16:01 cemerick: I'm surprised so many people are recommending cake so soon.

16:01 LauJensen: cemerick: Cake is fantastic

16:01 alexyk: there used to be a -Dclojure.jar=... option to maven building clojure-contrib; no longer mentioned in README.txt there. Looks like mvn compile downloads clojure-1.2.0, even when in a git checkout of clojure-contrib-1.3.0-master-SNAPSHOT. Is it OK to just mvn install for use with clojure master?

16:01 LauJensen: Ive done my most recent builds with cake, and have been constantly impressed with it

16:02 alexyk: LauJensen: constantly or instantly? :)

16:02 cemerick: I'm quite done with task-based build tools.

16:02 ordnungswidrig: so cake is ruby?

16:02 LauJensen: alexyk: constantly. Whenever something comes up that I need to work out, I get impressed by its design and the authors personal commitment to it

16:03 ordnungswidrig: Where lein is bash/clojure, cake is ruby/clojure

16:03 ordnungswidrig: huh?

16:03 LauJensen: ordnungswidrig: Where lein is bash/clojure, cake is ruby/clojure

16:03 alexyk: LauJensen: agreed, I was aware of cake when it was only a closed beta! :)

16:03 ordnungswidrig: LauJensen: ok, I got it.

16:03 LauJensen: alexyk: I was aware when it was semi-closed alpha :) !

16:04 ordnungswidrig: haha, you did? :)

16:04 ordnungswidrig: LauJensen:

16:04 LauJensen: One of the really nice things with Cake, is that its cross platform, so both on unix, mac and Windows, just hit 'gem install cake' and you're all set

16:04 alexyk: LauJensen: I saw it as an embryo in ninjudd's mind!

16:04 ordnungswidrig: LauJensen: I already slept and wake up again, so bare with me.

16:04 LauJensen: well, on Windows its 'gem install win32-process' then 'gem install cake'

16:04 alexyk: cake says it runs on Commodore 64 too

16:04 ordnungswidrig: LauJensen:

16:04 *doh*

16:05 LauJensen: windows is a corner case

16:05 LauJensen: ordnungswidrig: I know you love highlighting me, but please... :)

16:05 ordnungswidrig: LauJensen: no offense :-)

16:05 * ordnungswidrig switched back to ERC just before

16:05 LauJensen: Im just saying: If you guys havent tried to base a build off cake, you're missing something

16:05 And the task/deps system is off the hook, I've really enjoyed working with it

16:06 ordnungswidrig: LauJensen: can I expect it to be a drop-in replacement for lein?

16:06 alexyk: so, how do we build clojure-contrib using the clojure-1.3.0-master-SNAPSHOT.jar from github build locally?

16:06 ordnungswidrig: LauJensen: or some reconfiguration needed?

16:06 LauJensen: ordnungswidrig: yea, unless you're using personal plugins, then you need to rewrite

16:06 otherwise its a drop-in thing

16:06 anyway, thats it for my commercial break, back to work :)

16:06 cemerick: LauJensen: "off the hook"? :-D

16:06 ordnungswidrig: LauJensen: i'll check. If it isn't I'll keep highlighting you :)

16:07 LauJensen: ordnungswidrig: fantastic :)

16:07 cemerick: No such thing? :)

16:07 cemerick: heh .. there is, but I think it was more in vogue circa 2005-ish, at least in the U.S. ;-)

16:08 Definitely made me smile, though!

16:08 LauJensen: then it was worth it :)

16:16 kencausey: I'm using emacs/slime/swank. I start up the day and (use 'myproject.myfile) in the repl for quick testing, experiments. This is fine until I add a new function. I can C-c C-c (compile-defun) it and there are no complaints, but the new definition is not available at the REPL. What's the proper way to keep the loop going?

16:16 LauJensen: then it was worth it :)

16:16 raek: you'll have to run use again, or do a (in-ns 'myproject.myfile)

16:17 LauJensen: oops, M-p, I thought I was in the REPL :)

16:17 raek: (probably the latter)

16:17 ,(doc in-ns)

16:17 clojurebot: "([name]); Sets *ns* to the namespace named by the symbol, creating it if needed."

16:18 raek: it makes the repl eval things inside that namespace, anyway...

16:20 kencausey: But by using 'use the 'myproject.myfile becomes part of 'user, I can see in the results of (all-ns)

16:20 s/see in/see it in/

16:20 sexpbot: <kencausey> But by using 'use the 'myproject.myfile becomes part of 'user, I can see it in the results of (all-ns)

16:21 nickik: stupid question but how do i make a newline in a string (str "line1" ..... "line2") <-- what goes here ......?

16:21 raek: use only adds the public vars that are available at the point when use is ran

16:22 it doesn't make any automatic connection between the namespaces

16:22 kencausey: However I will admit that (in-ns) does work, I just would have thought it would be no different than (use) in this

16:22 OK, I see

16:23 thanks

16:26 hoeck: nickik: \newline

16:28 nickik: thx

16:30 raek: the recommended way of calling use is by listing all the vars one intend to utilize: (use '[foo.bar :only [x y z]])

16:31 cemerick: raek: use is usually recommended *against*, at least for general use

16:31 ordnungswidrig: cemerick: no use for use in general?

16:31 raek: yeah, a namespace alias is always safer, right?

16:32 hiredman: cemerick: what is wrong with :use and :only?

16:32 cemerick: ordnungswidrig: one should not use use for almost any use case ;-)

16:32 ordnungswidrig: cemerick: what is the replacement for :only then?

16:32 cemerick: raek: right

16:32 ordnungswidrig: cemerick: require :as ?

16:33 cemerick: hiredman: fundamentally, nothing, except that it's far simpler to simply recommend against using use

16:33 * ordnungswidrig skipped over raek message

16:33 cemerick: ordnungswidrig: yes, (:require (some.optional.prefix [ns-name :as local-name]))

16:33 hiredman: cemerick: ok, I'll just ignore your recomendations then

16:33 ordnungswidrig: hiredman: *g*

16:34 alienscience: I use :use all the time

16:34 Is it really that bad?

16:34 hiredman: can someone please set the mode on this channel so I can change my nick from hiredman_ to hiredman without having to part/join

16:34 cemerick: hiredman: fair enough. irc is not a good place for nuanced explanations.

16:34 ordnungswidrig: while switching to 1.2 my uses of use used to drop badly on my foot

16:35 hiredman: cemerick: you have a marvelous proof but these margins are too narrow?

16:35 ordnungswidrig: hiredman: there is no nick hiredman_

16:35 cemerick: alienscience: namespace pollution is an issue, and is what prompted the last-var-(mostly)-wins behaviour.

16:35 ordnungswidrig: cemerick:

16:35 cemerick: I like the "mostly"-part best :)

16:35 hiredman: ordnungswidrig: my client reconnected for some reason and the server still had a zombie connection as hiredman so my client picked the nick hiredman_

16:36 cemerick: hiredman: proof? margins?

16:36 ordnungswidrig: hiredman: I see you as "hiredman" here

16:36 hiredman: I just had to part/join to change it back because the mode on this channel doesn't allow nick changes

16:36 * cemerick and hiredman always end up talking past each other :-/

16:36 hiredman: ordnungswidrig: it was five minutes ago

16:36 pay attention

16:36 ordnungswidrig: hiredman: I see. Gosh it's late at my place

16:36 hiredman: cemerick: fermat?

16:37 cemerick: http://en.wikipedia.org/wiki/Fermat's_Last_Theorem#Fermat.27s_conjecture

16:37 ordnungswidrig: btw, what's the state on the P!=NP prove?

16:37 joly: I'm curious about the :use recommendation too. I just used it in a file meant to be in a DSL, where I'd rather not have the users doing (parse/menu "abc" (parse/item "123")) etc.

16:38 hiredman: joly: you're fine

16:38 ordnungswidrig: says hiredman. now back to cemerick:

16:38 joly: cool, glad to hear it. :) This is my first time using clojure "for real"

16:39 hiredman: I hope he's still busy with the wikipedia article

16:39 clojurebot: ping?

16:39 clojurebot: PONG!

16:39 LauJensen: Fermats last theoreom took 9 years to complete IIRC, and Fermat himself noted in the margin of his book "I have a funny little proof for this theorom" in the 1600s :)

16:39 cemerick: joly: yeah, you're fine since you know what you're doing. 'use' is a longer length of rope than require is all.

16:40 aavram: hi, what is the best way to turn a sequence of maps (as returned from a database query) into an incanter "dataset" ?

16:40 hiredman: LauJensen: 9 years for the guy who finally solved it, people have been trying since fermat's time

16:40 cemerick: hiredman: lovely reference. Shit, you know I'm a mostly skill-less code monkey, right? ;-)

16:41 LauJensen: hiredman: right

16:41 and 2 of those years were debugging :)

16:42 hiredman: I had some non-clojure related news over lunch that's left me a little more combative than normal I expect

16:42 technomancy: just don't challenge stuart S to a duel; he's a trained swordsman

16:42 LauJensen: hiredman: you? combative? noooo :)

16:43 pjstadig: stuart S ? i'm confused

16:43 raek: the other suart... :)

16:43 *stuart

16:44 pjstadig: i know who stuart S is...i was confused about how he entered the convo

16:45 technomancy: pjstadig: he's not a guy you want to get combative with is all.

16:45 pjstadig: technomancy: duly noted

16:46 hiredman: you just feint for the chin, he's very protective of it

17:42 brw314: test

18:02 scottj: Is there an easy way with compojure/slime to have clj-stacktrace used to print all stacktraces that appear in the terminal?

18:02 technomancy: scottj: you can re-def clojure.stacktrace/print-stack-trace to clj-stacktrace/pst if you're OK with a heinous monkeypatch.

18:06 replaca: for some reason "]

18:06 :dev-dependencies [[swank-clojure "1.2.1"]])

18:06 ack, retry

18:06 for some reason: [org.apache.xmlrpc/xmlrpc "3.1.3"] fails to get the right library even though I see it on central

18:07 when I run lein deps

18:09 I get this: http://gist.github.com/563043, which is not helping me

18:09 any ideas?

18:12 scottj: technomancy: don't think that works. have you actually done it?

18:14 hiredman: scottj: yes he has

18:14 scottj: (in-ns 'clojure.stacktrace) (clojure.core/require 'clj-stacktrace.repl) (def print-stack-trace clj-stacktrace.repl/pst) ?

18:15 hiredman: you'll have to ask him

18:16 replaca: hmm, it seems like if I depend on xmlrpc-client it works OK, but the meta project doesn't get pulled right

18:16 oh well

18:16 scottj: Are C-M-x and C-c C-c kind of redundant? Does C-c C-c give any better file line info than C-M-x? Anyone rebound C-M-x to do eval the eval only the most immediate parent form?

18:19 technomancy: (into (sorted-map)

18:19 (zipmap (vals secs-in-units)

18:19 (keys secs-in-units))))]

18:19 [(float (/ secs i)) units])))

18:19 (defn unit-time [secs coll]

18:19 (let [[i units] (first coll)

18:19 secs-rem (- secs (* (secs-in-units units) (Math/floor i)))]

18:19 (if (> (count coll) 1)

18:19 (cons [(int (Math/floor i)) units]

18:19 (unit-time secs-rem (apply-secs secs-rem)))

18:19 [[(int i) units]])))

18:20 (defn human-time [secs]

18:20 hiredman: uh, phil?

18:20 technomancy: (apply str

18:20 (interpose " "

18:20 (map #(format "%s%s" (first %) (second %))

18:20 (unit-time secs (apply-secs secs))))))

18:20 (defn copy-to-uniq-file [dir stream prefix suffix]

18:20 danlarkin: oh. my. god.

18:20 technomancy: (.mkdirs dir)

18:20 (let [file (File/createTempFile prefix suffix dir)]

18:20 (with-open [outs (FileOutputStream. file)]

18:20 (copy stream outs))

18:20 (.getCanonicalPath file)))

18:20 scottj: gotta love consistent reliable copy paste in nix

18:20 technomancy: (defmacro tap->> [name & body]

18:20 `((fn [~name]

18:20 ~@(butlast body)

18:20 ~name)

18:20 ~(last body)))

18:20 (defmacro accumulate

18:20 "map:for :: reduce:accumulate"

18:20 ([accum bindings body]

18:20 `(reduce (fn ~[(first accum) (first bindings)] ~body)

18:21 dnolen: probably accidental paste into erc

18:21 technomancy: ~(second accum) ~(second bindings)))

18:21 ([[name value] body]

18:21 `(let [[init# & more#] ~value]

18:21 (accumulate [~'% init#] [~name more#] ~body))))

18:21 dammit

18:21 dnolen: technomancy: you pasted into your irc client

18:21 technomancy: paste misfire

18:21 need to set up a way to get ERC to prevent that

18:21 what I meant to say was http://p.hagelb.org/clj-monkey.html

18:22 scottj: that's how to use clj-stacktrace

18:32 sleepynate: technomancy: the most powerful irc client in the world. if only it could edit text ;)

18:35 scottj: technomancy: well you're lucky that works for you. sure isn't working on compojure stack traces for me

18:37 technomancy: scottj: oh, I missed the compojure part. I only use it for slime.

20:05 auser: hola

20:05 any hints on where to start if I want to write a parser in clojure?

20:05 or a web scraper, really

20:10 hiredman: htmlunit is nice

20:11 well

20:11 auser: oh yeah?

20:11 hiredman: for scraping you need tagsoup + clojure.xml + tree-seq

20:11 htmlunit is more for automation

20:11 auser: I guess I need to really understand clojure at a deeper level first, i'm following tutorials and it's still going over my head, at least for now

20:11 tagsoup, you say

20:11 hiredman: yes

20:12 auser: cool

20:12 Raynes: For parsers, there is fnparse and another Clojure-based parser that I can't remember the name of.

20:12 auser: any hints on a good tutorial for someone coming from ruby/erlang?

20:12 heh

20:12 Raynes: There is also Brian Carper's ANTLR in Clojure tutorial.

20:12 auser: just in general

20:12 hiredman: Raynes: he doesn't really want a "parser"

20:12 auser: I've seen some templating

20:13 well... eventually I want to parse the scraped material

20:13 of course

20:13 hiredman: he's not writing an html parser

20:13 Raynes: hiredman: He might eventually. Now he knows about parsers.

20:13 auser: he appreciates the discussion

20:13 hiredman: http://github.com/nathell/clj-tagsoup might be what you want

20:14 auser: lemme look

20:14 ah that's nice

20:14 hiredman: no

20:14 no one wants to parse html

20:14 EVER

20:16 when people say "I want to parse html" they mean "I want a library to parse html and make it less dirty"

20:16 which is why tagsoup exists

20:16 auser: you're right, I want to parse html in a semantic way, I don't want to do the parsing myself

20:17 hiredman: right, anything with tagsoup in it will do you well

20:17 chouser has an example somewhere of using tagsoup + clojure.xml/parse which is what I have used in the past

20:17 auser: now I just have to figure out how to use it

20:17 Raynes: I didn't actually know about tagsoup.

20:20 auser: man, in comparison, clojure runs super slow in development (because of the JVM, I'm assuming) to erlang, even though both are compiled languages

20:21 hiredman: huh?

20:21 how do you figure?

20:22 auser: well, it's not a fair statement to make considering I don't know clojure that well yet

20:22 so I probably should hold off on saying that

20:22 Raynes: What do you mean by "super slow in development"?

20:22 You aren't talking about start-up time, right? That's a whole different beast entirely.

20:23 auser: brb, work calls

20:23 I'm talking about compiling

20:23 hiredman: why are you compiling?

20:23 Raynes: You shouldn't be compiling.

20:23 danlarkin: something something compiling

20:24 Raynes: Unless you need certain Java interop features that require AOT, there are rarely reasons to compile to Java bytecode. Especially during development.

20:24 Well, to class files.

20:26 auser: I don't need to compile?

20:26 okay

20:26 hm

20:26 maybe I am misunderstanding then

20:27 I guess I'm trying to use tagsoup

20:27 how do I use the method "parse")

20:27 erp, no ')'

20:28 hiredman: the method?

20:28 auser: in tagsoup

20:28 hiredman: on what class?

20:28 auser: I'm just looking at this: http://github.com/nathell/clj-tagsoup

20:33 Raynes: auser: Are you using Leiningen for this project?

20:33 http://github.com/technomancy/leiningen

20:34 auser: I am yes

20:34 well, trying to

20:37 Raynes: If you have a Leiningen project set up, you'll want to add [clj-tagsoup "0.1.2"] to your :depedencies in your project.clj.

20:37 And then, you'll want to run "lein deps" to pull it down.

20:38 The jar will be on the classpath if you run "lein repl" or swank or whatever, so you should be able to use or require the namespace with the parse function and use it.

20:42 seangrove: Hey all, I'm having a bit of a tough time understanding the recur example

20:42 http://clojure.org/special_forms#Special Forms--(loop [bindings* ] exprs*)

20:43 Ah, nevermind

20:43 Haha, got it now

20:43 Thanks for being my rubber ducky, #clojure

20:44 notsonerdysunny: is there a way to pipe the command line output for further processing .. ?

20:45 Raynes: seancorfield: Quack.

20:45 notsonerdysunny: If let us say (dir ns) returned a list of member funcs I could map doc on each element of the list ....

20:45 but unfortunately (dir ns ) just prints it to the prompt instead of say returning a list .. does anybody have a suggestion?

20:46 ideally I would like to do something like ... (for [i (dir clojure.zip)] (doc i)

20:46 ,(for [i (dir clojure.zip)] (doc i))

20:46 clojurebot: java.lang.Exception: Unable to resolve symbol: dir in this context

20:47 seangrove: ,(cons '(3 7) '(10))

20:47 clojurebot: ((3 7) 10)

20:47 seangrove: How do I get that to be (3 7 10) ?

20:47 (cons '(3 7) 10)

20:48 ,(cons '(3 7) 10)

20:48 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

20:48 seangrove: Not like that :P

20:51 ,(flatten (cons '(3 7) 10))

20:51 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

20:51 seangrove: ,(flatten (cons '(3 7) '(10)))

20:51 clojurebot: (3 7 10)

20:51 seangrove: That seems wasteful...

20:51 hiredman: no

20:51 read the docstring for cron

20:52 sorry

20:52 cons

20:52 seangrove: Thought that might be it :)

20:52 Raynes: Aw.

20:52 And here I was looking for the cron function. :(

20:53 hiredman: wikipedia may even have an entry on cons

20:53 ~goolge Cons

20:54 seangrove: Oh, I went through all this in beginning cs a few years ago, just don't remember it off the top of my head

20:54 clojurebot: Pardon?

20:54 Raynes: $wikipedia cons

20:54 hiredman: ~google Cons

20:54 clojurebot: First, out of 2590000 results is:

20:54 Converse Skateboarding | CONS Fall 09 Skateboarding Shoes ...

20:54 http://www.converseskateboarding.com/cons_product.html

20:54 hiredman: huh

20:54 Raynes: $wiki cons

20:54 sexpbot: First out of 9930 results is: cons - Wikipedia, the free encyclopedia

20:54 http://en.wikipedia.org/wiki/Cons

20:54 * Raynes forgets his own commands.

20:54 Raynes: If you had attached site:en.wikipedia.org to it, it would have been right.

20:55 seangrove: doh

20:55 ,(cons 10 '(3 7))

20:55 clojurebot: (10 3 7)

20:56 seangrove: Yes, makes sense..

20:56 Raynes: -> (concat '(3 7) '(10))

20:56 sexpbot: => (3 7 10)

20:56 chouser: ,(class (cons 10 '(3 7)))

20:56 clojurebot: clojure.lang.Cons

20:56 chouser: ,(counted? (cons 10 '(3 7)))

20:56 clojurebot: false

20:56 Raynes: chouser: Hai there.

20:57 chouser: ,(counted? (conj 10 '(3 7)))

20:57 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IPersistentCollection

20:57 chouser: ,(counted? (conj '(3 7) 10))

20:57 clojurebot: true

20:57 chouser: Raynes: hi

20:58 Raynes: I was just thinking about you. Well, I was actually thinking about geniuses in general.

20:59 notsonerdysunny: is there a way to pipe the printed output for further processing .. ?

20:59 If let us say (dir ns) returned a list of member funcs I could map doc on each element of the list ....

20:59 ideally I would like to do something like ... (for [i (dir clojure.zip)] (doc i)

20:59 but unfortunately (dir ns ) just prints it to the prompt instead of say returning a list .. does anybody have a suggestion?

20:59 ,(for [i (dir clojure.zip)] (doc i))

20:59 clojurebot: java.lang.Exception: Unable to resolve symbol: dir in this context

21:00 notsonerdysunny: ofcourse dir is not available in the general namespace .. but it does exist in the repl..

21:01 ,(doc counted?)

21:01 clojurebot: "([coll]); Returns true if coll implements count in constant time"

21:03 chouser: Raynes: haha

21:04 seangrove: Alright, so I'm wondering about lazy sequences and next

21:04 if I define: (def random-stream (repeatedly #(rand-int 10)))

21:05 How can I get the next item of random-stream repeatedly?

21:05 (println (next random-stream)) just keeps going forever...

21:06 chouser: notsonerdysunny: use (source dir) to see that it uses dir-fn

21:07 ,(count (clojure.repl/dir-fn 'user))

21:07 clojurebot: 0

21:07 chouser: ,(count (clojure.repl/dir-fn 'clojure.core))

21:08 clojurebot: 546

21:08 chouser: (doseq [s (clojure.repl/dir-fn 'user)] (print-doc (resolve s)))

21:09 clojurebot: is not infinity +1!

21:09 chouser: notsonerdysunny: something like that

21:09 seangrove: you want (second random-stream) ?

21:09 seangrove: next and rest return everything after first.

21:09 seangrove: Ah, they're synonyms?

21:09 chouser: not quite

21:10 but closely related

21:10 Raynes: -> (next [])

21:10 sexpbot: => nil

21:10 Raynes: -> (rest [])

21:10 sexpbot: => ()

21:10 seangrove: Ah, great

21:10 So that lazy-seq will go on forever, so next will continually return

21:11 chouser: right, on a lazy seq, rest and next act the same

21:11 well

21:11 that's still not quite right.

21:12 next has to look one step further ahead to see if the seq is done, compared to rest.

21:13 seangrove: Thank you, good to know

21:14 And it seems like random-stream always remembers what's in position 1, position 2, etc.

21:14 Does that mean it's holding it all in memory for each take-nth ?

21:15 chouser: seangrove: yes, lazy seqs cache their values.

21:15 seangrove: great

21:20 Raynes: chouser: Do you ever post on the mailing list?

21:22 chouser: Raynes: yeah, why?

21:22 thunk: ,(cons 'foo 'bar)

21:22 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol

21:22 Raynes: Just curious. I'm not sure I've seen any of your posts in a while.

21:22 But, I don't follow the mailing list much anyway.

21:23 thunk: Clojure doesn't allow non-seq values in the rest cell of a cons, right?

21:23 technomancy: thunk: right, no "improper" lists

21:23 thunk: technomancy: Thanks

21:23 technomancy: basically: you don't need alists since there are non-half-assed associative data types

21:24 (can you tell I'm biased?)

21:24 Raynes: alists are fun

21:24 technomancy: well calling seq on a map basically gets you an alist

21:24 if you're into that sort of thing

21:25 thunk: It'll take a little mental reorganization, but I think I'll come to like it quite a bit.

21:25 chouser: Raynes: there was a time I read every message, but that was several thousand messages ago.

21:25 Raynes: Hehe.

21:26 technomancy: nothing kills your enthusiasm for elisp like getting used to a rich set of persistent data structures with convenient literals.

21:26 chouser: thunk: cons requires and rest promises to return an ISeq

21:26 technomancy: lisp-2-ness aside

21:26 Raynes: chouser: If you get a couple of minutes, check this out and tell me what you think: http://groups.google.com/group/clojure/browse_thread/thread/4a2243a1453499a1#

21:26 thunk: chouser: Aha. That must be why:

21:26 (first nil)

21:26 ,(first nil)

21:26 clojurebot: nil

21:26 thunk: ,(rest nil)

21:26 clojurebot: ()

21:27 Raynes: technomancy: I've yet to be able to bring myself to use elisp for anything.

21:27 Other people are really good at doing it for me.

21:27 technomancy: Raynes: the key is to learn it before learning clojure.

21:27 Raynes: Too late.

21:28 thunk: Raynes: Elisp is great. It's the lisp that doesn't take itself seriously.

21:28 technomancy: well then the key is to write a clojure-to-elisp compiler.

21:28 thunk: I like that. it could work, as a tag line.

21:29 the Brendan Fraser of lisp dialects.

21:29 thunk: "Elisp: srsly?"

21:30 chouser: Raynes: there.

21:30 technomancy: or maybe jim carrey

21:31 thunk: Brendan Fraser's a good analog.

21:32 Jim Carrey can actually be ... really good.

21:32 * thunk ducks

21:33 s450r1: He was an excellent Count Olaf.

21:33 thunk: Yes, he was.

21:34 Raynes: technomancy: Don't be dissing Jim.

21:35 technomancy: early Jim Carrey?

21:35 notsonerdysunny: chouser: thanks .. that helps .. I was away from my comp for a while ..

21:36 Raynes: chouser: Thanks for your input. I'll play with the profilers later tonight.

21:37 technomancy: for the record, if you are in Seattle and not headed to Seajure RIGHT NOW, you are missing out.

21:38 unless you live right next door, in which case you can just walk over a few minutes before 7.

21:39 s450r1: hmmm, how did Seajure make it past leiningen?

21:48 technomancy: s450r1: it's been around since mid-January. grandfathered in. =)

21:48 plus it's bad-on-purpose, which gets a pass for irony's sake.

21:51 bortreb: what's the best way to do vector math in clojure

21:51 preferbly using actual clojure vectors of vector-ofs or something nice

21:51 I want to do (- [2 2 2] [1 2 3]) etc

21:52 qbg: Cantor?

21:52 http://github.com/ztellman/cantor

21:54 bortreb: excellent.

21:54 thank you very much qbg

22:27 thunk: If I search for "swank" on clojars, swank-clojure is a result. But if I search for "swank-clojure" is doesn't come up. Is there something I'm missing, or is this a bug?

22:50 ihodes: i came here to vent for a moment.

22:51 i wrote the Game of Life, for funsies, using a sparse array and cool stuff in about 20 minutes or less, about 30 lines of code and all sorts of fun functional awesomeness.

22:52 but then i start up a new buffer, in the ns gol.gui. that's when things got bad. the mindset you get into writing functional code != the mindset you need when dealing with swing. it's like going from zen meditation to running zig-zags through a minefield while singing Amazing Grace backwards. it's awful.

23:05 technomancy: thunk: clojars search is not so hot

23:06 definitely needs work

23:06 thunk: that would actually be a great place to send patches, if you're looking for projects

23:06 thunk: technomancy: Excellent. I'll take a look.

23:07 technomancy: thunk: hop on the clojars-maintainers mailing list; be sure if you do some hacking you build on kotarak's work

23:08 thunk: technomancy: Ok, will do

23:08 technomancy: problem with clojars is the maintainer is rather unresponsive =\

23:10 thunk: Hrm. Maybe I'll make myself annoying :)

23:12 technomancy: it's a valid strategy

23:12 ihodes: technomancy: any news re: new clojars server?

23:12 nothing new on the mailing list.

23:12 technomancy: ihodes: nothing. =(

23:26 ihodes: technomancy: sadface :( i may not have time to get acquainted with everything once the term begins

23:40 Raynes: chouser: Indeed. Class count is rising every time.

Logging service provided by n01se.net