#clojure log - Apr 24 2010

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

0:00 _rata_: finally!! I got slime working with clojure!! ehhh!! :)

0:12 thank you all :)

0:12 I gotta go

0:12 good bye

0:13 mmarczyk: hm, I thought I could test update-bean with BigDecimal / .setScale

0:13 but apparently .setScale returns a new BD

0:13 :-)

0:13 hiredman: excellent

0:13 numbers should be immutable

0:14 slyphon: mmarczyk: what do you use to interact w/ scheme?

0:14 mmarczyk: in fact, everything else should be immutable too ;-)

0:14 hiredman: clojurebot: mk-bean?

0:14 clojurebot: mk-bean is http://gist.github.com/34229

0:14 * slyphon downloaded drscheme and was slightly horrified

0:14 mmarczyk: slyphon: I used DrScheme for the largest projects

0:14 slyphon: yeah?

0:14 hrm

0:15 mmarczyk: oh, and I actually used Edwin for SICP

0:15 for the repl, that is, I wrote the code in Vim

0:15 slyphon: heh :)

0:15 hah!

0:15 nice

0:15 mmarczyk: hiredman: cool! thanks

0:15 hiredman: that code is rather old, so I dunno if it works

0:16 mmarczyk: we'll soon find out :-)

0:17 hiredman: I suppose these days you'd be better off generating a deftype or some such

0:17 mmarczyk: slyphon: about half of the stuff I was running in DrScheme I actually coded in Vim

0:17 slyphon: ahh

0:18 mmarczyk: hiredman: then I'd have to put setFoo getFoo into an interface

0:18 or protocol :-)

0:18 hiredman: ah

0:18 hmm

0:18 slyphon: mmarczyk: i've found vim-mode in emacs to be quite nice

0:18 you hardly feel the emacs

0:18 mmarczyk: :-)

0:19 I used viper + vimpulse for a while

0:19 slyphon: yeah, vim-mode > viper

0:19 mmarczyk: I keep promising myself to configure a viper / vimpulse / paredit / clojure-mode package for use with Clojure code

0:20 slyphon: you should check it out, it really makes emacs much more tolerable to get-around it

0:20 in*

0:20 and :w DTRT

0:20 :D

0:20 mmarczyk: :-)

0:20 yeah, I have checked it out

0:20 I've made some customisations

0:21 it's very good overall I find, but still, some bindings need to be reconciled with those of other modes

0:21 slyphon: yeah

0:21 mmarczyk: presumably () should use paredit functions rather than viper's, for example

0:21 wooby: a viper+paredit+clojure package would be awesome

0:21 slyphon: hm

0:21 vim-mode doesn't conflict with ()

0:21 mmarczyk: it definitely would :-)

0:21 slyphon: in insert mode, at least

0:22 mmarczyk: oh? well, I should investigate it then

0:22 then we'd need Lisp-aware text objects

0:22 Vim has some, but we could use more

0:23 da[ to delete the enclosing Clojure vector :-)

0:23 slyphon: :D

0:23 Raynes: deftype doesn't automagically define "setters" of sorts, does it?

0:23 * Raynes knows it's trivial to define them yourself if you need them. Just curious.

0:24 mmarczyk: Raynes: presumably not, given that fields are immutable by default

0:24 Raynes: mmarczyk: Well, they could return new Foos.

0:25 mmarczyk: would calling a "modified copy" constructor "setBar" not conflict with the good aesthetic sense one finds in Clojure? :-)

0:26 at any rate, just checked, no setters

0:27 Raynes: Don't know. Just sayin'.

0:31 mmarczyk: wow, apparently a field which is declared unsynchronized-mutable is not visible from outside the object

0:32 no way to set it too -- and the docs say that set! should be possible from inside method bodies (which it is), but nothing about it being possible from outside

0:43 reburg: any suggested reading on using existing mutable java libraries in clojure such that they play nice with concurrency?

0:45 Raynes: mmarczyk: defrecord doesn't have accessors of that sort either, right? Just the normal keyword getters. I assume assoc is the best way to do that.

0:52 mmarczyk: Raynes: actually deftype / defrecord create public fields

0:52 so if you want to access them, you can use something like (.foo obj)

0:53 except as mentioned above :unsynchronized-mutable and :volatile-mutable fields seem not to be public

0:53 but they're meant to be special-purpose stuff anyway

0:55 vu3rdd: derefs (@) do not seem to autocomplete for me in slime repl.

0:55 mmarczyk: reburg: isolate & use sparingly

0:55 vu3rdd: but if I say (deref blah) it does

0:55 mmarczyk: (but no actual reading materials beyond that)

0:57 reburg: mmarczyk: i wonder if you could expound on what "isolate" means to you in that case

1:08 mmarczyk: use within a well-defined part of the project which really depends on such a lib

1:09 erect an api wall in clojure around it

1:10 if a lib depends mutable state, the mere fact that it is Clojure code calling into it as opposed to Java code doesn't do any good

1:12 reburg: mmarczyk: that last bit i'm definitely clear on, which is why i asked the question to begin with.

1:12 mmarczyk: thanks, you've reminded me that i haven't wrapped things up nearly as well as i could have

1:13 hiredman: you can use agents to serialize manipulation

1:15 alternatively you can just use a lock

1:19 reburg: hiredman: is there are particular reason you say agents rather than refs?

1:19 mmarczyk: I think agents are meant to be free to reorder their task queues

1:19 hiredman: refs don't serialize access

1:19 mmarczyk: not entirely sure though

1:19 reburg: mmarczyk: i just looked, cause i was curious myself

1:19 hiredman: mmarczyk: I doubt it

1:20 reburg: mmarczyk: apparently they are guaranteed in-order on each thread

1:20 mmarczyk: oh, ok

1:20 carkh: mmarczyk: agents process in the order they receive

1:20 hiredman: it has been some months since the last time I looked at Agent.java

1:20 mmarczyk: thanks for correcting me then :-)

1:21 hiredman: really you want cells, I think, dunno if those ever made it out of the lab

1:21 reburg: hiredman: i guess i was basically thinking about using dosync as a half-assed lock

1:21 mmarczyk: one more question to ask in this kind of scenario would be whether the Java lib needs to operate concurrently, or could it perform its tasks on a single thread (in total or per task) while Clojure code runs around doing lots of stuff on multiple threads

1:21 that might not be too bad

1:22 hiredman: reburg: dosync is way more than halfassed, but it is not a lock

1:22 clojurebot: cells?

1:22 clojurebot: I don't understand.

1:22 reburg: actually, i wasn't even aware you /could/ do simple locking in clojure

1:23 hiredman: (doc locking)

1:23 clojurebot: "([x & body]); Executes exprs in an implicit do, while holding the monitor of x. Will release the monitor of x in all circumstances."

1:23 reburg: good(?) to know

1:24 hiredman: http://gist.github.com/306174

1:25 you would want to stick your java object in a cell

1:26 clojurebot: cells is http://gist.github.com/306174

1:26 clojurebot: Ik begrijp

1:28 reburg: i think i'll try the agent route, thanks all

1:29 hiredman: you might look at how transients are handled

1:30 reburg: hiredman: my mutable object is long-lived; would that really be relevant? or do you mean how the transient code itself works?

1:31 hiredman: how they throw an exception if handled from the wrong thread

1:31 I mean the model of confining mutable state

1:59 rdsr: \

4:19 cYmen: Has anybody installed clojuresque for gradle and can give me some pointers? I'm new to gradle so I really have no clue where (or how) to start...

5:13 borkdude: Normally, how do I start up a new project in emacs with swank-clojure-project> do I first start slime manually or not?

5:20 bsteuber: Borkdude: not - just M-x swank-clojure-project should be sufficient if your project contains a lib folder with clojure, contrib and swank

5:21 Borkdude: hmm yes

5:21 and if I already started slime, should I kill the running process if it asks for it?

5:22 bsteuber: depends on whether you want one or two slimes in parallel :) but probably yes

5:25 _rata_: hi

5:25 Borkdude: ah I think I hadn't downloaded the dependencies, I was assuming it had already done it but probably not

5:25 now it downloads half off clojars ;-)

5:27 ah it works now, tnx

5:29 Hmm, I am using 1.2.0-master-SNAPSHOT. It should have the clojure.contrib.io namespace right?

5:34 I have this in my project.clj:

5:35 [org.clojure/clojure

5:35 "1.2.0-master-SNAPSHOT"]

5:35 [org.clojure/clojure-contrib

5:35 "1.2.0-master-SNAPSHOT"]

5:35 Should it have the clojure.contrib.io namespace or not?

5:36 Chousuke: Borkdude: yes

5:40 _ato: Borkdude: try "1.2.0-SNAPSHOT" for contrib

5:41 looking here, the master one seems out of date for some reason: http://build.clojure.org/snapshots/org/clojure/clojure-contrib/

5:41 sexpbot: "Index of /snapshots/org/clojure/clojure-contrib/"

5:42 Borkdude: ah that might explain it then

5:43 1.2.0-SNAPSNOT hasn't clojure.contrib.io either

5:48 bsteuber: Borkdude: does (use 'clojure.contrib.io) give an error?

5:49 I mean, don't rely on autocompletion for finding out what's there and what's not

5:50 Borkdude: ah it works, I was relying on autocompletion

5:50 but it surely didn't with the master jar

5:52 bsteuber: yeah, the master one is outdated

5:53 the current naming situation is a bit confusing, but it will be better with the next release :)

5:53 at least I hope so ;)

5:53 Borkdude: Having a #clojure window next to *slime-repl clojure* is a must have

5:54 ;-)

5:54 bsteuber: true

5:54 Borkdude: Maybe it can be built in swank-clojure? ;-)

5:55 bsteuber: lol

5:56 Borkdude: Does it update the autocompletions after I 'use' something?

5:56 No idea how this works

5:56 nurv: Hi.

6:00 bsteuber: Borkdude: yes, it should - same with require

6:00 of course, with require you still need namespace qualifiers

6:01 Borkdude: In this example, does it close the reader, initiated by read-lines? (take 1 (read-lines "/home/borkdude/.emacs"))

6:01 I think yes, because the thing gets out of scope

6:03 and probably there will be something like a destructor on it?

6:03 bsteuber: try (doc read-lines)

6:03 clojurebot's contrib is too old to do here :)

6:03 Borkdude: yes, it closes when the stream has been entirely consumed. but what if not? you can never read from the same buffer again in this example

6:05 bsteuber: hm, guess you just want to use this if you want to consume it all

6:05 Borkdude: Then what is the point of the -lazy- seq here?

6:06 Chousuke: Borkdude: memory conservation

6:06 Borkdude: with a lazy seq, you only need to keep one line in memory at a time

6:09 Borkdude: Chousuke, if I realize an entire lazy seq, all lines will be in memory?

6:10 Chousuke: Borkdude: yes, but only if you hold onto the head

6:10 Borkdude: ah right

6:11 these lazy seqs keep tricking me

6:18 So for example: (doseq [n (read-lines "/home/borkdude/.emacs")] (print n))

6:18 Chousuke: yeah. that works.

6:18 Borkdude: if my .emacs would be a terabyte (hypothetically... ;-), still only one line would be in memory at a time

6:19 Chousuke: yeah. in principle anyway

6:19 Borkdude: right

6:20 but still I wonder what happends if I decide only to read the first three lines and then discard the reader

6:20 Chousuke: then the file remains open

6:21 Borkdude: so I better not use read-lines then

6:21 Chousuke: IO and lazy seqs are still an unsolved problem, but apparently rhickey intends to work on it at some point

6:21 Borkdude: in that case I mean

6:22 Chousuke: you can use with-open if read-lines supports taking a stream instead of a filename

6:22 Borkdude: then there's probably something else I can use

6:22 line-seq

6:23 Chousuke: line-seq has the same problem

6:24 Borkdude: If I try this: (with-open [n (reader "/home/borkdude/.emacs")]

6:24 (line-seq n))

6:24 it says n is already closed

6:24 Chousuke: you need to use the line-seq withing the with-open form

6:24 -g

6:26 Borkdude: how does that change my example?

6:27 Chousuke: just put all the code using the line-seq within the with-open form

6:28 (with-open [n ...] (let [s (line-seq n)] (use s)))

6:28 Borkdude: didn't I do that? (with-open [n ...] (line-seq n))

6:29 Chousuke: you can't return the line-seq from the with-open form

6:29 because the stream gets closed and the line-seq becomes unusable

6:29 Borkdude: ah sorry, I had misunderstood how line-seq works

7:17 etate: has anyone managed to get lein and swank-clojure working on windows yet?

7:20 Borkdude: etate, I haven't tried it, switched to ubuntu for that ;-)

7:21 etate: Borkdude: yeah I have ubuntu, but it would be nice if it would work on Windows too

7:21 Borkdude: but yesterday it told me that I could download some jars manually

7:21 still have to try that though

7:21 etate: hmm

7:21 well lein seems to work okay, its just swank-clojure and lein-swank that basically don't work

7:22 Borkdude: aha

7:23 etate: i've given up on trying to do .\lein swank from the cmd line, now i'm just trying to get lein to recognize some working version of swank-clojure, so that i can start it manually from the repl

7:25 Borkdude: There's a thread on ggroups on this, I suppose you already read that?

7:25 Licenser: morgen

7:26 Borkdude: Gutenmorgen Licenser

7:26 etate: Borkdude: yeah, it doesn't work for me

7:27 Borkdude: etate, it would be great if lein would work in windows, to be combined with ClojureBox, it would take away some pain for newcomers like me

7:28 etate: Borkdude: yeah, maven is an option if you're not concerned with native deps

7:29 tbh I think this is the one thing that really sucks with Clojure

7:30 Borkdude: etate: as a newcomer learning maven would also be a curve that would turn me off maybe

7:30 etate: the language is great but the environment is almost unusable for windows people

7:30 Borkdude: etate: I agree. I started using Eclipse + CC in Windows, but then I didn't know how to use leiningen with that

7:31 etate: Borkdude: yeah, leiningen is great in concept but it just doesn't work most of the time.

7:31 Borkdude: so the learning curve for newcomers to have fully working environments from Windows would be: clojure + linux + emacs

7:31 _ato: etate, Borkdude: I don't use windows but can't you just use java -jar leiningen-standalone.jar ?

7:32 etate: Borkdude: there's so many issues with e.g which versions go with which other versions that its just a big mess

7:32 _ato: the leiningen jar gets found appropriately when running the lein.bat script

7:33 _ato: ah.. lein-swank

7:34 Borkdude: why would I use lein-swank instead of swank-clojure-project again?

7:35 etate: _ato: right. lein-swank is the problem, but actually the documentation on technomancy github page is also misleading for windows users.

7:35 _ato: looks like the bat doesn't add lib/* to the classpath

7:35 Licenser: Borkdude: there is also #clojure.de for the german community if you'd want to come over there as well - we're not as fit as the guys here but it's a nice group :) and we grow

7:35 _ato: like the shell script does

7:36 Borkdude: Licenser: I'm not German, although I visit Berlin sometimes

7:36 Licenser: :D Woooh go berlin go!

7:36 _ato: hmm, nope it does

7:36 I just fail at reading bats :p

7:36 * Licenser took the guess since you saied guten morgen ;)

7:36 etate: _ato: yeah it does add the lib dir

7:37 Borkdude: Licenser: just type /whois Borkdude to find out I'm Dutch, that's how I found out you are from Germany ;-)

7:37 etate: _ato: e.g at the moment i have swank-clojure-1.2.0-snapshot.jar in the lib dir, but doing (use 'swank.swank) doesn't work

7:37 Licenser: *g*

7:37 I thought the 'morgen' gave me away :P

7:37 _ato: hmm

7:37 Borkdude: Licenser: no, morgen is also Dutch, so that's why I checked

7:37 Licenser: ah sneaky

7:37 * _ato goes to find a windows box and install java

7:38 etate: _ato: the weird thing is the other deps in that dir _do_ get found

7:38 Licenser: _ato: wow that is support!

7:40 _ato: ah... I see what you mean about the install process being less than obvious

7:40 have to edit the script and set jar path and such

7:40 hmm..

7:41 there's no wget equivalent on windows is there?

7:41 etate: _ato: well actually now the issue is this, i removed the dependency for swank-clojure-1.2.0 (which doesn't get found). I replaced it with swank-clojure-1.1.0 - however this version doesn't work in windows due to a bug which was apparently fixed in version 1.2.0 :)

7:42 _ato: no but cygwin has wget

7:43 Borkdude: there's also a gnu wget you can download without cygwin

7:43 but you might want to install cygwin however, for git support etc anyway

7:44 etate: _ato: so I think the issue is that swank-clojure-1.2.0-SNAPSHOT doesn't load under windows, however I don't even get an error about this. Doing (use 'swank.swank) just says no class found exception.

7:46 actually i mean FileNotFound rather than class not found

7:47 _ato: weird

7:49 is there some special version of emacs that's best to use on windows (a la aquamacs on OS X), or will the binaries from ftp.gnu.org do?

7:50 etate: i use EmacsW32

7:50 zakwilson: I found normal Emacs to be quite workable on Windows last time I checked. I'm not aware of a version with special Windows-native features.

7:51 etate: zakwilson: EmacsW32 has windows-native features

7:51 zakwilson: Listen to etate then. I rarely use editors on Windows.

7:53 _ato: ok I'll test with emacsw32

7:57 Borkdude: btw why what are good reasons to use lein swank instead of swank-clojure-project?

8:01 _ato: the main reason is using it on a remote PC

8:01 so emacs on machine A, swank on machine B

8:07 Borkdude: Suppose I want to use doseq and count the how manieth element I am using

8:08 I tried smth like (doseq [elt some-seq n (iterate inc 0)] ...)

8:08 but that keeps on going forever

8:09 etate: Borkdude: evaluating stuff at the REPL forces it maybe?

8:10 Borkdude: only if I print it right?

8:10 _ato: ,(doseq [[i x] (indexed [:a :b :c])] (println i x ",")))

8:10 clojurebot: 0 :a , 1 :b , 2 :c ,

8:11 _ato: doseq is like for, not like map

8:11 it does a cartesian product if you give it two seqs

8:11 instead of taking them pairwise

8:11 Borkdude: oh, that's good to know ;-)

8:11 MrHus: Can you call a macro from within a proxy?

8:13 _ato: ,(map vector [:a :b :c] [1 2 3])

8:13 clojurebot: ([:a 1] [:b 2] [:c 3])

8:13 _ato: ,(for [x [:a :b :c], i [1 2 3]] [x i])

8:13 clojurebot: ([:a 1] [:a 2] [:a 3] [:b 1] [:b 2] [:b 3] [:c 1] [:c 2] [:c 3])

8:15 _ato: right, I've got emacs, slime and lein running on windows xp... now to try lein swank

8:16 hmm

8:16 "lein swank" just worked :/

8:17 and I can connect to it okay from emacs with M-x slime-connect

8:17 etate: _ato: how did you install lein?

8:17 Borkdude: ,(doc indexed)

8:17 clojurebot: "([s]); Returns a lazy sequence of [index, item] pairs, where items come from 's' and indexes count up from zero. (indexed '(a b c d)) => ([0 a] [1 b] [2 c] [3 d])"

8:19 etate: _ato: are you using the leiningen-1.1.0-standalone.jar and the .bat script on the technomancy website?

8:19 _ato: ah

8:19 whoops

8:19 I accidentally grabbed lein 1.0.1

8:19 will try with lein 1.1.0

8:19 but yes to the bat scripts, unmodified except for setting the jar paths

8:20 Borkdude: in which namespace does indexed live?

8:20 _ato: Borkdude: clojure.contrib.seq-utils

8:20 Borkdude: tnx

8:21 Can I find out here by doing (some-func indexed)?

8:22 _ato: ,indexed

8:22 clojurebot: #<seq_utils$indexed__697 clojure.contrib.seq_utils$indexed__697@1365e86>

8:22 _ato: ,(:ns (meta #'indexed))

8:22 clojurebot: #<Namespace clojure.contrib.seq-utils>

8:23 _ato: etate: hmm works okay with 1.1.0 as well. All I did was take lein.bat leiningen-1.1.0-standalone.jar clojure-1.1.0.jar and chuck 'em in c:\temp\lein

8:24 edited lein.bat to set LEIN_JAR and CLOJURE_JAR

8:24 ran: c:\temp\lein\lein new myproj

8:24 etate: _ato: hmm maybe my lein.bat is using the wrong clojure_jar, i'll try that. you're using lein-swank 1.2.0-snapshot?

8:24 _ato: yep

8:25 etate: here's my project.clj http://gist.github.com/377613

8:26 kzar: So I'm writing a little program that's going to save a bunch of stuff to a MySQL database. Should I create one database connection and then share that between all my queries or should I create a new db connection each time I access the database? I'm curious because it's going to be running with multiple threads

8:26 _ato: "lein deps" to pull everything down and then "lein swank" and it said it was listening on port 4005 and emacs connected to it ok

8:26 carkh: kzar : one connection per action triggered by the user

8:27 the rule is: close your connections as soon as possible

8:27 and a single connection per thread yes

8:27 etate: _ato: just trying it now

8:27 kzar: carkh: OK thanks

8:28 krumholt: ,(doc filter)

8:28 clojurebot: "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns true. pred must be free of side-effects."

8:32 etate: _ato: hmm still getting "swank" is not a task when running ..\lein.bat swank

8:33 _ato: etate: hmm and "lein deps" downloaded the swank-clojure.jar to your project's lib directory?

8:34 etate: swank-clojure-1.2.0-SNAPSHOT yep

8:35 _ato: hmm, you're not trying this from a path that contains spaces right?

8:35 just trying to think of other things that could go wrong

8:36 etate: _ato: nope, c:\Users\xyz\lein

8:36 _ato: the weird thing is that swank-clojure 1.1.0 can get loaded but doesn't work

8:37 _ato: I should mention i'm on Windows 7 not XP

8:39 _ato: just tried running it as admin, no difference, when using lein-swank 1.2.0-snapshot, lein swank doesn't recognize swank as a task. I can get a repl no problems, but it only loads swank-clojure 1.1.0 in that repl.

8:40 _ato: where did you get your standalone-leiningen jar from?

8:41 _ato: what if you edit the bat and put an echo in front of java (the one after :RUN) you can then see what it's setting the classpath to and make sure its putting swank-clojure jar on there correctly

8:41 http://github.com/downloads/technomancy/leiningen/leiningen-1.1.0-standalone.jar

8:44 etate: _ato: it looks correct to me

8:48 _ato: well I'm stumped :(

8:48 here's my setup if you want to take a look: http://clojars.org/~ato/tmp/lein-1.1.0-win32.zip

8:49 etate: _ato: page not found :D

8:49 _ato: ah

8:49 http://meshy.org/~ato/tmp/lein-1.1.0-win32.zip

8:49 wrong domain :p

8:49 etate: _ato: the only difference I can see is that the swank-clojure pathnames end in -SNAPSHOT.jar

8:50 _ato: that's weird

8:51 mine has this: http://gist.github.com/377627

8:52 swank-clojure-1.2.0-20100308.145053-6.jar

8:53 etate: _ato: wt..? are you using a different lein.bat script

8:55 _ato: this is my lein.bat (it's in that lein-1.1.0-win32.zip as well): http://gist.github.com/377629

8:55 etate: _ato: http://gist.github.com/377630

8:55 thats my lib dir after lein.bat deps

8:57 hey your .bat script looks different

8:57 _ato: I think there's a maven option which changes whether it calls snapshots -SNAPSHOT or the actual number

8:57 etate: _ato: oh, do you think this would make a difference

8:58 _ato: it shouldn't matter

8:58 shouldn't matter at all what they're called

8:58 I just got lein.bat from here and modified the set LEIN_JAR bit: http://github.com/technomancy/leiningen/raw/stable/bin/lein.bat

8:58 etate: _ato: in your .bat file you jave %~dp0\ at the front of your LEIN_JAR, what does that mean?

8:59 _ato: %~dp0 means the directory the .bat file is in

9:00 didn't want to hard code it

9:00 so I googled and found that way ;-)

9:00 etate: _ato: :D

9:01 _ato: apart from that I set the wrong variables it looks like

9:01 _ato: I changed the ones under :SET_LEIN etc instead of the remmed ones

9:03 _ato: no difference

9:04 _ato: I'm pretty sure its a problem in swank-clojure

9:04 _ato: since the version 1.1.0 loads correctly :/

9:05 _ato: :/

9:07 Blkt: could anyone help me with a "programming style" question?

9:13 etate: _ato: I used your zip and I get the same problem "swank" is not a taks

9:13 "task

9:13 Borkdude: Blkt: I'm not sure if I'm able to help, but you can just try and ask your question and see who will answer

9:14 Blkt: Borkdude: first of all, do u know a good paste site with Clojure syntax highlight?

9:15 etate: _ato: when you do java -version what comes out? mine is Java Client VM 16.0-b13, mixed mode

9:16 kzar: Supposing I need to do a query to check if a row exists in my database before I insert a new one. I could use with-connection at the start of the checking function and use it again at the start of the insert function but it seems wasteful to connect twice like that. Is there a way to do it but only connect once? I guess I would like to write the check function in a way that can either re-use the connection that's the

9:16 re or if there isn't one create one

9:17 Borkdude: Blkt, I don't know, but there are sites like pastebin that support a lot of programming languages, not Clojure though

9:18 Blkt: Borkdude: I wrote it here http://clojure.pastebin.com/d2x5f85A

9:18 etate: _ato: Problems might also be because you have a different shell in XP than in Windows 7

9:18 Blkt: Borkdude: that code should initialize an 8x8 board with 20 tiles, 16 representing hares and 4 representing foxes

9:19 Borkdude: since I don't want an already set position to be overwritten, and since coordinates are randomized

9:19 etate: _ato: were you using cmd.exe or command.com?

9:20 Blkt: Borkdude: how can I make it shorter?

9:20 carkh: kzar : you would do that with a single connection yes

9:20 Blkt: Borkdude: that's quite hugly

9:24 _ato: etate: 1.6.0_20, cmd.exe

9:24 Borkdude: Hmm... I don't want to be unfriendly, but I gtg do some afk work now..

9:24 I hope someone else here can help you refactor it

9:24 _ato: hotspot 16.3-b01 mixed mode

9:26 Blkt: Borkdude: nvm, thanks anyway

9:27 carkh: Blkt: functional styl would be to return a new board

9:28 style

9:28 then you may decompose a bit

9:28 have a function that will find a free element

9:29 (get-random-free-coords board)

9:30 also you have (i think) 16 hares and 4 foxes

9:30 this is not directly apparent from your code

9:30 kzar: carkh: This is what I mean, how would you structure it? http://paste.lisp.org/display/98272

9:31 carkh: (concat (repeat 16 :hare) (repeat 4 :fox))

9:31 etate: _ato: I give up, i'm going to try on cygwin and see if anything works better there

9:32 carkh: kzar : what kind of application is that ? you have a user acting on a menu ?

9:32 open your connection at that level

9:33 and never think about it again

9:33 kzar: carkh: No it's more like a scraper that is putting data into a database

9:33 carkh: run time is very long ?

9:34 i guess you could open a connection each time you download a page

9:34 so that you don't loose anything that was already processd

9:34 kzar: carkh: Yea it's going to be ages

9:35 carkh: or open a connection per thread, then a transaction per page

9:35 kzar: carkh: But how would you structure that example so that you could call already-stored? from inside and outside of (with-connection

9:35 carkh: open the connection at a higher level

9:36 kzar: oh ok I see

9:36 carkh: don't open the connection inside insert-data

9:37 i have this pretty large application which is both a web server and connects to some telecom equipment to get the data (telephone calls)

9:37 so i open a database connection before processing any page

9:38 there is only one place where i open a connection in all the web server part

9:39 then for the part where i process the (realtime) calls, i open a connection for each call

9:39 kzar: cool

9:39 I might do something like that to get the log from my cisco router later

9:43 I'll just use couchdb for the stuff I'm going to use though

9:44 carkh: make sure it is well suited for your task

9:44 going the nosql route can be great, as long as you don't need the relational stuff

9:45 kzar: Yea for this thing I'm scraping it would fit a lot better but I want to share the DB with people that I know will want SQL

9:49 krumholt_: can someone explain to me how binding and let differ when used with inlining? for example (binding [+ -] (+ 1 1)) behaves different then (let [+ -] (+ 1 1)). is that to be expected?

9:55 carkh: Blkt: http://clojure.pastebin.com/WvxvbYB7

9:59 patrkris: rhickey: clojure.org/reader says keywords cannot contain '.' - is that a glitch in the docs?

10:00 Chousuke: krumholt_: binding makes a dynamic binding, so when the function call is evaluated the binding is in effect, but since (+ 1 1) form is inlined at compile time to something that doesn't contain a call to +, the binding appears to fail to work

10:01 krumholt_: Chousuke, and how is that different from let?

10:01 Chousuke: krumholt_: with let, the + name never even refers to the + function (it refers to the - function), so it works.

10:02 carkh: let is lexical

10:02 binding is dynamic and work with vars

10:02 so the ocmpiler knows what is + in the let case

10:02 (i would guess)

10:03 Chousuke: well it knows that it will point to whatever - pointed to when the let is evaluated

10:03 carkh: right

10:03 rhickey: patrkris: 'cannot contain' doesn't mean 'will throw an exception if you try'. Do you have a non-superficial need for '.'s in keywords? Obviously the prefix can contain, as tat is what :: does. Should be clearer I guess

10:03 Chousuke: if you did (binding [- +] (let [+ -] (+ 1 2))) the binding would affect the + call (except inlining would foil it again)

10:04 Blkt: carkh: thanks, I just read it

10:04 patrkris: rhickey: nope, just stumbled upon what I thought was a mistake

10:05 Blkt: carkh: it looks much better

10:05 carkh: Blkt: you're avoiding side effects this way

10:05 Blkt: that's more in line with clojure

10:06 krumholt_: Chousuke, ok. it still seems a bit strange. thanks all

10:06 Chousuke: krumholt_: dynamic binding is not very intuitive

10:06 krumholt_: but the real thing at fault here is inlining

10:07 krumholt_: (+ 1 1) becomes (Numbers/add 1 1) or something so there's no way for a dynamic binding to affect it

10:07 but (+ 1 1 1) is affected because it's not inlined

10:07 krumholt_: yeah i think i understand now. inlining happens at compile time. while binding happens at runtime. so it never sees a + in the code at runtime

10:36 raph_amiard: Hi there

10:36 i have a problem with swank-clojure

10:36 when i start it with the 'slime' command everything is fine

10:37 however if i try 'swank-clojure-project' i just get the 'Polling ...' message

10:37 and nothing ever happens

10:37 i have this error on two different computers, both installed with swank-clojure through ELPA

10:38 bozhidar: raph_amiard: you can see exactly the problem

10:39 by looking at the inferior lisp buffer

10:40 raph_amiard: ok i'll look at that but i'm not even sure it opens

10:40 bozhidar: aah yeah it does

10:42 bozhidar: and let me guess - you're missing clojure.main

10:42 or something like this

10:43 raph_amiard: yeah .. :)

10:43 sorry had to fix a real world problem

10:43 i have a class def error because it can't find clojure/main

10:44 bozhidar: you need to create the project with leiningen

10:44 so that your dependencies get handled properly

10:44 raph_amiard: ok thanks

10:44 let me grab some docs about leiningen

10:44 never used it yet

10:45 bozhidar: raph_amiard: it's simple - something like maven

10:45 raph_amiard: ok i'm installing it

10:45 thank you very much !

10:46 bozhidar: http://github.com/technomancy/leiningen

10:46 have a look here

10:46 this should be enough to get you started

10:47 afterwards when you point swank-clojure-project to the root of the project everything will work fine

11:12 gigiclantza: (binding [inc dec] (inc 0))

11:12 ,(binding [inc dec] (inc 0))

11:12 clojurebot: 1

11:12 gigiclantza: any idea why that happens?

11:13 carkh: yes !

11:13 gigiclantza: but this works as expected:

11:13 ,(binding [inc dec] (apply inc [0]))

11:13 clojurebot: -1

11:13 carkh: tyhis was discussed like £1hour ago =P

11:13 raph_amiard: i guess i have another question, how do you know all available dependencies for lein, and their name ?

11:13 gigiclantza: carkh: are there logs?

11:13 carkh: http://clojure-log.n01se.net/

11:13 sexpbot: "#clojure log - Apr 24 2010"

11:36 gigiclantza: carkh: Thanks for the info. I still have no idea why a multimethod does not dispatch like I want it to (can't rebind isa?) but this was a really informative detour

11:37 carkh: i didn't see your question about a multimethod

11:53 technomancy: raph_amiard: you can search clojars.org for clojure deps and jarvana.com for java deps

11:53 raph_amiard: there's also a new lein search plugin, but I'm not sure if it's documented yet

11:53 Licenser: ^ ?

11:54 fro0g: technomancy: can I send you a patch for swank-clojure?

11:54 zakwilson: Is there a function for getting the position of the first element of a sequence that satisfies a predicate?

11:54 technomancy: fro0g: yes, but I probably won't be able to apply it promptly

11:54 * technomancy has a large patch backlog

11:54 technomancy: but I love getting patches

11:54 it's a conundrum.

11:55 fro0g: technomancy: np, I'll email it to you

11:56 hamza: zakwilson: positions in c.c.seq-utils

11:56 zakwilson: hamza: thanks

11:57 technomancy: zakwilson: (first (filter my-pred my-seq))

11:57 since filter is lazy, it will only perform enough calculation to find a single match

11:57 zakwilson: technomancy: I don't want the match. I want its position.

11:57 technomancy: oh, look at me misreading the question

11:58 zakwilson: Just verified that positions does what I want.

12:15 fro0g: technomancy: did you receive it? Sorry for the format, I have to setup my sendmail clone properly.

12:24 technomancy: fro0g: yeah, looks fine

12:24 I really do want to get a new swank-clojure release out soon

12:24 just have a lot of things going on.

12:28 fro0g: technomancy: great, no worries. I guess we'd all want more time for clojure hacking :)

12:32 rrc7cz-hm: for anyone using emacs, how do you delete an outter (), [], etc? for example, if you have ((x)) and want to delete the extra parens. After I installed slime/swank it wouldn't let me delete them anymore unelss they were empty

12:32 Borkdude: Maybe paredit won't let you?

12:33 rrc7cz-hm: Borkdude: that's probably it

12:33 what's the solution? I can cut/paste the inner () outside, then delete the empty (), but that's not really a solution

12:34 Borkdude: I turn paredit-mode off :)

12:37 remleduff: rrc7cz-hm: M-s

12:38 DeusExPikachu: to load a new jar during runtime, the only way I figured to do that is by extracting the jar (its a zip file) into a directory which was already in the classpath, anyone else come up with a different solution?

12:38 rrc7cz-hm: remleduff: awesome! thanks

12:39 Borkdude: remleduff: I am trying it now too

12:40 but it won't do anything here

12:40 it expects another key

12:40 rrc7cz-hm: works for me

12:40 remleduff: rrc7cz-hm: np, have you seen http://www.emacswiki.org/emacs/PareditCheatsheet ? The only problem is, it's hard to know which ones are useful. I really like: (|) someform, then pressing C-<right> which becomes (someform)

12:40 sexpbot: "EmacsWiki: Paredit Cheatsheet"

12:40 remleduff: The bar there represents your cursor

12:40 Borkdude: You have to be within the sexp

12:41 rrc7cz-hm: remleduff: I was searching that as you answered. To be honest I still don't see it on here. I got 5 pages of cheat sheets and can't find anything :-D

12:42 M-( looks good too

12:42 remleduff: M-s is "paredit-slice-sexp" which tells you nothing until you know what it does ;)

12:42 The examples are great though

12:43 technomancy: slurp and raise are the ones I use all the time

12:43 DeusExPikachu: C-h m puts you in the documentation for all the modes in emacs, including paredit, if active, thats a very important key sequence to remember

12:43 * for all modes currently active

12:44 technomancy: err--splice, rather than raise

12:45 remleduff: technomancy: If I'm using lein-swank 1.2.0-SNAPSHOT, it works fine the first time I start emacs and slime-connect. Is expected that I can't connect again if I quite emacs and start it again (I say yes to "Do I want to kill active processes when emacs prompts me when I quit")

12:45 technomancy: remleduff: since that's something I don't do myself, I can only say the behaviour is "undefined" =)

12:46 I've never tried it. sounds like an annoying bug though.

12:47 remleduff: It just says "connection refused" in *messages*

12:47 technomancy: I always launch lein swank from inside eshell, so my swank server never outlives my emacs session

12:47 remleduff: Ah

12:48 Borkdude: ah it works now, paredit-mode wasn't enabled yet because I had some unmatched ones somewhere... it's really strict ;)

12:48 remleduff: I may look into that if I get anymore free time then. Another question then, do you happen to have any idea what combination of versions is necessary to get this clj-imports.el (http://dishevelled.net/elisp/clj-imports.el) to work?

12:49 technomancy: remleduff: I don't know, but I really want to get that functionality in swank itself

12:51 remleduff: I want it to work so badly, I'm using a java library and having to import just tons and tons of stuff manually ;)

12:52 Does slime-connect run ~/.clojure/user.clj ?

12:52 technomancy: remleduff: one way to find out. =)

12:53 remleduff: I think the answer is no for some reason, I should have asked, is it supposed to? ;)

12:53 technomancy: remleduff: I wrote a very basic naieve version of that a while back; I think it wouldn't be too much work to do from scratch

12:53 there are already some classpath-walking functions you can build from

12:57 remleduff: Hmm, if you slime-disconnect are you able to slime-connect after? I've just noticed that I can't, maybe that's part of my problem

12:58 technomancy: yeah, that would be it

13:01 remleduff: Do you mean that you can?

13:01 technomancy: I mean that's the root of the issue

13:01 I have the same problem

13:01 remleduff: ok, thanks, wondered if it was just me :)

13:05 Borkdude: ah I'm starting to like paredit after this cheat sheet

13:07 technomancy: Borkdude: see also: http://p.hagelb.org/paredit-script.html

13:07 sexpbot: "outline.markdown"

13:08 Borkdude: what is the reasong for having an init.el instead of a .emacs btw?

13:08 technomancy: Borkdude: easier if everything's in one directory

13:10 Borkdude: you mean for things like git ?

13:11 technomancy: ja

13:12 emacs config belongs in git

13:12 or a dvcs at least

13:12 Borkdude: I'm still trying to find out, there's much to learn all at once

13:13 tnx for the link

13:24 technomancy: Borkdude: well you wouldn't want to run out of things to learn now, would you?

13:24 Borkdude: that's true

13:24 * licoresse wouldn't

13:28 technomancy: well if you do just wait a few weeks and rhickey will invent more new concepts.

13:32 Borkdude: gtg, bye

13:33 rsynnott: Hey, I'm trying to write a system which has many in-memory objects (structs) some of which contain refs or collections of refs to other objects. I'd like to be able to mark these as dirty to be written to disk at a later date when they are modified. I know I can detect that they've been modified using a watch, but at that point, is it okay to write that data somewhere else (using another dosync?)

13:34 tcrayford: its ok

13:34 not reccomended, but ok

13:34 rsynnott: In Common Lisp I'd just use a CLOS MOP setter to do this, probably (similar to how Elephant or Rucksack works) but that obviously isn't practical here

13:34 tcrayford: aye

13:34 rsynnott: Is there a recommended way to do this sort of thing?

13:34 tcrayford: for marking stuff as dirty, metadata is great

13:35 (ie has been modified, needs to be written to disk)

13:35 I just do a send-off in a dosync when I get data

13:35 seems to hold up reasonably well

13:36 grammati: ,(do (require '(clojure.contrib [io :as io])) (doc io))

13:36 clojurebot: java.io.FileNotFoundException: Could not locate clojure/contrib/io__init.class or clojure/contrib/io.clj on classpath:

13:36 grammati: does doc work on a namespace?

13:36 tcrayford: no

13:36 use (:doc (meta NAMESPACE))

13:38 The-Kenny: What's the best way to check if all elements in a seq are = some other thing? (every? #(= :foo %) [:foo :foo :bar])?

13:38 stuarthalloway: #{:foo}

13:39 grammati: tcrayford: you mean like (:doc (meta io)) ?

13:39 a_strange_guy: ,(every #{2} [2 2 2 2 2])

13:39 clojurebot: java.lang.Exception: Unable to resolve symbol: every in this context

13:39 a_strange_guy: ,(every? #{2} [2 2 2 2 2])

13:39 clojurebot: true

13:39 The-Kenny: Ah, perfect. Thanks

13:40 tcrayford: grammati, as I understand it should be (:doc (meta (find-ns clojure.contrib.io)))

13:40 rsynnott: tcrayford: ah, yes, that owuld work, I suppose

13:40 tcrayford: or summat like that

13:40 rsynnott: my idea is that periodically any dirty data would be collected, and written out; some data loss in the event of a crash or machine failure is tolerable

13:40 though I suppose I could do logging, again based on the difference from a watcher

13:41 grammati: tcrayford: yup, find-ns is the trick. thanks

13:41 tcrayford: a watcher would be fine in that case, no?

13:41 rsynnott: yep

13:41 yep, it should work; just feels slightly messy

13:42 tcrayford: aye

13:43 I haven't really found a better solution for that myself

13:43 rsynnott: I suppose replication to another machine is actually a possibility that way, too

13:45 My idea was to assign each 'object' a unique ID; when an object is being persisted and is found to contain a ref, then, that ref could be persisted as a special value containing the oid, then when the object was being recreated from disk the correct ref could be put in

13:48 Blackfoot: is there an issue with dashes in namespace or lein project names? lein compile doesn't pick up my .clj file if it has a dash in it, it seems

13:49 stuarthalloway: files should have underscores, correlating with dashes in clojure packages

13:49 that's Clojure, not just lein

13:51 bsteuber: stuarthalloway: do you know the reason for this? actually, I tried dashes in a maven project and it worked fine - but maybe it's still bad for e.g. portability issues

13:51 stuarthalloway: I know way more than I want to about the reason for it :-)

13:52 the dash is not a legal char in names in Java

13:52 and some JVMs enforce it

13:52 e.g. the IBM JDK

13:52 bsteuber: stuarthalloway: I see - then I'll better drop it from there :)

13:53 Blackfoot: stuarthalloway: ah thank you

13:53 and thanks for writing the book, it's a great resource

13:54 stuarthalloway: glad to hear it, thanks!

13:54 rsynnott: A dash isn't a legal filename character in Windows, is it?

13:54 that on its own would probably be enough that it would be undesirable as a java name

13:56 vu3rdd: stuarthalloway: I really liked the "how we work" page of your company..

13:56 stuarthalloway: vu3rdd: it's as fun as it sounds :-)

14:01 Blackfoot: hadn't seen that before, these are nice. too bad you guys are over in NC

14:06 vu3rdd: stuarthalloway: any plans to write an addendum to the book on clojure 1.2 features?

14:06 tcrayford: stuarthalloway: Is the API for circumspec going to change anytime soon? I've been tempted to write something like clojure-test-mode for it, but would rather wait until the api is settled

14:06 vu3rdd: btw, it is a nice book. I really like it

14:06 mefesto: "open source fridays", what a great idea!

14:07 stuarthalloway: vu3rdd: thinking about recording a screencast this weekend

14:07 vu3rdd: stuarthalloway: thanks.

14:07 stuarthalloway: tcrayford: I have encouraged Stuart Sierra to steal the good parts of the API and merge them into lazy-test. I believe he has done so to some degree

14:08 vu3rdd: stuarthalloway: being not much experience in Java (I do C at work with embedded systems and clojure is purely hpbby for me), I find the new features like deftype reify etc to be a bit over my head

14:08 stuarthalloway: once lazy-test gets steam I will stop maintaining circumspec

14:08 tcrayford: right

14:08 stuarthalloway: vu3rdd: Java experience wouldn't necessarily help :-)

14:08 tcrayford: I was wondering which of them to pick (for an emacs runner), so thanks for that

14:09 stuarthalloway: np

14:09 vu3rdd: stuarthalloway: right.

14:10 tcrayford: does anybody know if any of the major IDE's do clojure refactoring yet?

14:10 vu3rdd: stuarthalloway: I mean, I don't get why they are there. In the high level, I understand they will help for clojure-in-clojure.

14:11 stuarthalloway: vu3rdd: don't tempt me to spew the screencast right now on IRC :-)

14:11 vu3rdd: :-)

14:11 stuarthalloway: but in short: take a look at protocols.clj and gvec.clj in clojure itself

14:11 vu3rdd: stuarthalloway: sure.

14:12 stuarthalloway: the kinds of problems being solved there are clojure-in-clojure, as you say

14:12 but those kinds of problems occur in *any* sizable software project

14:12 vu3rdd: ok

14:13 stuarthalloway: I can't wait to see your screencast.

14:13 * vu3rdd doing a git pull

14:15 sattvik: stuarthalloway: I noticed your updates to 266. Did the .compareAt actually use reflection? I tested with *warn-on-reflection* turned on, and it didn't seem to raise a flag except when test itself was calling .compareAt. Is the reflection inside the method hidden by this?

14:15 stuarthalloway: you would have to have *warn-on-reflection* turned on while clojure.core was loading to see the problem that way

14:16 sattvik: stuarthalloway: Ah, OK. I'll keep that in mind for next time.

14:17 stuarthalloway: I decided it was using reflection by rubbing my head against it. Not very efficient. :-)

14:18 what does "sattvik" mean?

14:18 sattvik: stuarthalloway: Hmm.. although, now that I think of it. If I do a (load "clojure/gvec"), would it show up there?

14:21 stuarthalloway: sattvik: hmm. Having tried that, now I am wondering if my patch was unnecessary

14:22 sattvik: stuarthalloway: 'sattvik' is the adjective form of the Sanskrit "sattva", which essentially means "pure". Though, that doesn't quite convey the whole meaning.

14:23 stuarthalloway: filed under 99.44% pure then :-)

14:24 sattvik: Ah, I just learned something

14:24 the reflection warnings don't come in order by line number

14:24 and yes, by loading gvec you can see the reflection warning

14:25 sattvik: stuarthalloway: Ah, ok. My mistake, then.

14:25 stuarthalloway: (was confused a minute ago because I thought the reflection warnings didn't appear)

14:25 thanks for the patch! I hope you will have time for more in the future

14:26 sattvik: stuarthalloway: I must have been confused by the same thing. I had a function that reloaded gvec and ran the tests in one go, so I probably just missed it as I concentrated on the wrong thing.

14:27 mmarczyk: tcrayford: grammati: actually (doc some.namespace) works, provided some.namespace has been required (checked with current HEAD)

14:32 rrc7cz-hm: is there any reason in particular that lein doesn't support phase chaining, like "lein clean compile uberjar"?

14:33 Nikelandjelo: Is there a way to apply and\or to a sequence of booleans without creating functions?

14:33 sattvik: stuarthalloway: No problem. I hope to do more. Is there a real desire to move the ASM code out of Clojure? I noticed it was on the Clojure-in-Clojure page on Assembla. I am thinking that may be a good task to take on, since I don't like the idea of bundled libraries.

14:35 mmarczyk: rrc7cz-hm: the reason is presumably that nobody has submitted a patch to do that yet :-)

14:35 mefesto: Nikelandjelo: something like: (every? true? [true true false]) ?

14:36 an 'or' could use this: (some true? [true true false])

14:37 rrc7cz-hm: mmarczyk: that's better news than it being ruled out to keep it simple

14:37 Nikelandjelo: mefesto: Oh, thanks :)

14:38 mmarczyk: rrc7cz-hm: I do believe that compile is superfluous in your example, though

14:38 stuarthalloway: sattvik: I think there will be a lot of lower-hanging fruit than ASM

14:38 mmarczyk: iirc, afaik compiles :namespaces from project.clj

14:38 ^^ uberjar compiles

14:40 rrc7cz-hm: ok

14:41 vu3rdd: sattvik: debian already does that. We use the libasm3 which ships with debian.

14:41 sattvik: stuarthalloway: True. It's just that the ASM thing bugs me. It's generally considered a bad idea to bundle libraries, mostly for security reasons. Granted, I don't think that the use of ASM in Clojure is likely to pose a serious risk.

14:41 vu3rdd: Interesing. I'll have to take a look at that for Gentoo.

14:42 vu3rdd: sattvik: take a look at the debian package: http://packages.debian.org/sid/clojure

14:42 sexpbot: "Debian -- Details of package clojure in sid"

14:49 sattvik: vu3rdd: I like it. I'll work on porting some of these things over to Gentoo. It'd be a good idea for the ASM patch to be submitted upstream.

14:50 stuarthalloway: ,(reduce #(and %1 %2) [true true true])

14:50 clojurebot: true

14:50 vu3rdd: sattvik: yes, I was thinking about that. I will talk to Peter who originally did that work. I maintain clojure-contrib in debian and he maintains clojure

14:56 licoresse: mongodb or couchdb?

15:07 nurv: Hi.

15:58 _brian2_: noob question> why is it in leiningen project when I change a clojure source file (under /src) even after I run lein clean it tells me "All :namespaces already compiled." and doesn't re-compile?

16:00 livingston: does the source file define any java classes? or just pure clojure?

16:00 _brian2_: it has java classes

16:02 livingston: is clean supposed to build too? I don't think that it does, when I run lein clean it flushes the lib directory

16:02 then I need to run lein deps again to get the libraries again, then whatever else I do

16:02 _brian2_: no,i mean lein clean then lein compile

16:03 ok, so I need to load the deps again?

16:04 no that doesnt work

16:05 livingston: when I run lein clean I have to reload deps, but I don't call lein compile (so perhpas that does it for you)

16:06 _brian2_: actually, there aren't any class files showing up

16:06 under classes

16:07 livingston: unless you are generating java classes (like with gen-class, or whatever the keyword/functions are) I don't think there will be any - at least I don't have any, but i'm running pure clojure from source

16:08 _brian2_: yea, Im trying to generate java classes

16:09 livingston: _brian2_: ask technomancy

16:09 _brian2_: I put (:gen-class) in it

16:09 ok

16:10 * technomancy glances up

16:10 livingston: _brian2_: not that I don't want to help but, I'll try, I just haven't done it, and I just noticed he just joined (and is the developer)

16:10 _brian2_: np

16:11 livingston: technomancy: _brian2_ was having trouble getting lein to generate his java classes

16:11 _brian2_: i'll put it in a pastebin

16:22 technomancy> I put the source and project files here: http://clojure.pastebin.com/gG6cbVrq

16:23 doesn''t seem to be generating java classes

16:24 technomancy: what exactly are you expecting?

16:24 _brian2_: i want to generate a jar file

16:24 technomancy: that is, why are you expecting it to generate java classes?

16:24 _brian2_: i have (:gen-class) there

16:25 technomancy: must have removed it before pasting

16:25 _brian2_: hmm

16:25 technomancy: the :main in project.clj doesn't match up with the ns at the top

16:25 _brian2_: ok

16:25 livingston: yeah I don't see it, you have to do more than define -main to get a class

16:25 _brian2_: ok

16:26 technomancy: ~ticket #315

16:26 clojurebot: {:url http://tinyurl.com/37u5rdb, :summary "Add support for running -main namespace from clojure.main without AOT", :status :test, :priority :normal, :created-on "2010-04-24T12:04:43-04:00"}

16:26 technomancy: _brian2_: but if all you want is -main, you might be better of with that patch rather than doing AOT: ^

16:27 I mean, once it's accepted into clojure

16:31 hamza: technomancy: is it possible to override clean so that it will clean artifacts created by additional plug ins?

16:32 technomancy: hamza: not yet

16:32 I have some ideas for a hook system that will let you tie into built-in tasks

16:32 hamza: technomancy: ok thanks..

16:34 technomancy: if you are interested in using such a hook system I could elaborate

16:34 but unless you can help out with implementation it's going to be at least a few months out

16:39 hamza: i have a bunch of plugins that creates executables and such for now i have my own clean that cleans my artifacts than i call leins clean plugin.

16:40 _brian2_: technomancy> what patch ? I looked at ur website, i dont c it

16:40 technomancy: _brian2_: the one clojurebot linked to

16:40 patrkris: technomancy: do you know of something for leiningen that enables the use of project templates? For instance, if I want to try something out quickly in a compojure setting, you could invoke something like `lein project webproject` - if you catch my meaning?

16:40 _brian2_: ok

16:41 patrkris: patrkris: ugh, excuse my bad English

16:41 technomancy: patrkris: I don't know of anything like that. it'd be pretty easy to just throw together a new one-off "new-compojure" plugin except for the fact that right now plugins only work if they are part of an existing project.

16:42 again, I have long-term plans to deal with that, but nothing concrete yet

16:43 patrkris: technomancy: yeah, you'd have to change the lein-script, right?

16:43 slyphon: wow, so scheme is like lisp without all of those convenient "functions" and stuff

16:44 technomancy: patrkris: probably. I'm thinking of plugins that would activate on a per-user basis across all projects.

16:44 nurv: slyphon: well, no.

16:44 slyphon: yeah, i'm just being facetious

16:44 livingston: patrkris: you could create an empty lein project that has the core of what you wnat, then just copy the directory and change the names when you wnat to do that

16:45 patrkris: livingston: yes, good idea

16:45 livingston: not as "friendly" as what you are talking about, but it would get the job done

16:47 slyphon: they have major philosophical differences too

16:47 slyphon: yeah, i gathered that

16:49 livingston: slyphon: the history and discussion on the two and how common lisp formed are quite interesting, I encourage you to look it up / read about it

17:08 remleduff: patrkris: What you are asking for sounds similar to what is called a "maven archetype" for example: (http://github.com/stuartsierra/clojure-archetype)

17:09 patrkris: remleduff: Oh. So I can just create a maven archetype and use mvn to "instantiate" it?

17:10 remleduff: yeah, that's the idea

17:10 patrkris: remleduff: nice

17:10 technomancy: sort of. you first have to get it into maven central.

17:10 patrkris: can I use my local repository?

17:10 technomancy: and even then it's like a three-line command to create the simplest of skeletons =\

17:10 patrkris: yeah, that's right :(

17:12 remleduff: I'm not going to defend maven by any means ;)

17:12 It's a little nice that once you've set up archetypes, they'll potentially show up in your IDE. I know they do in IDEA at least

17:13 technomancy: you can't list contents of a directory on the classpath if it's in a jar, can you?

17:15 fro0g: technomancy: I sent you a second version of the patch, forget about the first one as that was against jochus repository, the new version is against you repo

17:16 technomancy: great

17:19 remleduff: ,(enumeration-seq (.. (Thread/currentThread) (getContextClassLoader) (getResources "com/sun")))

17:19 clojurebot: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)

17:20 technomancy: remleduff: that's for a seq of all the files with the same name on the classpath

17:20 if you want to get around the "first thing on the classpath wins" rule

17:20 remleduff: Shouldn't you be able to take that and list the files in each though?

17:22 technomancy: no, it just returns a seq of URLs

17:23 I don't think you can get a java.io.File object for a dir inside a jar without expanding the jar

17:24 livingston: technomancy: presumably there is some way ? I would think that resources in a jar could do that, it would be silly otherwise

17:24 remleduff: I'm thinking you're right actually

17:24 technomancy: istr hearing that there was no way, would love to be proven wrong. =)

17:24 livingston: extremely worst case you could get a manifest of the jar (but that also seems silly)

17:24 chouser: you can get an inputstream on a file in a jar

17:26 livingston: I know you can store files as resources in a jar (so you can get around locla file system path issuses), I would assume you can do that with whole directories too, but maybe not.

17:28 technomancy: you can store directories, you just can't list their contents.

17:28 livingston: that's really dumb if true

17:28 there's so much good code that works by saying "load (or what ever) all the files in this dir

17:29 _brian2_: technomancy: this still doesn't seem to generate java classes http://clojure.pastebin.com/04h1yG4M

17:31 livingston: well, worst case you could do something like they did here: http://www.rgagnon.com/javadetails/java-0665.html and then filter for the files matching the directory you care about

17:31 sexpbot: "List all files in the classpath or in a Jar - Real's Java How-to"

17:32 technomancy: _brian2_: looks like you're using a single-segment namespace?

17:32 ~single-segment

17:32 clojurebot: single-segment namespaces is unsupported. (foo instead of foo.core) they may work in a few circumstances, but you shouldn't rely on them.

17:32 _brian2_: ok

17:33 thnks

17:33 technomancy: brixen: also you're using classes without importing or fully-qualifying them

17:33 oops, I mean _brian2_

17:33 _brian2_: ok

17:34 livingston: yeah, wow, the zip/jar interfaces are pretty sparse, I would not have suspected that

17:34 technomancy: livingston: I think that may have more to do with the underlying limitations of the format rather than shortcomings in the JDK

17:34 you can actually create a zip file that has files in directories that don't exist

17:34 and it won't blow up until you try to unzip it

17:35 _brian2_: works for me after fully-qualifiying the class names

17:35 but surely the error messages were pointing that out?

17:36 livingston: yeah I'm just surprised that jar hasn't become a superset of zip with a billion features glommed on... I guess there's something ot be said for simplicity though (for once in java)

17:36 is the jar file in question under your control?

17:36 _brian2_: technomancy: sorry, but how do I do that?

17:37 technomancy: livingston: not really. in this case I'm OK with requiring the directory in question to be on the classpath on disk rather than in a jar though

17:37 livingston: you could put a resource in it in a known location that contains the list of "stuff I care about"

17:37 technomancy: just thought it'd be nice to support the jar if it were easy

17:37 _brian2_: File => java.io.File, etc.

17:38 livingston: well it'd be a hack, but you could do it with the manifest way, and just use anything say that matches a given prefix or something, or even take the names from the manifest/elements and run them through the File API, I don't think it would be that ugly, depending on your needs

17:39 _brian2_: technomancy: sorry I'm still not sure what u mean

17:39 livingston: I'm glad we talked about this though, because there are some people in my office that just wnat to shove everything in jars to get around file system issues, but there be dragons, apparently

17:39 technomancy: livingston: heh; not worth it in this case

17:40 _brian2_: you can only refer to unqualified class names without importing them if they are part of java.lang

17:40 so clojure doesn't know where to find stuff like PushbackReader

17:41 _brian2_: ok

17:41 livingston: what's a nice clean example of something dispatching on type like strings vs. symbols. v. default...

17:42 technomancy: too bad though; it was turning out to be a nice use of ->

17:42 hiredman: livingston: an interpreter

17:44 livingston: no I was just looking for some clean code to copy this is a start though: http://clojure.org/multimethods

17:44 hiredman: I have this compiler which is two multimethods

17:46 livingston: I'm still having a little trouble sorting out types in clojure, it's interaction with meta, and the fact that a lot of things just boil down to maps (or seem to, like defstruct)

17:46 hiredman: the first does type dispatch, and if it is a seq it passes it to the second multimethod which does dispatch on the value of the first form

17:46 _brian2_: technomancy> I might see these things, but lein doesnt send the errors, it just says everything already compiled for this namespace

17:46 which was my original question

17:47 livingston: it's not something that's confusing to me in general, it's just coming from *a lot* of common lisp, I have some biases to overcome

17:48 hiredman: makes sense, fairly straightforward recursive decent design

17:48 Chousuke: Clojure 1.1 doesn't really have a "native" mechanism for creating types of any kind. deftype in 1.2 changes that though.

17:48 technomancy: _brian2_: it's probably not trying to compile it because the :main in project.clj doesn't match the file on disk

17:48 Chousuke: but in general, working with generic data structures is idiomatic

17:48 technomancy: I can't tell what you're naming the file on disk from your paste

17:49 livingston: Chousuke: that kinda makes sense. I'm using 1.2 though, it's coming soon and no reason to prematurely cripple my design (I also really want the par code when it becomes available)

17:50 and then there is the interaction with the compiler meta data with tags #^ but that's only for type hints to the compiler, right? that's not getting burned in or used anywhere else?

17:51 Chousuke: livingston: a big point about defrecord (the macro you're supposed to use for your own types) is though that record types work a lot like normal maps

17:52 livingston: so ideally you'd still treat them like maps

17:54 zakwilson: I want to parse a log originating from Colloquy. It looks a lot like XML, but doesn't seem to be quite legal XML, and clojure.xml/parse throws "Content is not allowed in prolog.". I'm far from an expert on XML. Any suggestions on where to start?

17:54 livingston: so this: #(.intValue #^Literal %) is in the code at: http://github.com/richhickey/rdfm/blob/master/src/org/clojure/rdfm.clj

17:55 Chousuke: so that's just saying that the input (the %) is hinted to be of type Literal? is that right?

17:55 Chousuke: livingston: #^ is a construct to attach metadata to symbols at read time

17:55 livingston: #^foo bar is shorthand for #^{:tag foo} bar

17:55 hiredman: to anything that supports metadata

17:55 Chousuke: well, yeah. most often symbols though.

17:56 hiredman: sure

17:56 livingston: can you have mulitple tag types?

17:56 Chousuke: anyway, a :tag foo metadata on a form signals the compiler that its type is *probably* foo :P

17:56 hiredman: livingston: not possibly jvm wise

17:57 you can't cast something to be of two types

17:57 livingston: so the "tag" key is specially observed by the compiler but otherwise has no magic or import attached to it

17:57 technomancy: opinions on using single-segment test namespaces?

17:57 Chousuke: livingston: the compiler generates non-reflective code if the tag is there. no other magic

17:57 livingston: ok this is really helping

17:58 and now if I want to give things a "type" for purposes of dispatch and whatnot is there a preferred way?

17:58 hiredman: ,(doc type)

17:58 clojurebot: "([x]); Returns the :type metadata of x, or its Class if none"

17:59 livingston: for example if I have defstruct ball and defstruct bat and I want them to behave differently - by default they just generate maps, right?

17:59 hiredman: ,(type #^{:type ::blarg} (symbol "foo"))

17:59 clojurebot: clojure.lang.Symbol

17:59 hiredman: bah

17:59 livingston: lol

17:59 Chousuke: you put the type on the list, not the foo symbol :)

17:59 hiredman: ,(type (with-meta 'foo {:type ::blarg}))

17:59 clojurebot: :sandbox/blarg

18:00 Chousuke: livingston: you can just have the type as part of your data too, without any metadata trickery

18:00 livingston: the multimethod dispatch function can then look at it and determine the "type"

18:00 livingston: ok so I should be using the type keyword it seems...

18:00 hiredman: you can determine type by examining the key set of maps!

18:01 Chousuke: eg (defmulti foo :bar) <- foo dispatches on the value of :bar in a map or other associative thing

18:02 hiredman: you can make your own type multimethod and use a variety of means of determining the 'type' of something

18:02 livingston: Chousuke: but they I would have to put a field in all my defstructs to support that

18:02 Chousuke: also (defmulti foo (comp :bar meta)) <- foo dispatches on the value of :bar in the metadata map of anything

18:03 basically, how you want to dispatch is up to you

18:03 livingston: I get the crazy openness of dispatch in clojure, I just was looking for the most approprate straightford type-like way

18:03 Chousuke: you can even (defmulti foo (get-phase-of-moon)) :P

18:03 _brian2_: technomancy: could you clarify your last comment....I have under/src this: mango-01.clj and in project file :main mango-01 ; I also changed ns to mongo.mango-01 and reflect in project file

18:03 Chousuke: livingston: type is probably the most common way then

18:03 livingston: also see the documentation for isa?

18:04 technomancy: _brian2_: you need something like src/mango/core.clj with (ns mango.core [...]) and :main mango.core in project.clj

18:04 Chousuke: livingston: multimethods use that to determine type relationships

18:04 livingston: so things should only have one "type" keyword assocaite with them

18:04 technomancy: _brian2_: have you tried "lein new"? you should base your project structure on that.

18:04 livingston: I shouldn't type something as two things (but I could isa that into the right structure)

18:04 _brian2_: no, i have tried that yet

18:05 hiredman: you can dispatch on vectors of things

18:05 technomancy: _brian2_: I should have mentioned that earlier. saves a lot of guesswork.

18:05 hiredman: ,(doc isa?)

18:05 clojurebot: "([child parent] [h child parent]); Returns true if (= child parent), or child is directly or indirectly derived from parent, either via a Java type inheritance relationship or a relationship established via derive. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to the global hierarchy"

18:05 _brian2_: oh, i c, ok

18:05 livingston: so if I have two "types" of symbols I probably want to have them "typed" by using meta :type

18:05 hiredman: ,(isa? [String Number] [Object Object])]

18:05 clojurebot: true

18:05 hiredman: ,(isa? [String Number] [Object Object])

18:05 clojurebot: true

18:06 livingston: now for my defstructs I could do the same trick.. or maybe I should be using defrecord now? which does hold onto it's record type, right?

18:06 hiredman: so you can have multiple complex types

18:06 livingston: I would just use maps

18:06 Chousuke: livingston: prefer defrecord to defstruct

18:06 livingston: hiredman: oh that's interesting

18:07 ^ re the multiple isa? bit

18:07 Chousuke: livingston: but I suggest you do experiments. Just try to avoid falling into a "type trap" :)

18:07 not everything needs its own type

18:07 hiredman: ,(isa? [String [Number String]] [Object [Object Charset]])

18:07 clojurebot: java.lang.Exception: Unable to resolve symbol: Charset in this context

18:07 livingston: ok, one vote map, one vote defrecord, lol

18:07 hiredman: ,(isa? [String [Number String]] [Object [Object Characterset]])

18:07 clojurebot: java.lang.Exception: Unable to resolve symbol: Characterset in this context

18:07 hiredman: ,(isa? [String [Number String]] [Object [Object CharacterSet]])

18:07 clojurebot: java.lang.Exception: Unable to resolve symbol: CharacterSet in this context

18:07 Chousuke: livingston: well, a defrecord is a map, so...

18:07 hiredman: bah

18:08 Chousuke: livingston: a plain map is the most flexible choice for prototyping though.

18:08 livingston: but if you write code that works with a map it'll most likely work with a defrecord too

18:09 livingston: do the types for protocols prefer anything specific?

18:09 dnolen: livingston: defrecord really only make sense if the 1) construction time is critical 2) field access time is critical 3) you'll be calling some fn on the record more than 10,000,000 a second

18:10 Chousuke: or if you need to implement protocols

18:10 protocols do class-based dispatch AFAIK.

18:10 livingston: dnolen: possibly, but premature optimisation is bad, for sure... if I start with maps is the transfer to records transparent / trivial?

18:10 Chousuke: which won't really work with maps, since they all have the same class

18:11 livingston: should be. they implement all the map interfaces

18:11 livingston: Well I have 2 things needing to be built now...

18:11 Chousuke: livingston: if you run into problems, I'm sure rhickey would be interested

18:12 livingston: one is probably a protocol based wrapper for Jena / Jena servers

18:12 some servers like AllegroGraph implement their own version of Jena which is "faster", so it has to be different under the hood, but I want to expose one API so the user doesn't care which server they are talkign to

18:13 hiredman: livingston: you might look at http://github.com/richhickey/rdfm

18:13 livingston: that's an obvious protocol choice (I think?)

18:13 Chousuke: yeah. or multimethods.

18:13 though protocols will be faster

18:13 hiredman: some one recently did a series of blog posts about a protocol for rdf stores

18:14 livingston: i'm looking at that, it's really primarily tooled for persisting clojure structures in an rdf store - neat, but not really what I need I need support for knowledge representation and reasoning

18:14 hiredman: stuartsierra has a clojure-rdf lib too

18:14 livingston: hiredman: I've seen some things - a pointer if you have it would be great

18:14 hiredman: http://www.objectcommando.com/blog/2010/04/12/clojure-protocols-part-3/

18:14 sexpbot: "Object Commando &raquo; Clojure Protocols Part 3"

18:15 livingston: the stuartsierra stuff seems to be for implementing the store in clojure and clojure's memeory - it seemed...

18:16 hiredman: ok, I haven't really used any of it, just stuff I remember seeing around

18:16 dnolen: livingston: converting to defrecord is not necessarily trivial. can't destructure args. no rest arguments, simple type based dispatch.

18:16 livingston: but there are other issues I don't want the Jena data classes polluting my clojure code a RDF Resource is really just a symbol, so that can be made cool - if done right

18:16 hiredman: oh I wasn't trying to sound argumentative, I really apprecate the pointers

18:16 dnolen: good to know

18:17 so it sounds like there are some serious design choices there...

18:19 the second part to my puzzle is identifying pieces of RDF, for the most part it looks like lists and symbols and strings, but there are reasons to want to have additional details about them (like if they are already fully qualified URI's or not, etc...) ...

18:19 that seems like a job for metadata then, right?

18:20 dnolen: livingston: possibly. metadata seems to me to be most useful when you want to tag something without affecting equality.

18:21 otherwise just assoc your own data to thing, you can't change the original anyway.

18:22 livingston: right but if I want it to look like lists and read like lists, that gets uglier then

18:22 dnolen: livingston: oh yeah, sorry missed that bit.

18:23 livingston: I really don't want a "triple" data structure if I can avoid it, since really RDF is just '(sub pred obj) that seems *really* convienent

18:23 there's some other messiness when blank-ndes get involved though

18:26 one potential problem with my appraoch to make lots of symbols is that they might live too long and create memory problems when they are no longer needed

18:31 can protocols contain multimethods?

18:32 I'm guessing no, and I would just have my protocol method call a specfic multi-method for that protocol implementation

20:21 Licenser: technomancy|away: lein search has in program help and a (slightly outdated) one on the github page I'l update as soon as I find a feee moment (and have sleeped)

20:21 night poeple

20:39 lithper1_: when using swank-clojure-project, is there a way to have the new project directory created, and all the necessary files moved to /lib? for now, i just modified the elisp code to create all that stuff. is there a preferred method?

21:24 remleduff: Is clojure mode or swank-clojure supposed to be actually offering me java class completions? Like if I type Integer/va should it offer me valueOf? I seem to only be getting buffer history completion

21:26 _ato: it completes for me

21:27 remleduff: I use M-tab (or C-c tab) which is bound to slime-complete-symbol-function

21:27 remleduff: Aha, using the wrong completion, I am

21:27 ty

21:43 webwanderer: What does the -> operator do?

21:43 hiredman: wonderful things

21:43 webwanderer: Like what?

21:43 :)

21:44 hiredman: ,mexapand-all

21:44 clojurebot: java.lang.Exception: Unable to resolve symbol: mexapand-all in this context

21:44 webwanderer: '->' macro that is

21:44 cp2: it gives you wings!

21:44 it'll buy you a new car even

21:44 hiredman: ,m-exapand-all

21:44 clojurebot: java.lang.Exception: Unable to resolve symbol: m-exapand-all in this context

21:44 hiredman: ,m-exapandall

21:44 clojurebot: java.lang.Exception: Unable to resolve symbol: m-exapandall in this context

21:44 hiredman: bah

21:45 ,(use 'clojure.contrib.macro-utils)

21:45 clojurebot: nil

21:45 hiredman: ,mexapand-all

21:45 clojurebot: java.lang.Exception: Unable to resolve symbol: mexapand-all in this context

21:45 hiredman: what the devil is it called

21:45 ,mexpand-all

21:45 clojurebot: #<macro_utils$mexpand_all__4397 clojure.contrib.macro_utils$mexpand_all__4397@b0b955>

21:45 hiredman: right

21:46 ,(mexpand-all '(-> a (X Y) E F G (W R)))

21:46 clojurebot: (W (G (F (E (X a Y)))) R)

21:46 hiredman: that is what it does

21:46 compare to

21:46 ,(mexpand-all '(->> a (X Y) E F G (W R)))

21:46 clojurebot: (W R (G (F (E (X Y a)))))

21:47 webwanderer: what's it good for?

21:48 hiredman: ,(->> "foo" .getClass .getMethods (map #(.getName %)))

21:48 clojurebot: ("hashCode" "compareTo" "compareTo" "indexOf" "indexOf" "indexOf" "indexOf" "equals" "toString" "length" "isEmpty" "charAt" "codePointAt" "codePointBefore" "codePointCount" "offsetByCodePoints" "getChars" "getBytes" "getBytes" "getBytes" "getBytes" "contentEquals" "contentEquals" "equalsIgnoreCase" "compareToIgnoreCase" "regionMatches" "regionMatches" "startsWith" "startsWith" "endsWith" "lastIndexOf" "lastIndexOf" "lastIn

21:48 carkh: ,(-> {} (assoc :a 1) (assoc :b 3) println)

21:48 clojurebot: {:b 3, :a 1}

21:48 hiredman: ,(require '[clojure.zip :as zip])

21:48 clojurebot: nil

21:49 hiredman: ,(-> '(a (b c (d e) r) t) zip/seq-zip)

21:49 clojurebot: [(a (b c (d e) r) t) nil]

21:49 hiredman: ,(-> '(a (b c (d e) r) t) zip/seq-zip zip/next zip/next zip/next zip/next (zip/replace F) zip/root)

21:49 clojurebot: java.lang.Exception: Unable to resolve symbol: F in this context

21:49 hiredman: ,(-> '(a (b c (d e) r) t) zip/seq-zip zip/next zip/next zip/next zip/next (zip/replace 'F) zip/root)

21:49 clojurebot: (a (b F (d e) r) t)

21:50 hiredman: ,(-> '(a (b c (d e) r) t) zip/seq-zip zip/next zip/next zip/next zip/next (zip/replace 'F) zip/next zip/next (zip/replace '(M M)) zip/root)

21:50 clojurebot: (a (b F ((M M) e) r) t)

21:51 hiredman: man, it's been a while since I've played with zippers

21:52 webwanderer: hiredman; thanks.

21:52 _ato: webwanderer: the boring answer is that it's good for reducing nesting and making things readable ;-)

21:53 hiredman: I got accused of being a forth programmer the other day

21:53 webwanderer: cool

21:54 carkh: hiredman: there are strong similarities between functional programming and stack based programming

21:54 sometimes haskell code (pointfree) really looks like forth

21:54 hiredman: sure

21:57 carkh: only instead of passing a stack between words, you pass a return value i guess

21:58 cp2: hiredman: hehe

22:17 vu3rdd: _ato: I can't seem to get the java completions to work in slime

22:18 I have slime-fuzzy enabled

22:20 rlb: If I use clojure.xml/parse to grab an rss feed then emit it, clojure produces xml that chokes firefox. It looks like that's because it's not escaping the ampersands in the channel string.

22:20 Possible bug?

22:20 vu3rdd: Ah, I get it now. But I had to disable slime-fuzzy

22:20 hiredman: emit is undocumented because it doesn't really work

22:20 mmarczyk: rlb: use c.c.lazy-xml instead

22:21 also see this SO question

22:21 http://stackoverflow.com/questions/2463129/roundtripping-xml-in-clojure-using-clojure-xml-parse-and-clojure-xml-emit

22:21 sexpbot: "Roundtripping xml in Clojure using clojure.xml/parse and clojure.xml/emit - Stack Overflow"

22:23 rlb: OK, thanks. I didn't notice that it was undocumented.

23:05 technomancy: anyone who's watched the peepcode care to comment on this preview of my next blog post about updating Mire to Clojure 1.2? http://p.hagelb.org/mire-1-year.html

23:05 sexpbot: "136.yml"

23:12 vu3rdd: technomancy: looks good. I had bought the peepcode sometime last year

23:13 technomancy: I can see a branch 14 in the repo now.

23:29 remleduff: Hmphh, do you think clojure should be careful when printing things at the repl? If a "bad" object with an equals method that throws an exception gets printed, my repl crashes.

23:30 I wonder how careful clojure should be though

23:30 ,(proxy [Object] (equals [o] (.toString nil)))

23:30 clojurebot: java.lang.IllegalStateException: Var null/null is unbound.

23:31 remleduff: ,(println "I hope I'm ok")

23:31 clojurebot: I hope I'm ok

23:33 remleduff: Oh, messed up my proxy syntax

23:33 ,(proxy [Object] [] (equals [o] (.toString nil)))

23:33 clojurebot: java.lang.IllegalStateException: Var null/null is unbound.

23:33 remleduff: ,(println "ok")

23:33 clojurebot: ok

23:35 slyphon: gah

23:35 * slyphon stabs java reflection in the taint

23:55 gstamp: (partion 2 [1 2 3 4 5]) gives back ((1 2) (3 4)). Is there any easy way to get back the remaining unmatched numbers (in this case the 5)?

23:57 mmarczyk: (clojure.contrib.seq/partition-all 2 [1 2 3 4 5])

23:57 ,(clojure.contrib.seq/partition-all 2 [1 2 3 4 5])

23:57 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.seq

23:57 mmarczyk: ouch, well

Logging service provided by n01se.net