0:00 Chouser: but of course I can't actually do that in Clojure, so instead it produces a vector.
0:00 like [[:tr ...] [:tr ...]]
0:01 so now a vector in this structure can mean two things -- either an element (if it beings with a keyword like :tr) or an anonymous group of elements that need to be spliced in.
0:01 arohner: right
0:01 Chouser: That seems clumsy, but I'm not sure I've seen an idea I prefer.
0:02 I don't like the side-effect mechanism used by CL-WHO
0:02 arohner: I like the (:tr) syntax better, but I get the feeling that has evaluation implications I haven't thought of yet
0:03 Chouser: oh, really? I prefer [:tr], but I wouldn't put up a fuss either way.
0:03 I think the templating in webjure used `() all over specifically so it could use ~@ to splice in multiple results. ...but I'm not sure, and the results aren't exactly pretty.
0:05 arohner: yeah, but at least that has well understood consequences
0:05 btw, I'm a complete lisp noob, so don't take any of this as definitive :-)
0:05 my sole qualification is that I've read SICP
0:06 wybiral: SICP ftw!
0:06 Chouser: well, I read On Lisp, and never could get the hang on Common Lisp, so I'm not really one to talk.
0:07 arohner: and SICP doesn't give you good practice with macros
0:07 wybiral: But it's a great introduction to functional programming
0:08 arohner: the one thing I like about webjure's use of ` and ~@ is that it uses a clearly defined mechanism built into the language
0:08 that makes me feel more comfortable than a macro, which could be doing who knows what
0:09 Chouser: well, my example doesn't require a macro or ` ~ ~@ syntax. Just clumsy corner cases. :-)
0:10 Ok, I'm off to bed. You folks have a nice whatever-you're-having!
0:10 arohner: later
1:00 Lau_of_DK: Top of the morning gents =)
1:00 arbscht: hiya
1:13 Lau_of_DK: arbscht are you like a 24 hour coding machine? :)
1:14 arbscht: 24 hour - yes. coding - I wish. :)
1:14 Lau_of_DK: I didn't look into that error msg last night, I got hooked on some XML - boy its difficult in Clojure compared to C#
1:16 albino: xml is difficult in all languages
1:19 Lau_of_DK: No its quite easy in C# actually
1:19 very very easy
1:19 arbscht: Lau_of_DK: can you post a comparison somewhere?
1:20 albino: Is it a literal notation? Or do you just like their library interface?
1:22 Lau_of_DK: arbscht Im sorry, no, because I still dont have a working model in Clojure
1:22 arbscht: Lau_of_DK: I see
1:23 Lau_of_DK: But in C# if you want to dig down and alter 1 node, you do it like this XmlDoc.getNodes("/root/nodes").getSingleNode("MyNode") = "New value";
1:23 This is intuitively easy I would say
1:23 Then just XmlDoc.Save() and you're done
1:27 albino: almost xpath like
1:27 Lau_of_DK: its very xpath like
1:28 albino: still not easy IMO, but probably compared to other approaches
1:28 Lau_of_DK: its simplified a bit, because after you get the singlenode object, you can modified .InnerXML, .outXML, .Attributes and so on. Here C#'s object structure is fantastic actually
1:28 What would be easier?
1:31 albino: not using xml in the first place :)
1:32 Lau_of_DK: let me rephrase: What approach to manipulting XML would be easier?
1:41 yep, its a tough one - I cant think of a simpler way :)
1:59 Chouser: (zip/replace (first (xml-> xml-doc :nodes :MyNode down)) "New value")
2:00 Lau_of_DK: Certainly you jest young Chouser
2:00 Chouser: I do. But not about this.
2:01 Lau_of_DK: What is "down" ?
2:01 Chouser: that's using "xml->" from zip-filter in clojure-contrib, which was inspired by xpath
2:01 down is from zip.clj, as is replace
2:01 Lau_of_DK: but what does it do ?
2:02 Chouser: it descends from MyNode to it's contents, since you don't want to replace MyNode itself, but rather whats inside.
2:02 Lau_of_DK: Funny, I get an "unable to resolve symbol: down"
2:02 Chouser: try zip/down
2:03 but unlike (I assume) the C# version, this is functional -- no side effects and therefore completely thread safe without locking.
2:04 Lau_of_DK: its destructuring right?
2:04 Chouser: also, with the lazy-xml stuff I still haven't quite checked in yet, I believe it would be lazy -- essentially nothing after the first MyNode element would have even needed to be parsed yet.
2:05 Lau_of_DK: not really, at least not the kind of destructuring that's listed as a Clojure feature. That's for setting of locals (let, defn, for, etc.) which I'm not doing in that example.
2:06 Lau_of_DK: k
2:06 Chouser: BTW, I didn't mean to suggest my example is simpler than the C#. *maybe* similarly simple, but certainly less mature and less documented.
2:07 Just demontrating that something of roughly the same complexity would be possible. eventually.
2:08 Lau_of_DK: But what would be wrong in stating that it was simpler? In a way, it actually is
2:08 Chouser: what's actually going on with the zip stuff is a bit tricky to get one's head around
2:09 Lau_of_DK: Very much - Also because I didn't first understand that Zip was an XML library, I thought it was a helper to zip keys/values in tree structs
2:09 Chouser: ah, see ... zip is not an xml library.
2:09 Lau_of_DK: I think that its hard to follow a certain trend/theme when reading through the clojure source files, which combined with my recent switch to clojure, is not making it very easy
2:10 Chouser: xml trees are one of the things zip can manipulate.
2:10 Lau_of_DK: Chouser. Would you at least consider writing Practical Concurrent Clojure ?
2:11 Chouser: Would you publish it? :-)
2:12 Lau_of_DK: On my very own website
2:13 Joking aside, I think you have a natural ability to make things understandable, quickly. So you should consider putting it good use somewhere, somehow
2:13 Chouser: zip is a way to navigate and "modify" trees of data (such as XML) without side effects.
2:13 Lau_of_DK: (though not for my benefit, for you and your family)
2:14 Chouser: Lau_of_DK: why thank you. I think I would like, one day when I have been sufficiently educated, to teach.
2:14 Lau_of_DK: I would support - I might even sign up for a class
2:18 Chouser: I don't know where I'd find the time without taking it away from paying work. But thanks for the endorsement! :-)
2:18 And now I'm really off to bed.
2:19 Lau_of_DK: Sleep tight, and thanks for your input
4:14 meredydd: Chouser: you here?
4:50 Lau_of_DK: Chouser went to sleep 2 - 3 hours ago
4:50 meredydd: bugger.
4:50 Hm....does that make him an Ozzie?
4:50 (well...antipodean, at any rate)
4:58 Lau_of_DK: I dont recognize those words
5:25 meredydd: Ozzie = Australian
5:25 the Antipodes are those parts of the world roughly diametrically opposite to Britain :D
5:25 Transaction question:
5:25 cgrand: where people walk on the head
5:26 meredydd: If I make a call in a (dosync), and inside that call is another (dosync), am I right in thinking that the whole thing is one transaction that either happens or doesn't?
5:28 cgrand: afaik that's how it works
5:28 meredydd: (This seems to be the sensible way to do it, as it neatly solves the proverbial bank-account problem: say I have the fun 'add' = #(dosync (alter bank-balance (+ %)), and 'remove' = #(dosync (alter bank-balance (- %)), a transfer function that goes #(dosync (add 5) (remove 5)) should Do The Right Thing)
5:30 cgrand: I don't think that putting dosyncs in add and remove is sensible because then add or remove can be used alone
8:06 Lau_of_DK: Anybody here competent to answer an XML question?
9:28 Ycros: Lau_of_DK: never ask to ask, you won't get anywhere
10:51 cemerick: I have an interface that extends IPersistentCollection, and a gen-class spec for an implementation of that interface. However, when I import the gen-class class, I get "java.lang.IllegalStateException: empty already refers to: #'com.foo.Bar/empty in namespace: com.foo.Bar". I know I don't have any definitions of empty in com.foo.Bar, and removing the :implements option from the gen-class spec eliminates this error. Any thoughts?
10:53 Chouser: IPersistentCollection has an empty, and since you might choose to override that later, it's got a name imported into your gen-class namespace.
11:13 cemerick: Chouser: Thanks for that tip -- a couple of things just clicked into place in my head. :-)
11:14 That seems like collisions like that will be a common thing.
11:27 Chouser: yes.
11:27 rhickey's mentioned a plan to help eliviate the issue
11:46 cemerick: Yeah, I know he's been thinking/working on gen-class revamp. I just didn't fully understand what was going on until just a little while ago. :-)
11:47 Looks like there's no prn-str (or similar) that will readably print an object and return the result as a string (rather than dumping it to stdout).
11:53 Whoa, nevermind -- I was looking at a very old version of boot.clj.
11:54 * cemerick svn update :(
17:43 dvl_: hi. how do i use http://
17:45 kotarak: in general: (new java.net.Proxy <arguments> <go> <here>) (or shorter (java.net.Proxy. <arguments>))
17:55 dvl_: (new Proxy (. Proxy$Type HTTP) seems to cut it
23:00 arohner: has anyone played with java arrays in clojure?
23:01 (def my-file (new File "/Users/arohner/"))
23:01 (class (. my-file (listFiles)))
23:01 does that output look right?
23:07 well, not right, but I expected something prettier
23:07 like java.io.File