#clojure log - Dec 17 2010

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

0:03 amalloy: joshua__: i'd suggest designing it as some non-database data structure first. since mongo is pretty strongly associative, you can probably translate it pretty directly

0:05 joshua__: Alright that sounds good.

0:05 amalloy: eg a graph with the connection properties you want, and then turn the links into object references

0:07 joshua__: I had heard that it was possible to embed documents within documents in mongo. I was wondering whether that meant you could just literally have one document per post with other documents embeded within it.

0:08 Or does that sound like something that doesn't fit mongo?

0:09 amalloy: joshua__: i don't actually know that much about mongo. i do know that each object/entry can have links to other entries

0:10 i mostly think of mongo as a persistent linked-list/map

0:13 joshua__: What I'm wondering really: {:top_id 1 :value 2 :children [{:top_id 2 :value 3 :children []}} might have a way to index on all_top ids.. So If I asked the database for top_id 2 it would give it to me.

0:21 mji: was looking for some help with format string vulnerbility in C .. ?

0:23 amalloy: joshua__: i don't think so

0:24 tonyl: $mymail

0:24 sexpbot: You have no messages.

0:24 joshua__: amalloy: I'm reading up on how indexing works right now. I'll get this figured out eventually ;).

0:25 duckinator: Hey, I'm working on just a minor rewrite of someone's code which uses "hiccup", and found (defn home [] (html ...)), and I can't tell if it's the same as (defhtml home ...) - i'm looking at http://weavejester.github.com/hiccup/hiccup.core-api.html#hiccup.core/defhtml

0:28 amalloy: duckinator: you can try macroexpanding them both and see what they look like. from a quick glance at hiccup it looks to me like defhtml does more than just wrap in an html, but i've never used it

0:36 joshua__: amalloy, it sounds like you can do what I was thinking of, not sure yet

0:38 amalloy, nvm

1:21 arnabd: Hello guys - starting up with clojure (following https://github.com/technomancy/leiningen/blob/master/TUTORIAL.md) - need a bit of help

1:22 amalloy: arnabd: okay, shoot

1:22 arnabd: i created a new lein project - and everything was fine until I added this to the project.clj:

1:22 :main clojure_url_synopsizer.clj)

1:23 and added a clojure_url_synopsizer/core.clj file with:

1:23 (ns clojure_url_synopsizer.core

1:23 (:gen-class))

1:23 (defn -main [& args]

1:23 (println "Hello from Clojure! What did you mean by? " args))

1:23 amalloy: arnabd: :main wants a namespace, not a filename

1:23 arnabd: however lein uberjar fails saying: java.io.FileNotFoundException: Could not locate clojure_url_synopsizer/clj__init.class or clojure_url_synopsizer/clj.clj on classpath:

1:24 yeah - I guessed that. And I tried the ns as clojure-url-synopsizer

1:24 amalloy: so :main clojure_url_synopsizer.core

1:24 no .clj

1:25 ie, the value of :main should be exactly identical to what comes right after (ns

1:25 arnabd: *duh. Got it.

1:25 thx - it works

1:25 amalloy: great, enjoy

2:56 auser: so... if I have a (defn funcA []... in namespace A and in namespace b I call (:require [namespace.A :as a), shouldn't I be able to call (a/funcA)?

2:56 or am I misunderstanding something

3:01 replaca: auser: do you want to share the real (ns ...) statement and real require statement?

3:01 auser: sure, I can most definitely

3:01 replaca: generally that idea should work

3:04 auser: it's here replaca: https://gist.github.com/c15dd8de27fc76a0e81b

3:05 replaca: auser: look here for an example: https://github.com/clojure/clojure/blob/787938361128c2bc21ed896dd4523651b59cb420/src/clj/clojure/template.clj#L28

3:05 auser: yeah, that's "similar" to what I have actually

3:06 except the function takes no arguments

3:06 the one that I have, that is

3:06 replaca: well, you have circular requires, which won't work

3:06 auser: oh

3:06 yeah

3:06 I was wondering about that

3:07 I think I can remove that, actually

3:07 replaca: but I don't know why it would throw *that* error

3:07 auser: yeah

3:07 I thought I had the syntax right

3:07 it's been boggling me for the better part of the hour

3:08 replaca: otherwise it looks ok to me

3:08 try it without the circular ref and see if that makes it go away

3:08 auser: removing that dependency has been the only thing that fixed it... I can prolly still call methods in the other namespace by using the entire namespace, right?

3:08 yeah, it did

3:08 interesting

3:08 my tests still fail, but that's cleared up the error

3:08 replaca: sometimes clojure's errors are not so clear

3:08 :)

3:09 auser: yeah... I come from erlang, trust me... these are much better errors

3:09 replaca: haha

3:09 auser: well, at least from '03

3:09 rather R13B03

3:10 :) thanks replaca

3:10 replaca: np

3:14 auser: one more quickie question... how can I get the name of the namespace I'm *currently* in?

3:14 if you know

3:21 replaca: auser: *ns*

3:21 auser: that's it? sweet

3:21 thx

3:36 gju_: hello, i'm looking for a good way to get started with clojure. can someone suggest some good ressources except the plain docs?

3:40 LauJensen: gju_: I've been running a blog for over a year now on Clojure, it has topics from easy/entry-level to very advanced: http://www.bestinclass.dk/blog.html

3:41 Now tell me, is this cool or crazy? https://github.com/LauJensen/clojureql/commit/1e7e8e933ed19bd71bed6be1607b84c2bfa3c2ab

3:42 gju_: LauJensen: thx, i'll give it a shot.

3:44 AWizzArd: LauJensen: useful

3:49 LauJensen: k

3:53 ordnungswidrig: hi

3:57 is there a plugin for lein to show for which dependencies there are newer versions available?

5:30 bobo_: LauJensen: maybe its just me, but wouldnt it be even niser if you only select the email in the query, and then only get the email back? ie, single item single row retuns just one item?

5:30 *nicer

5:49 LauJensen: bobo_: Example?

8:40 FireSnake: anyone know how to set the classpath in leiningen

8:41 I have a project that can't find my compojure/core.clj file because it's not on the classpath

8:47 stuartsierra: You don't need to set the classpath per se, you need a dependency.

8:48 FireSnake: Stuart thank you so much -- where do I set it

8:48 stuartsierra: in project.clj

8:49 FireSnake: ok thanks -- so I set dev-dependencies to what compojure.core and that will do it?

8:49 the dev-dependencies pulls in stuff outside the classpath

8:49 ?

8:49 stuartsierra: No, you want :dependencies

8:49 FireSnake: ok thanks

8:49 stuartsierra: not :dev-dependencies, those are for local development only

8:49 And you set it to the name of the library as reported on clojars.org

8:51 FireSnake: Do I set it as compojure/core.clj or compojure.core -- what is the difference between / and . in this context

8:52 thanks so much stuart

8:52 I'll play with it

8:54 stuartsierra: Library names — the name of a JAR file in a public repository — do not necessarily correspond to namespace names like "compojure.core"

9:03 chouser: stuartsierra: well, we've got 2 or 3 dozen lazytest tests now

9:03 stuartsierra: wow

9:03 chouser: we're not taking advantage of all the features yet

9:03 stuartsierra: How's it going?

9:04 chouser: Had to fiddle around a bit to get :watch working properly

9:04 the .clj files were getting copied into targets, and while lazytest was watching the src ones correctly when it would trigger a reload it would only reload the (still old) ones in target

9:05 stuartsierra: hmm, yeah, that's a problem

9:05 chouser: once I figured out how to ask maven to copy none of our .clj files, that wasn't a problem anymore

9:05 not sure if there will be negative consequences later for not copying the .clj files, but it's fine for now.

9:06 stuartsierra: As usual, the problems come down to managing the classpath.

9:06 chouser: not much else to say, which is good -- it pretty much just works.

9:07 stuartsierra: great!

9:07 Are you using the "describe/it" style or the "deftest" style?

9:07 chouser: I know so little about maven and hudson still -- some of our other projects in hudson have a nice graph of unit test passes over time. ...anything like that for lazytest?

9:07 we're using describe/it

9:08 stuartsierra: Re graphing, Hudson is probably using the XML output of JUnit or some other standard Java testing lib.

9:10 I haven't implemented any other output formats, but the reporting is designed to be pluggable.

9:10 chouser: ok

9:18 stuartsierra: Re describe/it, are you using "it" or "do-it" most of the time?

9:19 chouser: we're using 'it', but I don't think we've weighed the options.

9:19 * chouser looks up do-it

9:20 stuartsierra: I'm asking because the difference has been confusing for some people. I'm considering making "it" work like "do-it", more RSpec-like.

9:21 chouser: I have no testing habits or baggage that I'm bringing to this process

9:21 stuartsierra: ok

9:21 chouser: nor do the others on my team, afaict.

9:21 stuartsierra: Is the requirement that "it" contain just one single expression ever a problem?

9:21 chouser: we've all written tests before, and see some pragmatic value in having them, mainly to prevent regression I think.

9:21 but no zealots here

9:23 hm... maybe. several of our 'it' clauses are wrapped in the same 2 or 3 macro calls just to get the mocking environment right

9:23 if we used do-it, could we do that once and replace the several 'it's with several 'expect's?

9:23 stuartsierra: Yes, and the test would halt on the first failure.

9:24 "it" expands to (do-it "docstring" (expect …))

9:24 chouser: ah

9:24 no docstring on expect though?

9:25 stuartsierra: docstrings on "expect" are optional

9:25 "it" or "do-it" creates a function.

9:25 chouser: does the expect docstring show up in the success/failure report?

9:25 stuartsierra: "expect" is a fancy version of "assert"

9:26 I don't actually remember. It's available, but probably not included by default.

9:26 chouser: hm

9:27 mister_roboto: Sorry... jumping in the middle but is someone making a change to have maven plugin avoid copying clj files to target?

9:28 stuartsierra: mister_roboto: no

9:28 chouser: I think I probably prefer what we've got now, then.

9:29 mister_roboto: you can tell it to do that now.

9:29 stuartsierra: chouser: ok, good to know

9:29 chouser: mister_roboto: in your plugin configuration tag, add: <copiedNamespaces><namespace>!*</namespace></copiedNamespaces> <copyDeclaredNamespaceOnly>true</copyDeclaredNamespaceOnly>

9:30 mister_roboto: Ok thought it was gonna be a default or something

9:30 chouser: but like I said, I don't know what the implications are for that when it comes time to build and distribute jars

9:30 stuartsierra: for applications, probably not a problem.

9:31 For distributing libraries, it's a disaster, as widely reported already.

9:31 chouser: not copying to targets implies not including in the jar?

9:31 stuartsierra: I expect so.

9:32 chouser: that suggests to me that I'd like something like lazytest:watch to be copying the appropriate .clj files (as well as some resources?) from src to targets when it sees they've changed.

9:32 a sort of fast "live" build

9:33 stuartsierra: This is a deeper problem with Maven & Clojure that I've encountered before.

9:33 chouser: but my instincts around how maven should behave seem to be often wrong, at least according to those who know maven better.

9:33 (hi cemerick!)

9:34 stuartsierra: Maven is designed around a static compilation workflow.

9:34 Adapting it for interactive development is awkward.

9:34 Especially around copying files/resources.

9:36 Ideally, the classpath for interactive development should contain src/*/clojure, src/*/resources and dependent libraries.

9:36 It should not contain anything in target/ unless you need compiled classes for Java interop.

9:36 chouser: hm

9:36 seems like it pretty much needs both

9:37 but that the src paths should override the targets ones

9:37 stuartsierra: That's almost impossible given how classpaths work.

9:37 chouser: we have not only compiled .java, but also *generated* and then compiled .java.

9:38 stuartsierra: Yeah, so it's hard to get right.

9:38 I don't have a good solution for this yet.

9:41 AWizzArd: How would a without-reflection-warnings macro look like?

9:41 To me it seems set! won't work when inside a let or with-local-vars form.

9:41 And `(binding [*warn-on-reflection* false] ~@body) also doesn't seem to do the trick.

9:42 I would like to turn *warn-on-refletion* of, execute a body and then have *warn-on-reflection* get restored to whatever it was set to before.

9:43 chouser: AWizzArd: it's because *warn-on-reflection* is examined by the compiler at compile time

9:43 stuartsierra: yes

9:43 chouser: so the binding is happening too late

9:43 AWizzArd: (defmacro without-reflection-warnings [& body] `(do (set! *warn-on-reflection* false) ~@body (set! *warn-on-reflection* true))) works great, but this will always turn it on.

9:44 chouser: you might be able to do something like `(do (set! *warn...* false) ~@body)

9:44 AWizzArd: but as soon the do goes away and gets replaced by a (let [wor *warn-on-reflection*] ...) it won't work anymore.

9:44 chouser: yes

9:44 AWizzArd: chouser: yes, that would work, but leave *wor* set to false.

9:45 So, there is currently no trick to do this?

9:45 chouser: at the top level `do` is special, each interior form is compiled and run separately

9:45 AWizzArd: I have a macro that expands into a defrecord and into a defn.

9:45 The defrecord triggers a reflection warning for the .contains call.

9:46 So I wanted: (do *wor-off* (defrecord) *restore-wor* (defn))

9:46 The *restore-wor* part is that won't work.

9:47 chouser: AWizzArd: perhaps `(do (set! *old-wor* *wor*) (set! *wor* false) (let [v# (do ~@body)] (set! *wor* true) v#))

9:48 AWizzArd: chouser: I guess (set! *wor* true) was supposed to be (set! *wor* *old-wor*)

9:49 chouser: er, right

9:49 AWizzArd: And how can I introduce root-bindings such as *old-wor*, which are set!able?

9:50 chouser: oh

9:50 can't

9:50 AWizzArd: Otherwise this would have worked.

9:50 chouser: just use def

9:50 (def old-wor *wor*)

9:50 AWizzArd: Hmm yes, also fine.

9:51 chouser: yes, this def trick works. I can just make it a private var of my NS.

9:51 Good idea :)

9:54 stuartsierra: You can even gensym the name to avoid any possibility of clashes.

9:58 AWizzArd: stuartsierra: and then ns-unmap it :)

10:01 stuartsierra: yes

10:08 AWizzArd: Compojure users here? Am I able to stop Compojure or Ring from doing the full reply? Currently I can return an object and a Map is built from it. Number=>Status, String=>Body, Map=>can set headers, etc. What I would like to do is to stream the response.

10:09 I am doing a sql query and get, say, 20k results. Currently I need to do one (pr-str results) and return this as my full response body.

10:10 Instead I would like to stream results. So I would in principle need the output stream that Jetty will use after the status code and headers where sent.

10:10 That way my handler needs to fire the header and not return, but instead loop through the results and write them into the stream.

10:15 stuartsierra: cemerick: Where do we stand with contrib Maven builds?

10:43 AWizzArd: Is it possible to specify the return values of protocol fns?

10:43 The type of the return values that is.

10:48 stuartsierra: I believe they can be hinted

10:48 ^SomeClass on the arg vector, if I recall

10:49 AWizzArd: I will give it a try.

12:24 auser: is it possible to write custom java and load it from within a clojure project?

12:24 AWizzArd: Yes.

12:24 auser: I wonder if leningen will compile it... that is prolly more important to find out

12:24 AWizzArd: Any custom Java code that you write (that is, all classes you implement yourself) can be used. Just compile them and put them into the cp.

12:24 auser: hm.

12:25 ah

12:26 well... actually, really what I'd like to do is mimic the 3rd line here: http://hazelcast.com/documentation.jsp#ClusterInterface (new MembershipListener()...)

12:27 (new to clojure, not to functional programming, though). I'm kind of stumped on how to do that...

12:28 mrBliss: auser: http://clojuredocs.org/clojure_core/clojure.core/proxy

12:28 auser: well... that'll help

12:28 thanks mrBliss

12:29 mrBliss: np

12:40 * auser worked perfectly mrBliss

12:40 auser: thanks!

12:41 mrBliss: auser: my pleasure

12:42 ohpauleez: Raynes: merged in, thanks man

12:42 You might want to make a new drop on clojars

13:03 bortreb: I'm playing around with the compile function, and it works the first time I compile, but not the second

13:03 (after I delete the compiled files the first time)

13:03 is there a way to make it always output files?

13:09 amalloy: bortreb: restart your repl, or modify the clojure files

13:10 bortreb: there's no way to do it without restarting the repl?

13:10 amalloy: (compile 'foo) loads the bytecode into memory, as well as writing .class files. if the bytecode is already in memory, i think it just uses that

13:10 bortreb: maybe with binding or something?

13:10 is there an unload?

13:12 amalloy: not really my area of expertise, i'm afraid

13:12 bortreb: why do you need it to happen?

13:14 bortreb: well, I'm trying to use clojure with the java code at work, and so I'm including everything as a jar file in the svn repo so that others can just call the clojure I write like any other java thing

13:14 I don't want to use lein, because I want to keep track of dependencies myself

13:14 amalloy: hrm

13:15 KirinDave: That sounds like a lot of not-fun. :)

13:15 bortreb: so I want a function that compiles all the namespaces I care about and puts them in a jar file

13:15 amalloy: bortreb: that function is called lein :)

13:16 bortreb: but we use a lot of jars as dependencies that don't exist in any public repos and setting up hudson is beyond my capabalities

13:16 amalloy: if you have dependencies lein can't manage automatically, you should still be able to install them to your local repo

13:17 bortreb: what about other clojure projects that I'm developing as well and other java code that is just randomly lying around ?

13:18 I can get a repl with everything loaded correctly

13:18 amalloy: bortreb: so write a shell script that loads that repl, writes (compile 'blah), and exits

13:19 i think trying to change code post-repl-launch in an environment as delicate as yours is asking for trouble even if there were a way to recompile

13:21 bortreb: that would certainly work and is a great fallback, but I was hoping for a clojure function that I could call from the repl that would just package everything I'm working on and send it off in a jar to the rest of the project

13:22 gtrak: at run-time it doesn't exist as a jar?

13:22 bortreb: maybe I'm doing it wrong....

13:23 I've never really found a clear explanation of how to integrate clojure code into an existing java codebase

13:24 we have a pretty standard collection of java code in an SVN that everyone checks out into eclipse

13:26 all our dependencies are part of the svn repo, because they're random NLP programs, custom jars made by other projects, etc, and we want to managed dependencies manually so that new people can checkout something that just works

13:27 that system works really well for us and has saved many headaches

13:27 so now, I want to come in with clojure and write some cool things --- I figured that I could include clojure and clojure-cotrib with the other jars

13:28 and then compile my namespaces into one more jar which is all of the actual code I write in clojure, AOT compiled

13:29 then, I'd also include the clojure source right along with the other java files in the corresponding packages

13:30 people would be able to see the clojure code in its proper place in eclipse and use the code, but they wouldn't be able to change it by changing the source files

13:30 is that reasonable?

13:30 please help a newbie :)

13:39 did I scare everyone away?

13:39 * gtrak still hides

13:41 bortreb: I really do want to know the right way to do this

13:41 any advice?

13:41 gtrak: I'm not an expert on this stuff, but i think you can package up the clojure jar with lein jar or lein uberjar

13:42 maybe you can keep the clojure source off by itself and just bring in the jar as a dependency

13:43 bortreb: I was thinking about that, but the code isn't a separate idea from our main java code base

13:44 amalloy: bortreb: no offense, but the right way to do it is to let build tools manage your build and your dependencies. "do everything in the repl" won't scale very well if clojure gains any momentum at your company

13:45 failing that, launching a new repl doens't seem like an onerous requirement

13:49 bortreb: none taken -- thanks for your help! but how can I use leinengen and still write code that uses all our dependencies as well as the java code in the project itself?

13:51 I guess, how would you go about taking something like an apache commons library or your other favorite java library and rewriting one function in clojure?

13:52 cemerick: chouser, stuartsierra: I was paged? :-)

13:53 stuartsierra: cemerick: check out latest http://dev.clojure.org/display/design/Common+Contrib+Build

13:53 cemerick: Yeah, I just saw the diff

13:54 stuartsierra: core lang releases are ready to patch

13:54 We need to hash out what's left in contrib releases

13:55 amalloy: bortreb: rewriting one function is harder than a whole class. but i think you could write clojure function to do what you need, compile it into a class/jar, and rewrite the java source of that method to delegate to the new AOT clojure function/class

13:55 cemerick: stuartsierra: Yes; I have two last items to work on re: the release cycle, but that's small potatoes.

13:56 gtrak: bortreb, or write to interfaces and create a new implementation class that calls the clojure functions

13:56 stuartsierra: cemerick: what are they

13:58 cemerick: (a) verifying the semantics of the nexus goals (i.e. if they're smart enough to not touch staging repos unassociated with the coordinates of the project for which one is looking to close/promote)

13:58 (I mentioned that a while ago)

13:58 stuartsierra: yes

13:58 cemerick: (b) looking around for some kind of sane way to manage N probably-nearly-identical contrib hudson job configs

13:59 stuartsierra: ah yes

13:59 cemerick: so, (b)'s not release cycle related, but it's on my list anyway

13:59 stuartsierra: I assumed (b) had no good answer

14:00 cemerick: I'm going to sniff around a few other large users of hudson, see what they do.

14:00 #jboss will be the first stop. Legend has it they have the largest-known hudson cluster.

14:01 stuartsierra: good idea

14:01 cemerick: They're surely not messing around with the administrative interface on a regular basis

14:01 stuartsierra: Second question...

14:02 bortreb: amallory: indeed --- but _how_ do you actually go about the compiling into a class/jar part when your clojure code depends on interfaces defined in the java part of the project? if you're using lein, how do you tell about those interfaces?

14:03 stuartsierra: If we go with Clojure language *not* inheriting from a parent POM, is there any value in separating oss-deploy/baseline/contrib POMs?

14:09 dnolen: Lack of TCO - 0, Lazy Sequences 1

14:10 gtrak: bortreb: it all gets easier if you have a build system, you could make the interfaces their own module, some packages do that, for instance there's a jaxb-api and jaxb-impl you can download

14:15 that way there's no circular dependency

14:20 jweiss: what's the difference between binding and with-bindings ?

14:22 bortreb: Thanks for your help everyone

14:23 I'll ponder this for a while

14:23 stuartsierra: jweiss: with-bindings is a lower-level function

14:23 takes a map of Var => value

14:31 cemerick: stuartsierra: sorry, got multiple things brewing at the moment. Will you be around later this afternoon?

14:33 stuartsierra: yes

14:33 'till 5

14:34 cemerick: stuartsierra: OK -- poke me by 4 if I haven't gotten back to you

14:35 stuartsierra: sure

14:40 jcromartie: when I run "lein deps" on one machine, I get: "java.lang.NoClassDefFoundError: and"

14:40 Could not find the main class: and. Program will exit.

15:08 dnolen: interesting the compiler doesn't automatically convert self calls in the tail position to recur.

15:09 chouser: like scala does

15:09 stuartsierra: ooh, fightin' words :)

15:10 chouser: http://clojure-log.n01se.net/date/2010-12-13.html#19:51

15:13 dnolen: and does recur work on protocol fns?

15:13 chouser: hm, without testing I would guess that it recurs without re-dispatching, like it does on multimethods

15:16 dnolen: chouser: hmm, recur doesn't like the 'this' argument. so really ... it doesn't work.

15:17 chouser: hm, what if you leave of the 'this'?

15:17 dnolen: bad stuff happens in my code anyway. but yeah, doesn't prove anything.

15:18 chouser: now that I say that, I remember recur being a consideration in the design, or at least the syntax, of protocols

15:22 stuartsierra: I meant to mention before, I'm getting this: [WARNING] Attempting to build MavenProject instance for Artifact (com.stuartsierra:lazytest-maven-plugin:1.0.1-20101213.125247-3) of type: maven-plugin; constructing POM artifact instead.

15:22 Doesn't cause any problem that I'm aware of, just thought you might be interested.

15:22 stuartsierra: hmm

15:24 no idea

15:24 probably a Maven plugin API thing

15:24 What Maven version are you using?

15:25 chouser: 2.0.9 because that's apparently what hudson supports

15:25 stuartsierra: Ah, I compiled the plugin against 2.2.1

15:25 chouser: oh, ok.

15:25 stuartsierra: maybe I can drop it back to 2.0

15:25 chouser: no big deal

15:26 stuartsierra: back in a few

15:40 dnolen: huh, guess I should seen this long ago, but continuations seem great for error handling ...

15:42 so I guess clojure.contrib.condition doesn't require gen-class anymore now that we have deftype ?

15:44 stuartsierra: deftype cannot extend concrete classes

15:45 dnolen: stuartsierra: yeah I had forgotten about that.

15:58 bhenry1: ah mega brain fart. i can't think of the term for extracting parts out of arguments like {:keys [something something-else]} some-map

15:59 mrBliss: bhenry1: do you mean destructuring?

15:59 bhenry1: YES

15:59 thank you

16:27 cemerick: stuartsierra: no, a monolithic contrib POM would be fine in that case

16:27 which we could refactor back into a split if/when core clojure stops using its own local config

16:31 stuartsierra: that was my thought

16:32 Perpetrated on a branch: https://github.com/clojure/build.poms/tree/contrib-pom-only

16:34 cemerick: stuartsierra: Q: if c-m-p is no-go in core clojure, why is it OK in contrib?

16:35 stuartsierra: b/c Rich doesn't care

16:35 or, I should say, the standards for contrib are lower

16:35 But I haven't really confirmed that as such.

16:35 cemerick: The "unsanitized" response is *way* better IMO. :-)

16:36 I'm happy to not open that can of worms in that case.

16:36 stuartsierra: we've been using it on clojure-contrib for months anyway

16:37 cemerick: good point

16:38 Which then makes the decision to not use it in core even more confusing to me.

16:38 stuartsierra: Mostly, because core doesn't compile well with it.

16:38 cemerick: because of the odd load order issue?

16:38 stuartsierra: yes

16:39 cemerick: Was there any theory about that in your discussions?

16:40 stuartsierra: not really

16:40 I have some ideas, haven't had time to test them out

16:41 But the whole discussion got me thinking about c-m-p in general.

16:43 http://dev.clojure.org/display/design/Clojure+Maven+Plugin

16:43 cemerick: stuartsierra: re: 322: are you saying that the compile-interop-forms name is nebulous, or something more?

16:44 stuartsierra: more

16:44 I'm asking if it is possible, generally, to determine what an interop form *is*

16:45 Maybe it is, in which case great, I'm just not sure.

16:45 cemerick: Anything that emits a classfile based on the value of *compile-interop-forms*? :-P

16:46 stuartsierra: wel...

16:47 * cemerick is saying that tongue-in-cheek, of course

16:47 stuartsierra: Basically, is there a situation where compile-interop-forms would get you into trouble the same way transitive AOT does now?

16:47 For example, deftype with in-line method definitions

16:48 cemerick: Right; well, if you're looking to do named-class-interop, then that trouble is necessary / a benefit.

16:49 Actually, do inline method defs have AOT problems? They're not entangled with (potentially) changing Clojure interfaces, etc.

16:49 stuartsierra: are you sure about that?

16:50 cemerick: No, just hypothesizing.

16:50 * cemerick goes to javap a deftype class

17:00 rata_: hi

17:26 joshua__: How can I get the size in kilobytes of a string?

17:29 stuartsierra: depends on the encoding

17:29 (/ (count (.getBytes "the string" "UTF-8")) 1024)

17:30 joshua__: Thank you so much that puts me on the right track at least.

17:30 stuartsierra: 'welcome

17:32 laurus: Will there ever be a version of Clojure that is not on JVM/.NET?

17:33 amalloy: hm. i want to do something like (with-in-str "1 2 3" (repeatedly read)), but laziness causes the read to actually occur outside the with-in-str context

17:34 joshua__: &(doc with-in-str)

17:34 sexpbot: ⟹ "Macro ([s & body]); Evaluates body in a context in which *in* is bound to a fresh StringReader initialized with the string s."

17:35 tonyl: laurus: where you thinking of some platform in specific?

17:35 laurus: tonyl, C :P

17:36 tonyl: The idea of clojure is going for the VMs I don't think language ports go with it

17:36 amalloy: chouser: you're the one i usually bother when laziness gets confusing

17:36 laurus: tonyl, yeah... I know. I wish they would have a C implementation though.

17:36 amalloy: laurus: why?

17:37 laurus: amalloy, both of those VMs are corporate

17:37 Raynes: amalloy: So that there wouldn't be any libraries, of course!

17:37 tonyl: there is open versions of the jvm

17:37 laurus: Raynes, one reason I stopped being interested in Clojure is the fact that you constantly have to use Java libraries...

17:37 amalloy: in order to do all the magic stuff clojure does, you'd have to reimplement most of java and c# in c anyway

17:37 tonyl: *are

17:38 Raynes: laurus: You don't have to use any Java libraries if you don't want to. It's kind of silly not to when you have them at your disposal though.

17:38 joshua__: larus: maybe a java to c compiler exists?

17:38 amalloy: laurus: that's a feature, not a bug

17:38 Raynes: But, if you like reinventing the wheel, you can certainly do that! :>

17:38 laurus: It's okay, I'm just not that into the Java infrastructure, is all

17:39 Anyway, it was just a question. I thought the "Clojure-in-Clojure" work might lead to the direction of something like a "C-Clojure".

17:40 Raynes: It could happen one day. Don't expect it any time soon.

17:40 tonyl: the idea of platform independent does makes my eyes shine

17:40 s/makes/make/

17:40 sexpbot: <tonyl> the idea of platform independent does make my eyes shine

17:40 laurus: Raynes, I won't, but thanks for your input!

17:41 tonyl, it would make Clojure useable for small scripts, etc.

17:41 Raynes: Clojure in Clojure is more of a backseat thing at this point. Some 1.2 features that were added had Clojure in Clojure in mind, but it is not the priority or goal at this point in time.

17:41 laurus: Raynes, ah, ok

17:41 Raynes: cake does that!

17:42 laurus: Yes I knew someone would say that :p

17:42 amalloy: chouser: never mind. if i stick a doall in at the right place, it works, which i guess is reasonable

17:42 Raynes: I'm not saying persistent JVMs are the 'solution' or that they solve the problem. They are, of course, a band-aid. Does the trick for my purposes though.

17:43 laurus: Raynes, that's cool... I just wish there was a C implementation of Clojure is all, but I understand it's not a priority for the project

17:44 Raynes: I'd be interested in a Parrot implementation.

17:45 laurus: Honestly I wish there would be a Guile implementation, but that's probably wishful thinking :P

17:45 Raynes: Everybody seems to want a JavaScript implementation

17:45 laurus: Hmm...

17:50 tonyl: or Erlang

17:50 the VM

17:51 laurus: tonyl, the thing that is so cool about the Guile VM is it is basically the Scheme programming language

17:51 So it would be pretty neat for Clojure, IMO

18:16 dnolen: Logos 0.2 aka Life w/o Tail Call Optimization, http://dosync.posterous.com/life-without-tail-call-optimization

18:36 KirinDave: Hum

18:36 Stuart's article on ibm.com is good

18:37 but I still don't get how protocols don't encourage massive code duplication without being explicitly merged in maps

18:38 dnolen: KirinDave: also macros, I've been using macros to when I need to extend types to the same protocol with identical implementations.

18:38 KirinDave: dnolen: Yeah, I haven't published it yet but I have this thing that lets you define a static and dynamic default behavior in unison.

18:39 dnolen: So you can do sensible defaults.

19:38 bortreb: what's the best way to do file-system operations with clojure like delete a directory tree, copy files, etc? I'm seeing the jakarta commons io as being pretty good, but was wondering if there is something better>

19:40 amalloy: clojure.java.io might be good; i don't know it very well

19:40 Raynes: clojure.java.io doesn't have operations for a lot of stuff like that. Rather, you'd want to check out the java.io.File API.

19:40 http://download.oracle.com/javase/6/docs/api/java/io/File.html

19:41 In this case, you'd be looking for the 'delete' method. (.delete (File. "/path/to/some/directory/"))

19:41 bortreb: File alone doesn't have too much either... you can't recurvisely delete a folder for example

19:41 Raynes: There is also a function for creating File objects in clojure.java.io

19:42 bortreb: I feel your pain. commons-io has a lot of useful stuff.

19:42 bortreb: is that the "standard" way to get the functionality that's not in File?

19:43 just use jakarta.commons.io?

19:43 Raynes: http://commons.apache.org/io/apidocs/

19:43 http://commons.apache.org/io/

19:44 auser: How about this Raynes? http://commons.apache.org/vfs/

19:44 Raynes: I've only ever used commons-io.

19:49 bortreb: cool, thanks Raynes, auser

20:57 jk_: ls

Logging service provided by n01se.net