#clojure log - Apr 15 2010

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

0:37 MrEvil: I was wondering if their is a construct somewhere in clojure similar async {} in F#. An easy way to spawn a bunch of asynchronus concurrent tasks whoes results get returned in a collection.

0:42 hiredman: ,(doc pvalues)

0:42 clojurebot: "([& exprs]); Returns a lazy sequence of the values of the exprs, which are evaluated in parallel"

0:42 MrEvil: ooh thankyou

0:57 Scriptor: is anyone going to the clojure meetup in nyc tomorrow?

0:57 vIkSiT: hmm, so I got lein-swank installed; i can load the file in and sent it to the REPL - but for some reason, the file only compiles - don't see any output.

0:57 Is there something after Cc Ck I should be using in emacs?

0:57 technomancy: vIkSiT: it might be in the *inferior-lisp* buffer

0:57 generally you shouldn't get output at compile-time though

0:57 I mean, unless you're just experimenting

0:58 vIkSiT: technomancy, ah. so yes, in this case, I was basically following one of your posts and getting an uberjar built, and invoking java -jar uberjar.jar

0:58 now I'm trying to get the program to run through swank.

0:59 so I guess, previously, I would just Mx slime, open up a new clj file, and use Cc Ck to send it to the REPL

0:59 I was wondering how I'd see the output of this -main function the same way?

1:01 technomancy: just run (-main) from that ns if I'm understanding you correctly

1:02 vIkSiT: oh I See. all I had to do was go to the REPL, change (ns test1), and then everytime I run Cc Ck - I can see the output!

1:06 technomancy: not sure I follow, but if it's working that's great! =)

1:13 lancepantz: technomancy: is there a way i can set jvm options for lein tasks?

1:14 vIkSiT: btw, anyone here use aquamacs?

1:15 technomancy, :) [the default ns was user; the program I was trying to run was in ns test1. as a result, I had to shift the ns before I could call (-main)]

1:19 hey Fossi

1:20 Fossi: hi vIkSiT

1:20 hacking some clojure?

1:21 vIkSiT: Fossi, indeed :) are you by any change trying CS with clojure?!

1:21 chance*

1:22 Fossi: nope

1:22 should be working through the java bindings though

1:22 but i guess it's real ugly

1:22 vIkSiT: yes, I guess its going to be hard to wrap around though

1:23 Fossi: i guess it'd be better to embed clojure

1:23 vIkSiT: hmm clojure as a scripting language.

1:48 MrEvil: Expressions like the following always give me the error regaurding recur not in the tail position due to the presence of the (def) in the else clause of the first if. I was wondering if there is something that I should be doing but am not.

1:48 (defn __findIntegerTriaglesWithIntRatio [p a bseq output]

1:48 (if (empty? bseq)

1:48 output

1:48 ((def a (findArea p a (first bseq)))

1:48 (if (integerRatio? a p)

1:48 (recur p a (rest bseq) (conj output a))

1:48 (recur p a (rest bseq) output)))))

1:49 arbscht: MrEvil: use paste.lisp.org or gist.github.com or something :)

1:50 MrEvil: http://gist.github.com/366723

1:50 thanks for taking a look

1:50 it's the presence of line 4 that always gives me trouble

1:50 arbscht: MrEvil: use def at the top level for var declarations, not inside functions

1:51 MrEvil: but what if the call is only neccessary in an else clause of the if statement do i just have to trust that the JVM will optimize it away?

1:51 arbscht: MrEvil: your function would be better written in a high-level functional style. probably no need to use recur

1:52 MrEvil: i was optimizing my solution for euler #283, getting rid of some of the multiple passes

1:53 my first solution only used map and filter but i was iterating through the collection multiple times

1:56 am i misunderstanding the purpose of def?

1:58 arbscht: I think so. def is for global vars. I guess you want 'let', for local bindings

1:58 MrEvil: ok that's just what i was going to ask

1:58 thanks

1:59 that clears things up

2:30 LauJensen: Morning team

2:32 polypus: you didn't sleep long Lau

2:32 LauJensen: hmm, I think I got at least 6 good hours :)

2:32 polypus: time flies when you're clojuring i guess

2:33 LauJensen: True

2:34 polypus: anyways time for me to hit the sack :)

2:34 LauJensen: Nighty night

3:29 Heads up: I've pushed a non AOT compiled version of ClojureQL to Clojars, should work with all versions now 1.0+

4:27 AWizzArd: LauJensen: is the non-aot version the only one, or do you want to offer that one plus a 1.2aot’ed one?

4:28 LauJensen: AWizzArd: Clojuresque 1.0.0 defaulted to AOT compilation, which was why I was pushing AOTed jars, it was a mistake. So switching to Clojuresque 1.3.0 fixed that bug :)

4:28 AWizzArd: k

6:07 vegai: COJ defines this: (def AND #(and %1 %2))

6:08 what's the point? Aren't 'AND' and 'and' equivalent?

6:08 it's used like so: (def rank (zipmap [- + * / AND =] (iterate inc 1)))

6:09 ahh, I should put these in the repl before I ask :)

6:09 user=> (def rank2 (zipmap [- + * / and =] (iterate inc 1)))

6:09 java.lang.Exception: Can't take value of a macro: #'clojure.core/and (NO_SOURCE_FILE:10)

6:09 so 'and' is a macro

6:10 by the way, doc is a great idea. Whoever figured that it should be in there deserves a reward

6:12 Chousuke: runtime access to documentation is an old idea :)

6:13 vegai: Chousuke: yes, but mindboggingly, new languages/platforms are still being created without it

6:13 hmm

6:13 the doc for iterate says that f must be free of side-effects

6:13 but there are no checks on this

6:14 I can do (defn a [] (println "1")) (iterate a 1)

6:14 Chousuke: it's not possible to check for side-effects

6:14 vegai: what's the consequence of having side-effects in a fun that's called from iterate?

6:14 Chousuke: well it'll just work in a very weird way

6:15 since iterate creates a sequence

6:16 ,(take 5 (iterate (fn [x] (print "f: " x) (inc x)) 1)))

6:16 clojurebot: (1 2 3 4 5)

6:16 vegai: yeah...

6:16 Chousuke: hmm, where did the print output go? :(

6:16 vegai: I come from a bit of haskell background, so I take "must be free of side-effects" rather seriously

6:17 Chousuke: well, haskell has a type system that can help you differentiate between side-effecting functions and "really pure" functions

6:17 but Clojure doesn't, so you're just expected to do the right thing.

6:18 vegai: functions can have metadata, right?

6:18 Chousuke: as of 1.2, yes.

6:18 (which is still unreleased)

6:18 vegai: couldn't there be a :pure for instance?

6:18 SynrG: in programming clojure in examples/taslklist.clj i don't understand where 'parser' comes from

6:19 Chousuke: technically yes, but I don't think that's feasible :/

6:19 vegai: could it be so that a missing :pure from a function definition infects all the functions that call that function?

6:19 AWizzArd: vegai: yes, I suggested something similar also in the past.

6:19 Chousuke: vegai: dynamic binding could break that easily

6:19 AWizzArd: In principle Clojure can do more type checking in the future, optionally.

6:20 Chousuke: AWizzArd: if someone writes the type system, yes. :P

6:20 vegai: yeah... just a random thought.

6:20 AWizzArd: Right, a good bit of work will be required, but it can be an optional type system.

6:21 Chousuke: but I think the general sentiment is that any static type checking must remain completely optional and degrade gracefully when combined with "fully dynamic" code.

6:21 AWizzArd: Could be even on top of FindBugs.

6:21 Chousuke: yes, 100% optional.

6:22 Chousuke: It's definitely not a simple problem to solve, but still an interesting one

6:24 AWizzArd: I may remember to look at this posting: http://groups.google.com/group/clojure/browse_frm/thread/7a48f48e4b197a15/9538dbdb1549f1c6

6:24 Chousuke: yes, difficult, but could be very useful

6:24 Chousuke: sure

6:24 AWizzArd: Good morning rhickey. Thanks for updating Master to include defrecord :-)

6:25 rhickey: AWizzArd: you're welcome, some rough edges still to work out today I'm sure

6:28 AWizzArd: What I found so far is that a (.readObject ois) on a (defrecord Foo [a b c] java.io.Serializable) throws java.lang.ClassNotFoundException

6:32 Code was basically: (do (defrecord Foo [a b c] java.io.Serializable) (def fos (java.io.FileOutputStream. "/file.ser")) (def oos (java.io.ObjectOutputStream. fos)) (.writeObject oos (Foo. 1 2 3)) (.close oos) (def fis (java.io.FileInputStream. "c:/file.ser")) (def ois (java.io.ObjectInputStream. fis)) (.readObject ois))

6:35 rhickey: AWizzArd: if you are trying to do dynamic serialization, that won't work as I said yesterday, only with AOT

6:36 that won't work, as I said yesterday

6:36 AWizzArd: Ok, I will retry it later again with an AOTed version.

6:41 vegai: recur confuses the hell out of me

6:42 AWizzArd: vegai: just think of normal tail recursion

6:42 where you would place the name of the function that you recursively want to call, just put recur in.

6:42 vegai: the example here, http://clojure.org/special_forms#recur

6:43 AWizzArd: yes, imagine the example as you would write it now, without using recur

6:43 vegai: does the recur go back to the loop there?

6:43 AWizzArd: it would look identical, only replace "recur" with "factorial"

6:43 If you understand that function then, then you understand recur :)-

6:44 vegai: oh, that's it?

6:44 AWizzArd: recur returns to the innermost loop or function

6:44 vegai: there's an example in COJ that uses in the same function both recur and the function's name

6:44 like so

6:44 AWizzArd: (loop1 (loop2 (loop3 ... (recur -> goes to loop3))))

6:44 vegai: (defn infix* [[a b & [c d e & more]]]

6:44 (cond

6:45 (vector? a) (recur (list* (infix* a) b c d e more))

6:45 ...

6:45 see that? there's both a call to recur and infix*

6:46 granted, it does say below the example that I shouldn't perhaps try to understand this yet :)

6:47 Chousuke: recur is not really different from ordinary recursion; it's just limited to tail recursion so it can be optimised

6:48 a function can call itself as many times as it needs, and in that example one recursive call is tail-recursive so it can be done with recur, and the other is not so there is a call to the function

6:48 vegai: ah, it's for the tco?

6:48 I was a bit confused about the documentation of recur

6:48 Chousuke: yeah

6:49 recur exists because the JVM doesn't guarantee TCO

6:49 vegai: it says "There is no tail-call optimization" but I misinterpreted the context of that

6:49 I thought it was saying that recur doesn't have a tco

6:49 Chousuke: though recur has other benefits too; it actually checks if the call is in tail position

6:49 vegai: yes, that's nice

6:51 Chousuke: I think there is no reason to do away with recur even if the JVM someday will guarantee TCO :)

6:52 I would also be in favour of a recur-at special form if it were possible to implement one to efficiently support mutual recursion.

7:02 SynrG: let's try again, since conversation has settled down (and without typos :) in Programming Clojure, i understand all of this example *except* where 'parse' comes from (on line 16): http://github.com/stuarthalloway/programming-clojure/blob/master/examples/tasklist.clj

7:02 anyone?

7:02 vegai: yeah, it's not a bad idea generally. Has the potential of making recursive code somewhat clearer too

7:04 Chousuke: SynrG: it is a method of the SAXParser class

7:04 SynrG: note the .. form

7:04 SynrG: oh, that's included in '..'! doh. i thought i got all of those

7:05 Chousuke: This is the main reason I prefer (-> foo .bar)... it makes java methods explicit so you won't mistakenly see them as clojure functions

7:06 SynrG: so the file object is coerced to a BufferedReader, passed to an InputSource constructor, which returns an object which is passed to SAXParserFactory.newInstance.newSAXParser.parse

7:06 this java interop stuff is a bit dense

7:07 Chousuke: SAXParserFactory.newInstace().newSAXParser().parse(new InputSource(...))

7:07 SynrG: it took multiple reads through this example to get it all

7:07 Chousuke: (the clojure code actually has fewer parentheses)

7:07 SynrG: and it doesn't help that i am only casually familiar with Java :P

7:08 anyway, thanks. pleased to finally get every line of code

7:09 the book glosses over with "this is boilerplate for ..."

7:11 Chousuke: SynrG: so to reiterate, the code creates a new factory instance by using the newInstance method of Class (not of SAXParserFactory), then calls the newSAXParser() method of that instance which returns the actual parser, and then the parse method of that is called with the InputSource and handler as its arguments.

7:12 at least, I think that's the case :P

7:12 SynrG: ahh. key to understanding this is that ...

7:12 (.. System getProperties (get "os.name"))

7:12 and

7:12 (.. System (getProperties) (get "os.name"))

7:13 are equivalent

7:13 Chousuke: right.

7:13 though you should prefer (-> System .getProperties (.get "os.name"))

7:13 (because I think it's clearer)

7:14 SynrG: java.lang.IllegalArgumentException: No matching field found: getProperties for class java.lang.Class (NO_SOURCE_FILE:0)

7:14 Chousuke: oops

7:15 LauJensen: I think you should go with

7:15 ,(System/getProperty "os.name")

7:15 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission os.name read)

7:15 LauJensen: Much much clearer :)

7:15 Chousuke: I guess it has to be (-> (System/getProperties) (.get ...))in this case :/

7:16 SynrG: LauJensen: well. i was just using (doc ..) to try to understand ..

7:16 Chousuke: which is even better since it's explict about getProperties being a static method

7:16 SynrG: this is an exercise in code reading, not in learning the most concise way to express it :)

7:16 but i will keep this in mind

7:16 Chousuke: and back to what you said above. "... newInstance method of Class (not of SAXParserFactory) ..." how can i tell?

7:17 Chousuke: SynrG: I think in this case I might be wrong actually

7:17 .. seems to have different semantics for static/instance method resolution than rest of clojure. confusing

7:17 SynrG: hmm

7:18 Chousuke: (.foo String) is calling the .foo method of the Class object that represents String

7:18 but (.. String foo) seems to be resolved as a call to a static method of String; ie. String/foo

7:19 Which just reinforces my point. Avoid .. :P

7:20 LauJensen: .. precedes -> by almost a year I think

7:20 SynrG: LauJensen: and thus, not used in the text?

7:21 LauJensen: They are 2 different things entirely, .. is just a helper for ., where -> has much broader application

7:21 So I think you can comfortable take Chousuke's advice

7:22 Chousuke: .. might be more convenient in some cases but I think -> makes things more explicit and is thus better

7:22 * SynrG reads the doc for both

7:22 Chousuke: -> is just a way to transform (-> foo bar whatever) to (whatever (bar foo))

7:23 it's only incidentally that it contains most of ..'s functionality.

7:24 SynrG: the doc lacks examples. but i think i follow

7:24 Chousuke: (-> "foobar" (subs 3) .toUpperCase)); can't do this with ..

7:25 * SynrG nods

7:25 SynrG: Chousuke: minus your extra final paren :)

7:25 LauJensen: SynrG: -> and ->> made the most sense to me, when I just looked at the arguments as lists that got an extra argument. for -> its the second arg to the list, for ->> is the last

7:29 * SynrG plays around a bit

7:29 SynrG: ,(-> "foobar" (subs 3) (str "quux"))

7:29 clojurebot: "barquux"

7:30 SynrG: ,(str (subs "foobar" 3) "quux")

7:30 clojurebot: "barquux"

7:32 SynrG: ,(->> "foobar" (str "baz") (str "quux"))

7:32 clojurebot: "quuxbazfoobar"

7:34 SynrG: ok. makes sense

7:54 AWizzArd: rhickey: so far there is no automatic static Foo/create method right? And also no create-Foo?

7:55 rhickey: AWizzArd: right

7:57 AWizzArd: Are they still planned or will it be (Foo. ...)?

8:09 ~seen ordnungswidrig

8:09 clojurebot: ordnungswidrig was last seen quiting IRC, 28261 minutes ago

8:24 AWizzArd: rhickey: all my use cases were so far (Foo. arg1 ... argn). Didn’t need a create-Foo. Basically it won’t matter if it is Foo. or Foo/create. What are your plans for Foo/create and create-Foo?

8:36 rhickey: AWizzArd: using Foo. spreads the hostiness all over, also can have no associated logic (arg processing etc)

8:45 AWizzArd: ok, so minimum we want is a Foo/create I guess

8:47 although create-Foo would indeed be nicer :)

8:47 * fogus considers changing the title of chapter 9 to JVM: Full of Hostiness

8:48 AWizzArd: ^^

8:48 cemerick: AWizzArd: what's wrong with (Foo ...)?

8:50 liwp: hostiness is a great term!

8:50 rhickey: cemerick: Foo is the name of a class, will be auto-imported

8:50 sattvik: Would Foo/create possibly conflict with interfaces that declare a create function?

8:51 rhickey: sattvik: not in Java-land, where instance and static methods are distinct

8:53 AWizzArd: cemerick: rhickey explained this has to go away, I think it had to do with name clashes.

8:53 cemerick: today it is: (defrecord Foo [a b]) ... (Foo. 10 20) ==> #:Foo{:a 10, :b 20}

8:54 cemerick: Yeah, I can see the conflict. I quite liked being able to use Foo as a ctor fn.

8:54 AWizzArd: cemerick: maybe we will soon get create-Foo as a replacement :)

8:54 plus defrecords produce stable class names

8:55 cemerick: but serialization still works only for AOTed records.

8:55 rhickey: AWizzArd: how could it otherwise, seriously?

8:55 cemerick: AWizzArd: no other option

8:55 * cemerick will get out of rhickey's way now :-)

8:56 rhickey: cemerick: I am interested in options for the factory fns, I brought it up yesterday

8:56 cemerick: hrm, sorry I missed that

8:56 * AWizzArd does not know enough about serialization and jvm internals to point out another option.

8:57 cemerick: rhickey: you know my distaste for magically-created defs, i.e. create-Foo

8:57 rhickey: no significant input then, so feel free. I'm thinking about enabling static methods in general, thus supporting Foo/create

8:57 cemerick: rhickey: this discussion was yesterday morning?

8:57 rhickey: cemerick: yes

8:57 AWizzArd: cemerick: do you see technical problems there?

8:57 cemerick: AWizzArd: with create-Foo, or similar?

8:58 AWizzArd: yes, with these autodefed functions

8:58 cemerick: no, no technical issues -- I just don't like automagically-created vars. Reminds me of CLOS pain.

8:59 AWizzArd: I think it is comfortable to have them, while it indeed will not be the most beautiful thing. But it still offers several advantages, and as defrecords will be important it is okay to make an exception here.

8:59 cemerick: ...which was fundamentally a failing of mine at the time, but the automatically-created fns didn't help at all.

8:59 AWizzArd: cemerick: clos does not autodef such functions. Those are CLs defstructs

8:59 cemerick: eh, whatever it was

8:59 AWizzArd: and it defines really lots of them

9:00 but create-Foo would be pretty much the only fn getting defined

9:00 not a getter on each field

9:01 CLs defstruct really is going a bit too far with this magic. But just having a constructor sounds okay. Also this could be an option {:contructor-fn-name 'make-foo} *shrugs*

9:01 cemerick: It's a pretty hostile thing, really. The first thing someone who's using defrecord will want to do is create a record, and they've got to go find the docs that explain create-Foo or Foo/create.

9:01 AWizzArd: defaulting to create-Foo

9:02 cemerick: they will have to read about records anyway.

9:02 cemerick: vs. assuming that it works just like defn

9:02 sattvik: rhickey: Do you know if Foo/create would be a problem with other runtimes, namely CLR?

9:02 rhickey: cemerick: they would presume a same-named factory fn? I don't think so

9:02 AWizzArd: plus there can still be a fn (create-record Foo arg1 ... argn)

9:02 This would be the less efficient general factory.

9:03 (map #(create-record Foo %*) (bar)) vs (map create-Foo (bar))

9:03 LauJensen: (clojure in top10 on HN again =))

9:04 liwp: AWizzArd: I was just about to suggest an optional :contructor-fn-name :)

9:04 chouser: once upon a time we came up with consistent syntax for (map Foo/create aseq) that supported arg hinting and everything.

9:04 AWizzArd: mornin chouser

9:05 liwp: yes, to overwrite the default

9:05 cemerick: rhickey: Eh, maybe not, but (Foo ...) was a very natural-feeling thing

9:05 rhickey: chouser: yes, still hosty

9:05 chouser: g'morning.

9:05 rhickey: cemerick: and (Foo. ...) ?

9:05 AWizzArd: I did not find (Foo ...) natural.

9:06 The uppercase F indicated a jvm class

9:06 but where is the "."?

9:06 cemerick: rhickey: I'm fine with that. Foo. is the standard ctor usage, so it's a good fit.

9:06 chouser: yeah. One concrete way to describe the difference between create-Foo and Foo/create is the ability to find the identifiers in the latter based on the name of the datatype

9:06 AWizzArd: Compared with (File. ...) (SomeClass. ...) etc it was strange.

9:07 rhickey: chouser: that's a good point

9:07 AWizzArd: cemerick: but rhickey mentioned above that "using Foo. spreads the hostiness all over, also can have no associated logic (arg processing etc)".

9:07 chouser: maybe this is just a vimism, but I have a keystroke that takes me from an identifier to the next use of that identifier, and I find it very helpful for quickly finding my way through unfamilier code to the part I care about.

9:08 but a strike against create-Foo without a solid alternative doesn't do us much good. We don't want to generatea namespace, right

9:08 rhickey: One thing is that deftype/defrecord *have* changed in creating named types, vs dynamically tagged types. Any kind of wrapper diminishes the power of that somewhat

9:09 cemerick: AWizzArd: yeah, I saw that. I presume rhickey meant "hostiness" in a derogatory way, but insofar as being hosty is around the second thing one learns how to do in clojure, carrying Foo. over to something that has the same semantics is fine by me.

9:09 rhickey: and any generated 'create' might need to be overridden by a type-specific static factory

9:11 AWizzArd: rhickey: btw, also very nice to see that you are still actively working on Cells too *thumbs up*

9:12 * AWizzArd just discovered http://gist.github.com/306174

9:12 rhickey: AWizzArd: just using that cells code to test the changes

9:12 AWizzArd: yes, but this is still an important update, because when I use the changes, then my old cells.clj file wouldn't work anymore.

9:12 rhickey: sattvik: checking CLI spec...

9:14 cemerick: hrm, I'm actually liking Foo. more than the bare Foo ctor fns I've been using. Our generic create form is already there: (new MyRecord ...)

9:18 rhickey: cemerick: except new is not a proper function, nor is Foo.

9:19 sattvik: I think the CLI is fine with it

9:20 cemerick: rhickey: well, I was careful in 1/2 spots to say form instead of fn :-)

9:20 AWizzArd: After a few days of usage create-Foo will look familiar and idiomatic.

9:20 cemerick: compared to Foo/create, create-Foo is just bad. Sorry, AWizzArd

9:21 AWizzArd: Only from an aesthetic pov. Technically it is fine.

9:21 cemerick: rhickey: perhaps then a new-esque fn could be made that would be applicable to records and classes.

9:22 AWizzArd: For basically all my deftypes I made a (defn make-foo ...) anyway.

9:22 rhickey: cemerick: not one whose perf didn't stink

9:22 jlb: Anybody have experience deploying AOT'd compojure/ring servlets? Everything works fine for me if I run in jetty, but I get weird NPE's deploying to a servlet container

9:22 cemerick: jlb: paste the stacks somewhere

9:23 AWizzArd: Often the constructors have to do some clever jobs anyway, and don't want to just fill the fields with some bare values.

9:23 cemerick: rhickey: isn't the same problem in each case? There's a host ctor that needs to be invoked.

9:23 isn't it*

9:23 AWizzArd: Maybe we just need an option {:contructor-name make-foo} ?

9:23 rhickey: cemerick: not way to do that w/o reflection, or if a multimethod, a lookup

9:24 jlb: cemerick: will do, one sec

9:24 sattvik: rhickey: That's good. It doesn't guarantee that Foo/create will not cause any problems when porting clojure to other platforms, but at least the two primary targets would be fine with it.

9:24 rhickey: sattvik: no need to worry about it yet, same args against creating names apply in class scope as in namespaces, really

9:25 cemerick: rhickey: but a reflection-free create fn can be made for records, e.g. (create Foo ...)?

9:25 rhickey: cemerick: still lookup

9:25 AWizzArd: This will still have to look up the class

9:26 Would be nice to have this generic factory too tho

9:26 cemerick: oh, ok. In that case, I fail to see the downside of Foo., given that it reuses all the existing host semantics (appropriately, it seems)

9:26 jlb: cemerick: http://pastebin.com/1jh62sUv

9:27 AWizzArd: Now that I think about my use cases a Foo. or Foo/create would really be enough (for me). I define a make-foo anyway for nearly all cases, which sets internal fields and such.

9:27 jlb: It's largely unhelpful

9:27 rhickey: cemerick: that's where I ended up, and thus that's all there is for now

9:27 AWizzArd: a create-Foo which does nothing different from Foo. or Foo/create would in that case pollute the namespace

9:27 cemerick: rhickey: ah, I thought you were actively preferring Foo/create (or, something in addition to the ctor)

9:29 jlb: I would double-check the container's security policy

9:29 rhickey: cemerick: I am anticipating the need for factory fns, but ones that go beyond a direct mapping to the ctor. My philosophy is, ctors should just set fields, use factory fns if doing arg munging etc, so what's really needed are static methods in deftype. Also good for helpers. Given that, then perhaps defrecrod would auto-define Foo/create factory

9:29 jlb: If I strip everything out and just return strings from the file that extends HttpServlet, that much works

9:30 rhickey: cemerick: for now I'm not going to auto-generate anything and instead work on statics and protocol cleanup to go along with deftype changes

9:30 cemerick: jlb: when you strip everything out, are you removing require and use dependencies?

9:31 rhickey: presumably, one might want multiple factory fns then?

9:31 AWizzArd: rhickey: but what would create-Foo then do if it is auto defined? I mean, what can it do that Foo. can’t?

9:31 rhickey: one problem mwith no standard factory is that print/read won't be able to use a factory, only a ctor

9:31 cemerick: yes

9:31 AWizzArd: I would think the user has to implement create-Foo himself

9:31 jlb: cemerick: yep. I'm going to try fooling with class paths and things in the war lib directory and so on next... however, right now I think everything is in there.

9:32 rhickey: I'd like records to be readable

9:32 jlb: But if that useless error is code for "can't find some dependency" then that's where I'll look first

9:33 cemerick: jlb: I've hit something like this before. I'm guessing one of that namespace's dependencies is throwing an exception in the process of loading, which are unfortunately sometimes swallowed.

9:34 jlb: cemerick: ok, thanks

9:34 sexpbot: Raynes: You have 1 new messages. Type $getmessages to see them.

9:34 cemerick: rhickey: isn't print/read only using ctors OK? I mean, the fields will have already been munged (if necessary), so why would a factory fn ever be relevant at that point?

9:34 rhickey: cemerick: manually-written literals

9:35 cemerick: yikes

9:35 if one can define multiple factory fns, then that seems untenable

9:35 Raynes: I think that mail plugin might be the most useful thing I've ever written.

9:35 rhickey: cemerick: not if they have a known name and can only be overloaded on arity

9:35 Chousuke: Raynes: you should make it send a private message or a notice though

9:36 Raynes: Yeah, because it's just so annoying! ;)

9:39 rhickey: ,(binding [*print-dup* true] (prn (array-map :a 1 :b 2)))

9:39 clojurebot: #=(clojure.lang.PersistentArrayMap/create {:a 1, :b 2})

9:40 rhickey: not a ctor ^^

9:41 AWizzArd: I think print-dup should really output #=(user-defined-record-factory arg1 arg2 ...) to be generally usable.

9:44 For example, I have (defrecord [foo bar #^FileOutputStream fos ...])

9:44 This gets set according to bar, and is not so easily printable.

9:46 Raynes: Chousuke: It notices now. Just for you. <3

9:46 AWizzArd: Or I want to store a ThreadPoolExecutor, etc.

9:47 rhickey: AWizzArd: you'll only ever be able to print/read records containing fields that support print/read

9:48 AWizzArd: When I can provide my own print-dup method then I can have it generate #=(my-make-foo "filename" n-threads)

9:48 Before I read I’ll have to make sure my-make-foo is loaded, and then it can make a fos on filename and setup a TPE.

9:50 that’s application specific long-term serialization then

9:50 Chousuke: isn't it possible to do that already by provide a print-method for the type of the record?

9:51 providing*

9:51 AWizzArd: A default for printable and immutable objects would still be nice though, and portable between all Clojures then.

9:51 Chousuke: yes

9:51 Although.. one problem would be to access the fields of the record.

9:52 no, nevermind

9:54 rhickey: there will only be the functionality of extend-class, not tag-based extend-type, but I'd like to call it extend-type

9:55 AWizzArd: extend-record?

9:56 rhickey: AWizzArd: no, works for deftypes too

9:56 and ordinary classes and interfaces

10:02 cemerick: speaking of java / servlet container security policy, I've blown a bunch of hours on this already; any help would be greatly appreciated. :-) http://stackoverflow.com/questions/2645298/how-to-sanely-configure-security-policy-in-tomcat-6

10:02 sexpbot: How to sanely configure security policy in Tomcat 6 - Stack Overflow

10:06 * Raynes ponders ignoring links whose titles contain most of the words in the title itself.

10:12 cemerick: Raynes: I think you'll end up ignoring all links eventually :-)

10:12 AWizzArd: ns of defn-memo anyone?

10:12 Raynes: cemerick: Not all of them. :>

10:13 AWizzArd: nm :)

10:17 dnolen: ah

10:17 so defrecord is more "primitive" than deftype?

10:17 cemerick: dnolen: vice versa

10:18 AWizzArd: deftype is very lowlevel now

10:18 dnolen: cemerick: ok, looking at the code this seems more like a refactoring right? deftype used to have both deftype/defrecord functionality, now deftype is barebones.

10:19 cemerick: right

10:19 "closer to the metal" rather than "barebones", but sure.

10:21 stuartsierra: so what's up with defrecord?

10:21 I saw the commit

10:22 cemerick: it's alive! :-)

10:22 chouser: it exists. love it, and applyh search/replace to your chapter...

10:22 stuartsierra: yeah...

10:23 So defrecord is like deftype + IPersistentMap

10:23 chouser: yep

10:23 stuartsierra: Does deftype include any default interfaces at all?

10:23 cemerick: minus the mutables that deftype had, and still has

10:23 chouser: ah

10:27 wthidden: Does anyone know where the latest writeup on defrecord is located?

10:27 fogus: On #clojure

10:27 jlb: cemerick: re: your tomcat problem, what happens if you create the file that it is complaining about?

10:28 cemerick: BTW I got my AOT'd servlet working... turns out I was providing *too many* jars in the war lib

10:28 cemerick: jlb: too many jars?

10:29 jlb: I tried that, but it then fails searching for a classfile to load, again on path that doesn't exist. It seems like a general issue.

10:30 jlb: cemerick: right, the container seemed not to like the fact that I was providing implementations of classes it already had. Or something. wiping out WEB-INF/lib did the trick (with my bare bones code devoid of other dependencies)

10:31 cemerick: jlb: which container?

10:31 jlb: cemerick: jboss

10:32 cemerick: jlb: I'd doubt the conclusion of too many jars being the problem. People put some pretty friggin' massive wars and ears into jboss. :-)

10:32 the classloader hierarchy, now that might be something worth looking at

10:33 never worked with jboss myself, but most containers have different modes for arranging their classloaders, which can help to avoid issues like using different versions of classes the container depends upon itself.

10:34 dnolen: hmm

10:34 jlb: cemerick: it's definitely weird, but removing lib did the trick. I had all the apache commons stuff in there, etc. I don't mean too many in the count sense, but in the conflicting implementations sense

10:34 dnolen: so with defrecord I have to use the (my-record. & args) ?

10:34 no more support for (my-record & args)

10:34 ?

10:35 cemerick: jlb: commons-logging? It does some wonky stuff with classloaders. Try removing just that one....

10:35 dnolen: that's the current state, yeah

10:35 likely to persist, if I've interpreted the tea leaves right

10:35 stuartsierra: so instead of defining a constructor function, it imports the class name?

10:36 cemerick: yeah

10:36 stuartsierra: ok. Are datatypes still identified by namespaced keywords?

10:36 cemerick: AFAIK, yes

10:37 dnolen: cemerick: any particular reason?

10:38 cemerick: dnolen: http://clojure-log.n01se.net/date/2010-04-14.html#08:58

10:38 sexpbot: #clojure log - Apr 14 2010

10:39 dnolen: ah, good reason

10:40 cemerick: I actually think it's a very positive change at this point.

10:40 dnolen: so we're waiting for (my-record/create-or-some-other-name & args)

10:41 cemerick: rhickey has plans for factory functions, yeah

10:45 stuartsierra: Last contrib build on build.clojure.org failed. http://build.clojure.org/job/clojure-contrib/lastBuild/console

10:45 sexpbot: clojure-contrib #64 Console [Hudson]

10:46 stuartsierra: I can't reproduce this locally; any ideas?

10:46 dnolen: defrecord question? how do I use the constructor in a different namespace since it's not a function anymore?

10:46 stuartsierra: dnolen: import the class?

10:48 dnolen: stuartsierra: ok, that works.

10:48 cemerick: stuartsierra: try making the maven invocation 'clean install' -- this would likely resolve one of the issues in my clojure-dev node

10:48 and potentially fix the build error

10:49 stuartsierra: I thought Hudson always started with a clean checkout anyway.

10:49 jlb: BTW, rhickey (or anyone), is there a ballpark "done" or at least stable date for 1.2? I'm hoping to ship some production stuff on Clojure and deftype/defrecord/defsomething would be very nice to have (it would suck to retrofit that)

10:50 cemerick: stuartsierra: nope

10:50 stuartsierra: jlb: rhickey doesn't do dates

10:50 cemerick: jlb: I really doubt deftype/defrecord are going to go away.

10:51 we already have a very early version of deftype in production :-)

10:51 * cemerick lives dangerously

10:51 stuartsierra: jlb: if you have to ship now, pick a single snapshot and stick with it.

10:53 chouser: no, I think datatypes and records both have unmunged class names now, so no more need of ::Foo

10:53 jlb: stuartsierra: production is a few months off... so I just need to know what the endpoint will look like, ballpark. :) I'm using deftype now, for example

10:54 stuartsierra: we don't know yet

10:54 it's experimental :)

10:55 some of the necessary changes aren't apparent until after people have had a chance to play with it

10:55 So we get to be the guinea pigs. :)

10:55 cemerick: jlb: you'll likely want defrecord (or its equivalent) from here on out, unless you're using the low-level mutable stuff in deftype

10:56 jlb: cemerick: ok, good to know... BTW I noticed that it implements IPersistentMap, does that mean I can instantiate it from a map by chance?

10:56 cemerick: stuartsierra: clean builds FTW :-)

10:57 stuartsierra: cemerick: Yes, thanks for the tip. http://build.clojure.org/job/clojure-contrib/lastBuild/ is successful now

10:57 sexpbot: clojure-contrib #65 [Hudson]

10:57 stuartsierra: who's this sexpbot, by the way?

10:58 LauJensen: stuartsierra: Thats Raynes' experiment

10:58 cemerick: now let's wait for all those using 1.2.0-SNAPSHOT to suddenly start missing duck-streams et al.

10:58 chouser: jlb: you'd still use 'into' to copy from an existing map into a record

10:58 dnolen: jlb: that just so that you do map like things with a defrecord instance, (:x record-instance) and (assoc record-instance :x 'foo). main difference being you have the speed of java fields.

10:58 jlb: stuartsierra: understood... it's just helpful when selling to others to be able to say something other than "no clue when it will be solidified" :)

10:58 Raynes: stuartsierra: Woot! Finally fixed, eh? :>

10:59 chouser: jlb: anything else would be a lie. :-)

10:59 stuartsierra: Raynes: it was fine until this morning

10:59 cemerick: I'm betting on 12/31/2010 for 1.2.

10:59 stuartsierra: cemerick: really?!

11:00 jlb: chouser: hehe.

11:00 cemerick: stuartsierra: a yearly release cycle seems entirely reasonable. Besides, there's a ton of scope left.

11:00 jlb: chouser: lies would be going too far... some clueful exaggerations would be ok :)

11:00 cemerick: And it's not like defrecord et al. have been beaten up properly.

11:01 stuartsierra: Raynes: contrib build has been stable for weeks.

11:01 cemerick: yeah

11:01 Raynes: stuartsierra: Are we talking about snapshots?

11:02 stuartsierra: yes

11:02 LauJensen: Yearly released cycle?

11:02 cemerick: a long-ish lead like that is helpful insofar as it gets people using SNAPSHOTs, draws more people into the "test pool" ;-)

11:02 Raynes: stuartsierra: http://build.clojure.org/snapshots/org/clojure/clojure-contrib/ There hasn't been a new build here since January.

11:02 sexpbot: Index of /snapshots/org/clojure/clojure-contrib/

11:02 dnolen: anybody messed with Clojure on a core i7 laptop, so does Java see those machines as having 4 cpus ? :D

11:02 cemerick: Raynes: see 1.2.0-SNAPSHOT directory

11:03 Raynes: Oh. Well, that's weird.

11:03 cemerick: stuartsierra: any idea about why prior snapshots aren't being retained for contrib?

11:03 stuartsierra: no

11:03 cemerick: I don't know that much about Hudson, but i'd guess that's how it's configured

11:03 LauJensen: dnolen: (.. Runtime getRuntime availableProcessors)

11:04 dnolen: LauJensen: yes I know, I wondering if anybody's tried that.

11:04 cemerick: every core should get reported as a processor

11:05 dnolen: but core i5 & i7 has hyperthreading, so OS supposedly reports two more cores.

11:06 rsynnott: it would, yeah

11:06 if you have a four-core hyperthreading processor the OS will see that as eight logical processors

11:07 pjstadig: i have a quad core i7

11:07 rsynnott: (or, in the case of a Sun T2, eight threads per core, so _64_ logical processors, which makes for unreadable top readouts)

11:08 pjstadig: system monitor shows 8 procs

11:08 AWizzArd: stuartsierra: I find your last edit of http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Emacs very unfortunate. Why do you suggest that one should not learn Emacs and Clojure at the same time? I think this suggestion should go away again, or get added for all other IDEs/Editors as well.

11:08 sexpbot: Getting Started with Emacs | Clojure | Assembla

11:08 pjstadig: user> (.. Runtime getRuntime availableProcessors)

11:08 8

11:08 dnolen: pjstadig: nice :D an excellent Clojure machine.

11:08 rsynnott: certainly, people usually learn common lisp and emacs at the same time if they don't know emacs already

11:08 stuartsierra: I'm trying to avoid the "Lisp is hard because you have to learn Emacs" problem.

11:08 rsynnott: on the basis that there is no satisfactory way to use common lisp without emacs, usually :)

11:09 stuartsierra: but you may, if you want to

11:09 stuartsierra: Well, obviously, I can't stop anyone.

11:09 AWizzArd: stuartsierra: the same is true for all editors. It makes not much sense to pick on Emacs.

11:09 stuartsierra: Why not? everyone else does? ;)

11:09 But I'll change it.

11:10 LauJensen: stuartsierra: I think thats in bad taste

11:10 AWizzArd: thx

11:10 stuartsierra: I LOVE Emacs, I will never leave it. But I spent years on it before I ever tried to use SLIME/SWANK.

11:10 And it was STILL hard to get SLIME/SWANK/Clojure working together.

11:10 rsynnott: How else are they meant to learn clojure, anyway? From command line?

11:10 LauJensen: stuartsierra: I learned emacs simultaneously with learning SBCL

11:10 * cemerick whistles past the dead horse twitching in the corner

11:11 AWizzArd: cemerick: ^^

11:11 rsynnott: I suppose there's clojure integration for the big scary java IDEs...

11:11 LauJensen: And besides, getting SLIME up and running, with the multitude of wiki guides, blogposts and even videos you'd have to be an impressive character to fail at it these days, wouldnt you ? :)

11:11 rsynnott: LauJensen: ditto, more or less; I'd used emacs before but not seriously. Also, it was cmucl

11:11 pjstadig: elpa makes getting emacs setup much easier nowadays IMO

11:11 stuartsierra: I think everyone should start with the environment they are most familiar with. If that's a text editor and a command line, use that. If it's a big Java IDE, use that.

11:12 AWizzArd: pjstadig: but how do I setup elpa?

11:12 LauJensen: stuartsierra: I think you're making way too much of this

11:12 pjstadig: i just use technomancy's starter kit

11:12 LauJensen: It takes so little effort to get into Emacs, so I hardly think it deserves a warning sign

11:12 AWizzArd: So the starter kit setups elpa, which then allows to setup swank-clojure?

11:12 LauJensen: And secondly, the benefits are so massive that we should be helping people pass those hurdles, not point at them and scream danger

11:12 AWizzArd: I ask because I still use the version from October 2009, which was easy to install.

11:12 pjstadig: yeah

11:13 cemerick: LauJensen: please keep your emacs advocacy away from my language. :-)

11:13 AWizzArd: Everyone with a cheat sheet can learn the basic Emacs commands within 1-2 days.

11:13 pjstadig: i had to wrangle with things before, but setting up emacs recently with the starter kit was easy...for me

11:13 LauJensen: cemerick: haven't you got some XML that needs untangling ? :)

11:13 * stuartsierra changes the page

11:13 AWizzArd: As if I know all the key combos for Netbeans, Ideo or VimClojure. I would have to learn them all anyway.

11:13 stuartsierra: thanks.

11:13 * stuartsierra runs away with his tail between his legs

11:14 LauJensen: Ok, I'll back down. But I think the editor discussion is silly. Go with the one which strikes your fancy. Dont fear learning. Thats it

11:14 cemerick: stuartsierra: eh, don't do that, the sentiment was correct IMO.

11:14 * stuartsierra comes back nervously

11:14 arbscht: uh oh, now you're in trouble :)

11:14 LauJensen: This is hardly worth getting upset over stuartsierra :)

11:14 cemerick: LauJensen: That's fine. "Helping people get past [emacs'] hurdles" isn't.

11:14 stuartsierra: I know, I'm just being goofy. ;)

11:15 AWizzArd: cemerick: same hurdles with netbeans

11:15 cemerick: AWizzArd: not for the 90+% of devs that use eclipse/netbeans/intellij

11:15 jweiss: i think if the question is "does emacs scare people away from clojure" the answer is clearly "yes", wouldn't we all agree? But they don't have to use emacs

11:16 AWizzArd: cemerick: unfair comparison, cause they already *know* how to use those

11:16 cemerick: AWizzArd: and as a clojure advocate, that's all I care about.

11:16 jweiss: although i did learn emacs even though i tried to avoid it, because it's by far the best environemnt to use for clojure (IMO)

11:16 AWizzArd: cemerick: but then there should still be a warning to not learn Clojure and Netbeans at the same time, as for any editor/ide.

11:17 rhickey: 1.2 will be soon

11:17 * AWizzArd cheers

11:17 cemerick: AWizzArd: well, the warning's gone now. Besides, tackling the emacs-starter-kit is enough of a warning to those that don't care about emacs. ;-)

11:17 AWizzArd: ^^

11:18 stuartsierra: rhickey: yay!

11:19 AWizzArd: btw, whill 1.2 include deftype/defrecord?

11:19 * cemerick is surprised and happy

11:19 rhickey: AWizzArd: it already does

11:19 AWizzArd: good good

11:19 Cells are for 1.3?

11:19 * dnolen had a sneaking suspicion. deftype/defrecord/protocols are too cool to keep from the world.

11:20 jweiss: where can i find docs on these new features?

11:20 AWizzArd: jweiss: http://www.assembla.com/wiki/show/clojure/Datatypes and http://www.assembla.com/wiki/show/clojure/Protocols

11:20 sexpbot: Datatypes | Clojure | Assembla

11:21 rhickey: yikes, TIOBE lumping Clojure with Lisp/Scheme, of course that makes it leap to #23 (over Scala, Erlang)

11:22 cemerick: rhickey: yeah, that's hilariously sad, eh?

11:23 rhickey: and Go is #15 and in the hall of fame, oh please

11:23 stuartsierra: yeah

11:23 cemerick: I presume the page is only there for SEO purposes.

11:23 liebke: seems like they might as well lump C/C++/Java together too then

11:24 AWizzArd: Tiobe uses a google search

11:24 compare: "go programming language" 48 million hits

11:24 "clojure programming language" 70k hits

11:27 rhickey: hrm, I get "go programming" 60k, "go language" 156k, clojure 356k

11:28 AWizzArd: rhickey: ok, might be because I use the german version of google.

11:28 stuartsierra: rhickey: after latest patch, I get "Warning: profocol #'ns/FooProtocol is overwriting function foo"

11:29 rhickey: stuartsierra: when you do what?

11:29 AWizzArd: When i put it into quotes, "go programming language" i get 291k hits vs "clojure programming language" 177k hits.

11:29 stuartsierra: rhickey: load my code

11:29 rhickey: stuartsierra: which code

11:29 stuartsierra: oh, maybe it's getting loaded twice

11:29 * stuartsierra checks

11:29 stuartsierra: mine

11:30 containing (defprotocol FooProcotol...)

11:30 hang on, checking to see if it's loading twice because of testing

11:31 rhickey: stuartsierra: I can reload the cells code over and over without warning

11:31 stuartsierra: ok, I get it on first load

11:31 rhickey: any declares?

11:31 stuartsierra: no

11:32 carkh: the protocol naming convention is PascalCase ?

11:33 rhickey: carkh: yes

11:33 carkh: same for types and records ?

11:33 rhickey: carkh: yes

11:33 carkh: thanks !

11:33 AWizzArd: http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html

11:33 rhickey: all will become Java class names

11:34 stuartsierra: rhickey: http://gist.github.com/367231

11:34 carkh: ok got it ... just looking weird with all lisp looking names around =P

11:34 stuartsierra: code here: http://github.com/stuartsierra/lazytest/blob/master/src/main/clojure/com/stuartsierra/lazytest.clj

11:37 but (use 'com.stuartsierra.lazytest :reload) prints no warnings

11:39 same thing in SLIME

11:39 AWizzArd: slime prints no warnings?

11:39 stuartsierra: no, same warnings in SLIME

11:39 only get warnings first time I load the file; subsequent reloads print no warnings

11:41 rhickey: stuartsierra: I get no warnings at all, not from loading the code from buffer, nor from file, nor via use

11:41 stuartsierra: hmmmm

11:41 drewr: rhickey: http://gist.github.com/367250 am I missing something?

11:42 rhickey: drewr: no facgtory fns now, use (Foo.)

11:43 docstrings have changed on deftype and defrecord, please read fro latest details, I don't have a changes list yet

11:43 drewr: ah, ok; I saw that in the docstring but didn't translate that to constructor call

11:43 stuartsierra: rhickey: ok, no warnings at plain REPL

11:43 something about my dev env

11:44 rhickey: drewr: the docstring doesn't say use the ctor, as I'm still thinking about factories, but it doesn't say you get a factory anymore

11:44 drewr: I think I was confused by "A factory function of current.ns/Name will be defined..."

11:44 rhickey: drewr: that's a bug, will fix thanks

11:46 I took it out of deftype doc, but not defrecrod

11:47 drewr: ah

11:48 rhickey: fixed

11:49 stuartsierra: rhickey: It was AOT-compilation that triggered the warning

11:50 When the ns containing defprotocol is AOT-compiled, it produces the warning when loaded

11:51 AWizzArd: rhickey: maybe for 1.2 you just leave it as Foo., and if this won't need changes in the future, then in 1.3 Foo/create and create-foo or whatever can be added?

11:51 In the next months this would generate some code and show how people use it.

11:54 rhickey: stuartsierra: thanks, will look into that

11:55 stuartsierra: thanks

11:55 need a break from all this intense conversation :)

12:01 Raynes: Huh

12:01 Leiningen is downloading 1.2.0-SNAPSHOT from Clojars for some reason.

12:01 clojure-contrib, that is.

12:16 fogus: I get back from lunch and see that Twitter has declared rhickey is almost done with v1.2.

12:18 rhickey: ah, that twitter

12:19 LauJensen: Whats a 'recrod' ?

12:19 fogus: rhickey: Well, if Twitter says it then it must be true

12:20 LauJensen: It's when you have to crod again

12:20 LauJensen: fogus: oh, so I need the crod then..

12:23 rhickey: hrm, I fix stuartsierra's problem and he's left

12:30 Mec: Is there a way to get the repl to only print one '...' after *print-length* is reached, instead of one '...' for every single item left

12:50 slyphon: so, kind of a "working with clojure" question, when working in the repl do you load everything in the project explicitly? if so, how?c

12:52 carkh: slyphon: laod your top-level namespace, and this on loads what it needs ...recursively so that everything gets loaded

12:53 slyphon: top-level namespace as in the 'user.clj' file or the top-level for my project (i.e. 'fqdn.project')?

12:53 carkh: i personally don't use the user namespace for that

12:53 * slyphon nods

12:54 carkh: i'm currently working on a project which has like 80 files (didn't cound them really)

12:55 it's all loaded from dev_init when working on it with my editor

12:55 or from my genclass with the main method

12:55 slyphon: you do a (require 'blah.dev_init)

12:55 carkh: i just load that file then compile =P

12:55 slyphon: :)

12:55 ok

12:56 chouser: I often do (require 'foo.bar :reload) or :reload-all

12:56 carkh: so really yes, that's like a require

12:56 * slyphon nods

12:56 carkh: i can't really reload-all, i have much state all over the place that needs to be kept alive

12:57 like network connections to some hardware and such

12:57 slyphon: i mean, i know how i structure and manage stuff in say, ruby, but it's these kinds of "best practices" that take time to suss out

12:57 yeah, indeed

12:58 cemerick: rhickey: so, uh, sometime next week for a 1.2 release, mmmkay? ;-)

12:58 carkh: cemerick: i'd say tomorrow !

12:59 or better, tonight !

12:59 slyphon: have there been improvements made to the ns macro?

12:59 i saw that ns+ project which looked really cool

12:59 carkh: i think the ns maco fits the bill as it is

12:59 slyphon: ehhh

12:59 chouser: carkh: I tend to use defonce for state that shouldn't be blown away.

12:59 slyphon: there's a *lot* of repetition

13:00 i mean spread out between files

13:00 i'd like some kind of "common set of things" across my whole project

13:00 carkh: chouser: right, but this quite large project was started a while back, when i didn't know about defonce

13:00 chouser: ah, ok

13:01 cemerick: chouser: have you poked at that restricted compilation scope any further?

13:02 carkh: besides reaload-all doesn't provide a clean state, when i need to reload-all, i just kill my clojure process and reload the whole thing

13:23 naeu: fogus: hey there

13:25 LauJensen: Aah, feeling right at home here in #Clojure, enjoying a nice cup of tea.... (coffee maker is broken)

13:25 slyphon: LauJensen: put your feet up, make yourself comfortable

13:25 fogus: naeu: Hello there

13:25 kylesmith: I'm getting a weired error that happens when I set *warn-on-reflection* to true and load a file. "swank.util.io.proxy$java.io.StringWriter$0 cannot be cast to java.io.PrintWriter" Any ideas?

13:26 slyphon: kylesmith: there was some discussion of that

13:26 naeu: fogus: I've been reading joyofclojure. It is remarkably well written

13:26 slyphon: i had a problem with that and the contrib.sql lib

13:26 * slyphon looks to see what the answer was

13:26 LauJensen: kylesmith: its a known issue with swank, Zach Tellman posted a patch for it somewhere, check the group

13:26 fogus: naeu: Thank you very much, but I blame @chouser

13:26 naeu: fogus: The only thing I struggled with was the 2d drawing example

13:26 fogus: naeu: Oh wait, you said "well written" ;-)

13:27 LauJensen: hehe

13:27 lancepantz: is it out?

13:27 slyphon: kylesmith: i htink i wound up changing my dev-dependencies to use [swank-clojure "1.2.0-SNAPSHOT"]

13:27 lein-swank as well

13:27 scottj: lancepantz: just first 5 chapters

13:27 naeu: fogus: I didn't realise that you had to outstretch the canvas before you grabbed the graphical context in order to draw a rectangle

13:28 lancepantz: ah, yeah- i have a link to those somewhere

13:28 fogus: naeu: I think we should fix that

13:28 naeu: fogus: I also didn't realise that when you change the size of the canvas, it clears it

13:28 LauJensen: fogus: Also I dont know if Sam posted it correctly, but are you showing people stuff like (let [f (JFrame.) _ (.setSize f 300 300)] ??

13:28 s/posted/pasted

13:28 naeu: fogus: you just need to add one line specifying an initial size

13:28 LauJensen: no, that was me condensing it down for IRC consumption

13:28 LauJensen: phew

13:29 fogus: LauJensen: Sam? Pasted?

13:29 LauJensen: fogus: naeu is Sam Aaron

13:29 naeu: fogus: I discussed it in here a few days ago

13:29 LauJensen: And he pasted some vile looking code in here a few days ago

13:29 fogus: naeu: I was almost certain we did, but it might have gotten lost in the copy/paste

13:29 LauJensen: Had your name on it

13:30 fogus: LauJensen: I might have missed that

13:30 naeu: LauJensen: cheeky bugger

13:30 LauJensen: hehe

13:31 naeu: fogus: anyway, you and @chouser are doing a wonderful job. It's a joy to read

13:32 the joy of the joy of clojure!

13:32 fogus: naeu: Thank you. And thanks for pointing out the dimension issue

13:33 naeu: fogus: you're welcome. The only other things I noticed were the occasional grammar error here and there. I guess you have an editor to deal with those

13:33 fogus: or are you looking for that kind of feedback too?

13:34 fogus: naeu: Yes. We have an editor, but every little bit helps. We have a forum for that at http://www.manning-sandbox.com/forum.jspa?forumID=624

13:34 sexpbot: Manning Forums: Joy of Clojure

13:35 naeu: fogus: oh ok. I'll start making a note of things I find then :-)

13:35 fogus: Thank you

13:35 naeu: it's the least I can do

13:36 btw, will you be covering 1.2 stuff. Or is it too late for that?

13:39 fogus: naeu: It's all 1.2

13:40 naeu: fogus: oh cool, so will the Java.next chapter cover deftype, defprotocol & friends?

13:41 fogus: naeu: No. That chapter only covers interop. types/proto/reify will be in chapter 8

13:41 naeu: fogus: oh cool :-)

13:42 kylesmith: Well, I just git pull'ed clojure, clojure-contrib, slime, clojure-mode, and swank-clojure, and I'm still getting the same error.

13:44 scottj: kylesmith: LauJensen said there was a patch, but not necessarily merged in. he said check group.

13:45 LauJensen: I dont think its merged. What I do though, is I keep a terminal open, so if I need to check for reflections I just eval the file from there, look at the line numbers, and go back to my code buffer

13:52 kylesmith: Yeah, I looked, but couldn't find anything. Does anyone have a link?

13:57 LauJensen: I'll look

13:59 kylesmith: http://groups.google.com/group/swank-clojure/browse_thread/thread/36cc0c9d325a9c76/be3bcb3501cec1e9?show_docid=be3bcb3501cec1e9

13:59 That was my source

14:00 kylesmith: Oh, I didn't realize swank-clojure had its own group. thanks.

14:18 chouser: what's the state of the art in clojure.test integration with junit?

14:19 I've got a little macro that generates a junit test suite out of a namespace full on functions named like -testFoo

14:20 but it's clumsy to get clojure.test failures to show up as junit failures.

14:23 clojure.test/are always returns true?

14:23 oh, true if the last test succeeds, regardless of earlier tests' results? Is that intentional?

14:31 tomoj: ,(require 'clojure.test)

14:31 clojurebot: nil

14:31 tomoj: ,(clojure.test/are [x] (inc x) -2 -3)

14:31 clojurebot: DENIED

14:31 tomoj: darn

14:32 looks like it just returns whatever the last template expression returns

14:33 chouser: poking around in clojure-test, it looks like you're expected to rebind clojure.test/report and do something appropriate there.

14:42 Norrit: Hey, I am trying to "use" contrib.http.agen/http-agen, but it doesnt quite work .. any suggestions?

14:43 Only require seems to work

14:43 (ns test (:require clojure.contrib.http.agent))

14:47 vegai: Norrit: that's a typo in your comment, not in your code, right?

14:48 Norrit: the typo is in the comment

14:49 vegai: how do you use it?

14:49 Norrit: I tried (ns test2 (:use clojure.contrib.http.agent)) but that doesnt work

14:50 The error message is: bytes already refers to: #'clojure.core/bytes in namespace: test2

14:50 seems like there is a nameing conflict

14:51 hiredman: ,(doc refer-clojure)

14:51 clojurebot: "([& filters]); Same as (refer 'clojure.core <filters>)"

14:55 chouser: Norrit: I'd recommend avoiding naked 'use' like that. Either list the specific Vars you want, or give the whole namespace a convenient alias.

14:55 (use '[clojure.contrib.http.agent :only [foo bar]])

14:56 (use '[clojure.contrib.http.agent :as http :only []]) ... (http/foo ...)

14:57 Norrit: thanks (use '[clojure.contrib.http.agent :only [http-agent]]) works great

14:58 slyphon: is "locking" re-entrant?

15:00 by the same thread?

15:01 timcharper: I posted this to twitter, but a few of you may be interested in this: http://gist.github.com/367421

15:01 (Maybe something else already exists like it?)

15:01 maxhodak: division is giving me exact fractions

15:02 how do i get decimal results back?

15:02 slyphon: rhickey: sorry to bother you, is the "locking" macro reentrant by the same thread?

15:02 maxhodak: i.e., (/ (reduce + a) (count a)) -> 2/25 or 3/5 or such

15:02 slyphon: rhickey: in ruby the Monitor class is reentrant, but the Mutex class isn't, so i wanted to make sure i'm DTRT

15:03 maxhodak: ,(/ (reduce + [1 2 3 4 5]) (count [1 2 3 4 5]))

15:03 clojurebot: 3

15:03 maxhodak: er

15:04 ,(/ (reduce + [0 0 0 1 1 1 0 1 1 0]) (count [0 0 0 1 1 1 0 1 1 0]))

15:04 clojurebot: 1/2

15:04 maxhodak: wtf

15:04 slyphon: that's a lisp-ism, iirc

15:05 chouser: slyphon: locking blocks access to it's body to any but one thread at a time. Perhaps I don't understand your question.

15:05 maxhodak: oh wait

15:05 ,(Float. (/ (reduce + [0 0 0 1 1 1 0 1 1 0]) (count [0 0 0 1 1 1 0 1 1 0])))

15:05 clojurebot: java.lang.IllegalArgumentException: No matching ctor found for class java.lang.Float

15:05 maxhodak: :(

15:06 chouser: ,(double 2/3)

15:06 clojurebot: 0.6666666666666667

15:06 maxhodak: chouser: thanks

15:06 slyphon: chouser: can thread X grab lock Y multiple times without blocking?

15:06 chouser: ah! I think not.

15:07 slyphon: balls!

15:07 ok

15:07 chouser: should be easy to test. hang on.

15:07 slyphon: yeah, i was about to

15:07 i need a reentrant lock

15:08 chouser: I thought I had done this before and got instant deadlock, but now it's acting differently than I remember

15:08 slyphon: hmm

15:09 chouser: ,(let [x (Object.)] (locking x (prn 1) (locking x (prn 2))))

15:09 clojurebot: 1 2

15:09 chouser: no deadlock

15:09 slyphon: ah

15:09 oh, well, excellent

15:11 chouser: "Gain exclusive ownership of a raw monitor. The same thread may enter a monitor more then once. The thread must exit the monitor the same number of times as it is entered."

15:11 slyphon: ah

15:11 is that under the "locking" docs?

15:11 chouser: that's from some random jvm docs on the web. combined with results of experimentation, I think you're safe.

15:11 slyphon: i went looking to find the java impl of monitor-enter but couldn't make heads-or-tails of what i found

15:11 chouser: cool

15:11 chouser: ty

15:12 chouser: slyphon: yeah, it decends rapidly from the 'locking' macro to raw JVM bytecodes.

15:13 * slyphon nods

15:13 slyphon: rhickey: sorry to bother you, chouser fielded that one admirably

15:14 * slyphon tries not to piss off the language developer

15:14 slyphon: er, "to not"

15:22 riddochc: Hi, folks... looks like current -contrib doesn't build with current master of clojure.

15:23 Or, actually, has errors...

15:23 ERROR in (complex-division) (run-test108689328942713466.clj:44)

15:23 expected: (= (/ (imaginary 5) (imaginary 5)) 1) actual: java.lang.IllegalArgumentException: No method in multimethod '/' for dispatch value: :clojure.contrib.complex-numbers/pure-imaginary

15:24 rhickey: riddochc: did you mvn clean?

15:25 all clear here

15:25 riddochc: rhickey: I'll try that, though it was a fresh git checkout...

15:26 jfields: if I have a symbol that references a function, how can I call that function?

15:26 rhickey: jfields: a symbol or a var?

15:26 riddochc: rhickey: By the way, thanks for clojure. It's pretty much what I've always wanted: a modern, useful lisp.

15:27 jfields: (defn x [] 0) (doseq [y ['x]] (println y) (println ... how do I get 0 for the 2nd println?

15:29 riddochc: Curious. I'm setting it up on a different system (laptop crash) and I wonder if there's an issue that it's using openjdk instead of sun's.

15:32 jfields: there must be a better way to do this

15:32 (doseq [y ['x]] (println y) (println (eval (list y))))

15:34 riddochc: Oh well, I'll just use sun's java. I guess my distro just defaulted to openjdk.

15:37 rhickey: jfields: ,((resolve 'inc) 41)

15:37 ,((resolve 'inc) 41)

15:37 clojurebot: 42

15:38 rhickey: riddochc: you're welcome

15:39 jfields: thanks Rich

15:44 technomancy: riddochc: I have yet to notice a difference between openjdk and sun that affects clojure

15:44 but there's a first time for everything I guess

15:44 wthidden: How do I call a static inner class java method from clojure?

15:44 riddochc: technomancy: Could just be my setup. We'll find out in a moment.

15:45 wthidden: I have class Scheduler that has a static inner class error with method eror that takes 2 strings.

15:45 technomancy: yeah, works here with openjdk

15:45 chouser: (the.package.name.Scheduler$Error/error "thing1" "thing2")

15:46 wthidden: i thought I'd do (Scheduler$error/error "path" "exception") but seem not to be able to get the method.

15:46 chouser: wthidden: you can check that (show Scheduler$error) has the methods you expect

15:47 wthidden: note that if you're trying to do without the full package name, you need to have imported Scheduler$error, not just Scheduler

15:47 wthidden: chouser: ah that might help.

15:47 chouser:ooh did not do that yet...

15:48 hmm from what context does show work?

15:49 is that from the introspect package?

15:50 chouser: clojure.contrib.repl-utils/show

15:51 riddochc: Okay, all the exceptions I'm getting from clojure-contrib tests are coming from "Testing clojure.contrib.test-complex-numbers"

15:52 chouser: hm, you know the number of people saying they don't use contrib or don't know how to get it has been down lately.

15:52 I wonder if that's because of build.clojure.org, or something else.

15:55 riddochc: Looks like all the exceptions are of the variety: java.lang.IllegalArgumentException: No method in multimethod 'sqrt' for dispatch value: :clojure.contrib.complex-numbers/complex... sometimes, substitute '+', '-', '/', 'exp', or '*' for 'sqrt'...

15:56 The errors are limited to the complex-numbers tests, it looks like.

15:56 Ran 359 tests containing 1248 assertions.

15:56 4 failures, 253 errors.

15:57 Odd.

16:04 hiredman: does anyone have an example of a macro that emits a type hinted method call?

16:29 riddochc: Oy. The maven "getting started guide" is *awful*. Quote: ...in a nutshell Maven is an attempt to apply patterns to a project's build infrastructure in order to promote comprehension and productivity by providing a clear path in the use of best practices.

16:29 gregh: with synergy.

16:30 riddochc: Makes me want to just stop reading, right there. "Oops, wrong document. I'm not An Enterprise."

16:32 lancepantz: saw a book title today: Eliminating Waste in Software Projects, with the subtitle "The enterprise 2.0 concept applied to lean software development."

16:32 yay, enterprise 2.0

16:35 riddochc: I think the appropriate phrase involves a valley accent: "Like, totally gag me with a spoon, or some junk."

16:35 Anyway. Gotta run. Have fun clojuring, folks.

16:36 arohner: hiredman: the gvec code does a lot of it

16:36 I think

16:37 hiredman: :(

16:39 not a whole lot, actually

16:40 infact, at a quick glance it only does it once

16:40 http://gist.github.com/367619 I don't see why I get that reflection warning

16:47 remleduff: Are you supposed to be able to take the value of a method as a field like that?

16:48 Chousuke: hiredman: I think tags are supposed to be symbols, not actual class objects

16:48 hiredman: ayeee

16:50 Chousuke: excellent

16:53 remleduff: Out of curiosity, what was the magic?

16:54 (let [x (gensym)] `(fn [~x] (. ~(with-meta x {:tag (resolve 'String)}) toString))) doesn't seem to make any difference to me

16:55 Chousuke: just :tag 'String

16:56 remleduff: Aha

16:56 Chousuke: reflection can be avoided if the symbol's metadata contains a value for the :tag key that is either a symbol or a string naming the class

16:59 LauJensen: hiredman: Aren't you looking for something like the aget! and aset! macros in my FD blog post?

17:00 hiredman: nope

17:03 remleduff: Does the reader actually "read" the result of macros? I was trying to get #^String to work in that example, but it doesn't seem to every take effect. If not, how do {} literals work? Are they not really reader macros?

17:03 s/every/ever

17:03 Actually, there's no macro there, is there

17:05 hiredman: remleduff: the reader's job is to transform text into datastructures, macros already are operating on datastructures, why would the reader still be involved?

17:05 remleduff: ,(eval `(fn [#^String x#] (. x# toString)))

17:05 clojurebot: DENIED

17:08 remleduff: I don't know, it's just too easy for me to think of reader macros as "magic things that do stuff", I need to be sure to keep what they do clear in my head I guess.

17:08 chouser: remleduff: #^Foo works inside syntax-quote in *some* places, but by no means in all.

17:09 Chousuke: remleduff: don't confuse reader macros with normal macros :)

17:11 chouser: ,(binding [*print-meta* true] (prn `(#^Foo x)))

17:11 clojurebot: (#^sandbox/Foo sandbox/x)

17:11 chouser: ,(binding [*print-meta* true] (prn `(#^Foo x#)))

17:11 clojurebot: (#^sandbox/Foo x__10025__auto__)

17:11 chouser: so those work, but this does not:

17:11 ,(binding [*print-meta* true] (prn `(#^Foo ~'x)))

17:12 clojurebot: (x)

17:14 remleduff: Because x is being captured from the environment there, and you can't "change" its metadata only create a new value with with-meta?

17:14 ,(binding [*print-meta* true] (prn `((with-meta ~'x {:tag 'Foo})))

17:14 clojurebot: EOF while reading

17:15 remleduff: ,(binding [*print-meta* true] (prn `((with-meta ~'x {:tag 'Foo}))))

17:15 clojurebot: ((clojure.core/with-meta x {:tag (quote sandbox/Foo)}))

17:15 Chousuke: ,(binding [*print-meta* true] (prn `(~'#^Foo x)))

17:15 clojurebot: (#^Foo x)

17:15 remleduff: That's way too many sigils ;)

17:15 Chousuke: hehe

17:16 fortunately you almost never need that

17:16 only if you absolutely must emit an unqualified constant symbol with a type hint :P

17:16 remleduff: Will that actually ever be "read" though, to allow the #^Foo to work on x?

17:17 Chousuke: with a *constant* type hint, even

17:17 yes. When the macro is defined

17:19 it gets read into a data structure something like the following: (binding [*print-meta* true] (prn (list (quote x))) where the symbol x has metadata

17:20 chouser: ,(binding [*print-meta* true] (prn `(~(with-meta `x {:tag `Foo}))))

17:20 clojurebot: (#^sandbox/Foo sandbox/x)

17:21 chouser: basically there are certain expansions in syntax-quote that ignore the metadata you put on the pre-expansion thing (using #^), and in those cases you may have to using something else.

17:21 the closest equivalent is what I just pasted, using with-meta inside an unquote (~)

17:22 Chousuke: #^Foo is amusing with quote since you must remember that 'bar expads to (quote bar)

17:22 so #^Foo 'bar puts metadata on the list

17:22 and you have to use the slightly unintuitive form '#^Foo bar :)

17:23 remleduff: OK, I'll chew on that for a while

17:25 fyuryu: hmm, I get 4 test failures in contrib. is it just me?

17:29 slyphon: rhickey: it'd be nice if there was some way in the ns macro, in the :require clause to have single names mean ':as', i find my code has a lot of (foo :as foo) (bar :as bar)

17:29 inside the context of some outer namespace

17:35 tomoj: I've wondered before about wrapping ns

17:36 seems like a difficult thing to do

17:36 (use '[my.ns :only my-ns]) (my-ns ...) I guess

17:36 except without the mistake

17:37 probably a terrible idea

17:37 I just feel bad having all this Macro Power but not being able to bend ns to my will

17:37 slyphon: tomoj: ns is *narsty*

17:38 tomoj: http://onclojure.com/2010/02/17/managing-namespaces/

17:38 sexpbot: Managing namespaces &laquo; On Clojure

17:38 tomoj: oh, someone's already done it! hah

17:38 slyphon: only works w/ 1.2

17:39 tomoj: I suppose you might also someone have your ns+ cause the namespaces it loads to automatically have ns+ available

17:39 but that sounds even more evil

17:39 slyphon: :)

17:39 tomoj: because then the file won't compile on its own

17:39 slyphon: yeah, with something like that, it's probably better to actually know what the fuck is going on

17:39 tomoj: I just don't like the '

17:40 (use nstools.ns) would be cool, but (use 'nstools.ns) is unacceptable

17:40 * slyphon chuckles

17:41 tomoj: not sure I like :like

17:41 slyphon: i like the idea, though

17:41 sort of "templatized namespaces"

17:42 in ruby, i'd have either a base class or a module i'd import into things for this purpose

17:42 tomoj: well, I meant I'm not sure if I like the idea

17:42 it means you have to run around looking for what's actually in the namespace

17:42 slyphon: ehhh

17:42 tomoj: (right?)

17:42 slyphon: well, you'd probably have one or two central places with the "base" namespaces defined

17:42 i think it'd make things easier

17:43 tomoj: hmm, that's interesting

17:43 slyphon: like, i have an exception class that should basically be imported everywhere

17:43 tomoj: I don't think I have enough duplication in my ns decls to benefit much, though, but maybe I just haven't noticed it

18:40 * Sgeo_ wonders if there's a nice way to transition from [a drop of] Scheme to Clojure

19:28 merchantly: hi - i'm extremely new to clojure/lisp, so sorry if this is a really lame question. How do you update a value in a set? For example if I have a set (def my-data {"Michael" 25, "Michelle" 26}), how do I update Michael's value to 28?

19:29 technomancy: merchantly: (assoc my-data "Michael" 28)

19:29 programble: merchantly: assoc

19:29 aw

19:29 was beat to it

19:30 merchantly: thanks

19:33 technomancy: merchantly: "How do you update a value in a set?" it's actually in a map fwiw

19:34 programble: yer'

19:34 merchantly: ok thanks, that's helpful

19:34 is set something else?

19:35 carkh: #{:a :set :of :5 :values}

19:35 also you're not quite updating the map, you're creating a new map as these are immutable

19:41 merchantly: when I use assoc to create the new map, how come when I call my-data it hasn't changed?

19:42 carkh: because it's immutable

19:42 programble: because your not changing it

19:42 carkh: calling assoc returns a new map

19:42 but does not modify the binding of my-data

19:42 merchantly: so i have to rebind it?

19:43 carkh: usually you would use an atom or a ref for that purpose

19:43 for instance : (def my-data (atom {"Michael" 25, "Michelle" 26}))

19:44 then to change michael's age : (swap! my-data assoc "Michael" 26)

19:45 there is a talk somewhere about identity and state

19:45 you might want to check it out

19:46 merchantly: ok thanks - i'll look it up

19:49 carkh: http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey

19:49 tho infoq is down right now

19:49 so i couldn't check if it's the actual talk i'm refering to =/

19:50 merchantly: just read through this: http://clojure.org/state, I "think" I get it

19:51 carkh: yep good introduction, tho it's always good to hear ritch's talks

19:52 hum last thing : don't forget you're now working with an atom, so you can't just use it as a simpe map

19:53 to access michael's age you need to do this : (get @my-data "Michael")

19:53 @my-data is shorthand for (deref my-data)

20:04 merchantly: ok so I want to add 1 to Michael's age and then change my-data to reflect that, here's what I came up with: (swap! my-data assoc "Michael" (+ (get @my-data "Michael") 1))

20:04 is that the right way to do it?

20:04 programble: or use inc

20:05 ,(+ 5 1)

20:05 clojurebot: 6

20:05 programble: ,(inc 5)

20:05 clojurebot: 6

20:09 merchantly: cool - ok I just tried to change that into a function, but I'm missing something: (defn year-older [name] (swap! my-data assoc name (inc (get @my-data name))))

20:09 nm

20:09 it works

20:09 awesome

20:10 technomancy: if you make it a map of names to atoms then you could just swap with inc

20:11 ,(let [name "Michael", my-data {name (atom 22)}] (swap! (my-data name) inc) my-data)

20:11 clojurebot: {"Michael" #<Atom@a3686b: 23>}

20:12 technomancy: depends on where you want to emphasize the fact of mutability

20:13 carkh: i would recommend putting the muttable thing as high as possible, make your functions work with and return immutable objects, and have the atom stuff as top-level calls

20:14 so to use inc directly : (swap! my-data update-in ["Michael"] inc)

20:14 technomancy: totally depends on the situation imo

20:14 but bonus points for using update-in

20:15 carkh: technomancy: agreed it depends, but the common case is that you don't need to sprinkle atoms all over the place

20:15 or refs

20:16 that would be going back to imperative programming

20:16 technomancy: need more context to tell

20:17 merchantly: alright im trying to understand each example

20:18 technomancy: the lack of indentation certainly doesn't help

20:20 merchantly: ok so in the update-in example, we're taking the value of "Michael", then incrementing it, then updating the value, and then swapping the data in the atom?

20:20 carkh: errr i'm viewing it the other way around, but yes

20:21 merchantly: could you explain how you view it? I'm trying to wrap my head around how to think about it

20:22 carkh: swap! will make you worl with the value inside the atom, we want to update that value, at the 'Michael' position, there is an age which needs to be incremented

20:22 worl->work

20:23 exactly what you said, in reverse order =)

20:40 merchantly: thanks for all the help carkh

20:40 carkh: =)

20:54 Raynes: Where did shuffle go?

20:54 I've noticed it's not in c.c.string.

20:55 Or was it in seq?

20:55 Ah, I think it was.

20:55 * Raynes has been coding for too long today. :|

20:56 weissj: clojurebot: paste

20:56 clojurebot: lisppaste8, url

20:57 weissj: lisppaste8: url

20:57 hm

20:57 somebody help me out :)

20:58 Raynes: gist.github.com

21:00 weissj: Raynes: cool thx

21:00 can someone point me to an example project.clj that has swank-clojure as a dev-dependency? i run lein swank and it complains

21:01 #<CompilerException java.lang.ClassFormatError: clojure.contrib.pprint.PrettyWriter (erroneous identifier) (pprint.clj:6)>

21:01 Make sure swank-clojure is added as a dev-dependency in your project.clj.

21:01 i have a feeling it's not really complaining about swank

21:01 it's seems to be complaining about pprint

21:15 Raynes: Hrm.

22:20 AntonyBlakey: Anyone have a recommendation for unit-testing html generators i.e. parsing and asserting things about html documents?

22:28 rlubke: AntonyBlakey: HtmlUnit?

22:28 AntonyBlakey: I don't want to simulate the browser

22:28 because I'm dealing with incomplete fragments

22:30 But for full pages and system testing, yes I'd use HtmlUnit.

22:31 sattvik: AntonyBlakey: I've heard that enlive can be used for scraping HTML. I have not done it, so I do not know how well it would work for testing.

22:31 AntonyBlakey: Thanks, I'll check enlive as well.

23:11 cachou: hello~ anyone play robocode here?

23:12 I met a problem. "java.lang.ExceptionInInitializerError".

23:13 All code in the internet seems not work. I'am using clojure-1.1.0, Is it a version problem?

23:41 Losha: Hello

23:42 dsnyders: Hi

23:45 Losha: Do people need to be registered to use this channel. Someone was asking on #ubuntu...

23:46 hiredman: freenode instituted a spam fighting measure a while back, but no ops to turn it off

23:46 johnmn3: test

23:47 ok, it works.. thanks Losha and dsnyders

23:47 I had to register

23:47 Losha: thanks hiredman...

23:47 cp2: might explain why its been so quiet lately =P

23:48 johnmn3: I haven't been on here in a while but I was reading my news feeds and I've been noticing the term 'defrecord' ... what's that all about?

23:48 similar to deftype?

23:50 Raynes: johnmn3: http://github.com/richhickey/clojure/blob/master/src/clj/clojure/core_deftype.clj#L189 The doc strings of defrecord and deftype should be enlightening.

23:55 johnmn3: I did try to read the doc string before. I have a hard time understanding those sometimes.

23:56 the docs for deftype and defrecord seem similar, though I noticed the bit on IPersistentMap in deftype.

Logging service provided by n01se.net