#clojure log - Apr 29 2010

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

0:27 replaca: did I hear that clojure-swank is broken with the latest 1.2 clojure?

0:35 ah, the tumbleweeds are rolling around in here tonight...

1:30 palamas: Good evening all. Would someone have a moment to answer a question about labrepl? When I try to start it it throws "java.lang.ExceptionInInitializerError (control.clj:9)

1:32 leifw: technomancy|away: I take issue with a commit of yours in clj-processing. If you come back and have a chance to look at it, I'd be elated.

1:33 unlink: How do I achieve the effect of apply when I want to apply to a Java method call? e.g. (.someMethod obj [expand me])

1:33 Chousuke: wrap it in a function

1:34 leifw: unlink: I remember hearing that memfn was bad for some reason, but I'd probably do (apply (memfn .someMethod obj) list)

1:34 Chousuke: leifw: I don't think memfn is bad as much as outdated (#() is easier most of the time)

1:35 and I think memfn doesn't need the . in the method name

1:35 (doc memfn)

1:35 clojurebot: "([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."

1:35 leifw: true

1:40 unlink: Chousuke: How would you wrap it in a function?

1:43 Chousuke: just (apply #(.someFoo %1 %2) [1 2])

1:43 jacortinas: test

1:43 woo

1:43 Chousuke: but then you need to know how many parameters there are

1:45 unlink: Chousuke: right, that's the issue I'm facing

1:45 Chousuke: then try memfn

1:45 unlink: It's a static function

1:46 Chousuke: hm

1:46 unlink: er

1:46 but memfn pokes a hole in the place of the object

1:47 Chousuke: ,(apply (memfn Integer/valueOf) ["1"]) testing

1:47 clojurebot: java.lang.IllegalArgumentException: No matching method found: valueOf for class java.lang.String

1:47 Chousuke: right. :(

1:47 I suppose then you're left with manually writing a multi-arity fn

1:47 unlink: meh, I've never heard a better excuse to use a macro

1:48 um. false.

1:48 yeah I guess you're right.

1:49 Chousuke: You can write a macro if you're going to need to do this a lot

1:49 hoeck: unlink: or try reflection

1:49 unlink: but the number of args isn't known in advance

1:50 (defmacro wrap [method args] `(info (apply #(. EWrapperMsgGenerator ~method) ~args)))

1:50 obviously the apply #( ... ) doesn't work

1:50 Licenser_: morgn

1:50 unlink: but it will be used like this: (proxy [cls] [] (meth1 [& args] (wrap meth1 args)) (meth2 [& args] (wrap meth2 args) (meth3 [& args] (wrap meth3 args)))

1:51 hoeck: Licenser_: moring

1:51 unlink: close parens to taste :-)

1:51 Chousuke: unlink: that doesn't look right.

1:52 unlink: I would have liked to put a macro in there that would let me do (proxy [cls] [] (wrap meth1 [arg1 arg2 arg3]) (wrap meth2 [blah bluh bleh]))

1:52 Chousuke: Yeah it's a funky API

1:53 Chousuke: unlink: would the vectors always be literal like that?

1:53 unlink: Chousuke: in which case?

1:53 Chousuke: for your wrap invocations

1:53 unlink: Chousuke: those are supposed to be argument vectors

1:54 Chousuke: actually, I can accomplish this with a macro that wraps proxy.

1:54 ...which I would really not like to do.

1:54 Chousuke: well, I'll take your word for it because I have no clue what you're trying to do

1:54 * unlink sighs

1:55 unlink: Chousuke: I'm implementing one interface which basically delegates its work to another object (which doesn't implement that interface)

1:55 s/object/class

1:56 Chousuke: once or many times?

1:56 unlink: many times, like 50

1:56 Chousuke: ie. do you have many class/class pairs doing this delegation?

1:56 unlink: oh, no

1:56 Chousuke: or just objects?

1:57 remember that proxy can close over locals, so if you have only one class you need to wrap, I think you could do it by returning a proxy from a function

1:57 unlink: I have an object with about 50 different methods which all get delegated to a class with methods of the same name

1:57 Chousuke: ah.

1:58 so that's why you want a macro .p

1:58 I think writing a macro that generates a proxy form would be the easiest

1:58 unlink: I promise I had nothing to do with the design of those APIs :-)

1:58 Yeah I can't think of anything else

1:59 Chousuke: (make-wrapping-proxy from-class to-class methodname [arg1 arg2] methodname2 [arg1 arg2] ...)

1:59 though I'm not sure how you'd handle the static/instance method difference in this case.

2:04 In any case, you should end up with something like (defmacro foo [a b & args] (let [partition-here] `(proxy [whatever] ~@(map (fn [[methodname argvec]] `(~methodname ~argvec (. foo ~methodname ~@argvec))))))

2:04 except with fewer metasyntactic variables :P

2:05 unlink: wow

2:05 that is almost *identical* to what I wrote

2:06 I used a real classname instead of whatever and foo, and meth and args instead of methdname and argvec, but otherwise identical

2:06 Chousuke: heh

2:13 unlink: except it's a little more complicated because of multiple arity methods

2:14 Chousuke: hm

2:14 well you can also try using reflection in the macro

2:15 (note: not in the generated code :))

2:15 unlink: haha

2:15 Chousuke: but that'll be a bit more difficult to write

2:16 but it's entirely possible as long as the class is known at compile-time

2:16 which it has to be, I suppose.

2:25 unlink: Wow, really? http://paste.plurk.com/show/242337/

2:30 vegai: uh oh, I've been voted to speak about clojure at work next friday

2:30 I guess it's high time to learn the thing :P

2:31 zmila: vegai: you speak about Clojure once, then second time, finally you learn it.

2:32 vegai: ;)

2:38 Raynes: "Scala & Clojure. I think Scala is more similar to Ruby than Clojure. But if you ask me which I like, I’ll say Clojure." -- Matz

2:38 vegai: bogglesome.

2:39 I know I shouldn't say this, having designed no languages... but I don't have much respect for Matz

2:39 oops, I said it.

2:39 Raynes: At least Ruby isn't Java.

2:39 Or C.

2:41 vegai: Elaborate! :D

2:42 vegai: I've used ruby at work for about 3 years

2:45 leifw: I would probably use ruby if there were no lisps left

2:45 Raynes: leifw: I'd probably use Haskell. But once I got sick of monads, I'd go to Ruby.

2:46 vegai: while it's quite nice for writing code, I've been suffering a bit from its lack of design

2:46 Raynes: vegai: I'm not going to defend Ruby or anything. I was just curious. :>

2:46 leifw: Raynes: I've tried to figure out haskell so many times it's just getting depressing.

2:46 Raynes: leifw: I figured it out once.

2:46 vegai: Raynes: I'm not rabidly against it... we have couple of much much worse languages in use here :P

2:46 leifw: that must've been fun

2:47 Raynes: But I went to Clojure because I couldn't grok monads enough to find a use for them in my own code.

2:47 vegai: perhaps it's more rails that bites me. It doesn't scale.

2:47 Raynes: I understood how monads worked, but I didn't understand how they were useful outside of the general stdlib monads.

2:47 I think I need to do a Clojure monad tutorial.

2:47 vegai: people like to blog how rails scales and everyone who says it doesn't are idiots

2:47 Raynes: cgrand: ohai

2:47 vegai: and I fear that readers believe that

2:48 Raynes: I don't care for Ruby because nobody seems to use it except for rails.

2:48 vegai: yeah, I was heavily into haskell for several years also. I guess I still am in a way

2:48 Raynes: ._.

2:48 leifw: vegai: if you don't mind, where do you work?

2:48 Raynes: And I don't do webdev.

2:49 vegai: leifw: in a small company that makes billing systems for telcos and such

2:49 cgrand: good morning #clojure!

2:50 leifw: ugh...good late late late night, cgrand

2:51 Raynes: (defplugin (:hicgrand "Says hi to cgrand." ["hicgrand" "hiChristophe"] [{:keys [irc channel]}] (ircb/send-message irc channel "cgrand: "HAI!")))

2:51 Aw, damn.

2:51 Misplaced a quote.

2:51 That would have been clever, otherwise.

2:52 cgrand: Raynes: tank you for the comment in respond.clj

2:52 Raynes: <3

3:04 replaca: morning cgrand!

3:50 LauJensen: Morning all

3:51 Raynes: LauJensen: Moin.

3:52 That's used in Denmark, right?

3:52 LauJensen: Well How'dy Mr. Alabama :)

3:56 Raynes: Its used in the south tip of Jutland (Denmarks main piece of land), but its German in origin

3:56 btw, could we rename your bot to The-Richinator ?

3:56 Raynes: I don't think I can consent to that.

3:56 ._.

3:58 Yesterday's exposure got me 4 new sexpbot watchers on Github. :D

3:58 LauJensen: Its a popular project?

3:59 Raynes: It's my most popular project. It's not popular though.

3:59 I've just never had a popular project to compare it to.

4:00 LauJensen: Ok

4:29 hmm, where's philjure? still nighttime in the US I guess

4:34 spariev: it's suspiciously quiet here ... Raynes finally got some sleep ?

4:34 Raynes: >.>

4:34 I slept from 11:00am yesterday until 9:00pm last night. It's 3:34am now.

4:37 spariev: I envy your schedule :)

4:38 Chousuke: LauJensen: I think you might be the only *jure proponent on this channel ;P

4:38 LauJensen: Chousuke: Im not though

4:38 I just hate communism and *jure in equal measure

4:39 Chousuke: wait, whaT?

4:39 where does communism come into this?

4:39 LauJensen: Chousuke: When my build tool has an oppinion about my naming strategy, thats communism, dont you recognize?

4:39 Chousuke: no

4:39 just, no,.

4:39 LauJensen: Then you're a commujure yourself

4:40 Chousuke: :P

4:40 you shouldn't joke about things like this, someone might take it seriously

4:40 Raynes: Let's just rename Clojure, rumblethunderchickenfinger, and nobody will ever want to use the name as a pun.

4:41 LauJensen: Raynes makes a good point

4:41 Chousuke: I'm not kidding - Unless you can pursuade me otherwise I think its down right communistic to restrict name in a build-tool because of personal taste

4:42 And I'll be happy to rantjure about it

4:42 Chousuke: LauJensen: I think you might have some really distorted ideas about communism

4:43 a build tool discouraging you from stupid naming schemes is simply opinionated, not communist :P

4:43 by your logic, clojure itself is communist because it's definitely opinionated. And that's just silly

4:44 LauJensen: No your logic is that oppinionated = communistic which I dont think. This is purely a matter of style and thats why I think its a bad idea

4:44 Chousuke: but I think bringing a political ideology of any kind to the discussion is a mistake to begin with

4:45 LauJensen: right, it's okay to think that explicitly discouraging bad naming schemes is a bad idea, but please don't call it communist.

4:45 Raynes: #politics

4:45 LauJensen: Chousuke: np, if it offends you or anybody else I wont

4:45 Chousuke: because that's just an association fallacy

4:46 LauJensen: You'll find many people are put off by faulty logic :)

4:46 Raynes: I'm renaming sexpbot botjure

4:47 LauJensen: Woohoo!

4:47 Chousuke: gah.

4:47 LauJensen: pwnagejure

4:47 vegai: Raynes: how about 'RAMIREZ'?

4:47 LauJensen: Chousuke: But now that we're beyond the name calling, where do you see the logic failing?

4:47 vegai: and force all commands te be uppercase.

4:47 Raynes: :>

4:48 Chousuke: LauJensen: the fallacy is simply associating an opinionated feature with a political ideology :P

4:48 Raynes: Nobody ever called anybody any names.

4:48 At least, what I read of it.

4:48 LauJensen: Raynes: I called leinjure communistic

4:48 Raynes: Did you call Chousuke a commie?

4:49 Chousuke: LauJensen: I mean, it's just an easter egg. You can still name your project whatever you want.

4:49 LauJensen: leiningen just wont help you if you choose to show a lack of taste :P

4:50 LauJensen: Chousuke: Lemme just quote Wikipedia for you "Communism is a social structure in which classes are abolished and property is commonly controlled and where the ruler decides what you can name your projects"

4:50 Chousuke: :D

4:50 SynrG: #politics++

4:50 Chousuke: yeah, I think this is getting a bit out of hand

4:50 LauJensen: Alright alright, go back to your coffee and news sites :)

4:51 SynrG: coffee and clojure101 exercises

4:51 Raynes: Such arguments can only be solved with a fight to the death.

4:51 SynrG: no, to the pain!

4:51 Raynes: SynrG: New ones?

4:51 Chousuke: no. this must be solved by a robot battle

4:51 SynrG: Raynes: i'm very slow and deliberate :) also i only have scraps of time for it.

4:51 Raynes: SynrG: I did the last ones in my head in about 60 seconds. :>

4:51 Chousuke: and the robots must be controlled by an AI written in Clojure

4:52 SynrG: Raynes: ah, but you weren't a clojure virgin

4:52 Raynes: $google robocode

4:52 sexpbot: First out of 34900 results is:

4:52 Robocode Home

4:52 http://robocode.sourceforge.net/

4:52 First out of 26 results is:

4:52 Robocode - Wikipedia, the free encyclopedia

4:52 http://en.wikipedia.org/wiki/Robocode

4:52 Chousuke: Raynes: hm, that's a bit floody :P

4:52 Raynes: Huh

4:52 It isn't normally.

4:52 A small bug.

4:53 * Raynes fixes it.

4:53 Raynes: I introduced a few when I tried to rewrite 26 plugins in an hour last night.

4:53 SynrG: Raynes: everything i read raises questions, and more likely as not takes me on a trip through doc and some experiments in repl, so ... i'm only just now on the last exercise as a result

4:55 LauJensen: $google define: floody

4:55 sexpbot: First out of results is:

4:55 First out of 3 results is:

4:55 Tully (Irish sept) - Wikipedia, the free encyclopedia

4:55 http://en.wikipedia.org/wiki/Tully_(Irish_sept)

4:55 LauJensen: hmmm :)

4:56 Raynes: Mismatched parens that weren't really mismatched.

4:56 Just in the wrong place.

4:58 $google wtf

4:58 sexpbot: First out of 4530000 results is:

4:58 The Daily WTF: Curious Perversions in Information Technology

4:58 http://thedailywtf.com/

4:58 Raynes: Fixed.

4:58 LauJensen: Raynes: is the first line necessary ?

4:59 Raynes: LauJensen: It's the exact same thing clojurebot does.

4:59 LauJensen: yes, but if nobody is reading it, why not just let it go ?

4:59 Raynes: Because I think it's generally useful.

4:59 LauJensen: ok

4:59 Chousuke: Raynes: you could combine the first and second lines

5:00 Raynes: That would just be horizontal spam instead of vertical.

5:00 :p

5:00 I'll do that later.

5:00 Working on another branch right now.

5:00 Chousuke: excellent!

5:02 LauJensen: (chousuke is really Mr Burns btw)

5:38 stilkov: I can't seem to find a way to invoke set! on any kind of var

5:38 I must be missing something plainly obvious

5:39 _ato: stilkov: it needs to be thread-locally bound first

5:39 stilkov: you mean using binding?

5:39 _ato: yep

5:39 eg (binding [foo 1] (set! foo 2))

5:40 stilkov: ah ? now it makes sense; should have been more than obvious in hindsight

5:40 esp. since I'm using binding all over the place

5:42 Chousuke: hmm, running git gc on my clojure clone once in a while seems to be beneficial

5:43 just shrank it from 55MB to 8.6MB :P

5:44 Raynes: We herd u liek Clojure, so we put some recurshen in ur recurshen so you can (apply str (repeat "recurshen while you "))

5:45 Should probably be 'rescursh', but nobody is perfect.

5:45 Except Rich.

5:45 Chousuke: :P

5:45 no-one is perfect. Some just are better at making others think so.

5:48 Raynes: Chousuke: In that case, wouldn't the perfect person be the one who could is perfect that making others think he/she is perfect?

5:58 Intensity: I'm wondering what the elegant way is to get a random element from a sequence. I'm using (nth result (int (rand size))), where "result" needs to be calculated, and "size" is either redundantly calculated or uses a very non-idiomatic workaround such as a (def temporary ...) within a (do ...). I'm quite new.

5:59 LauJensen: Intensity: rand-nth

6:01 Intensity: LauJensen: Ok, great. Thanks. In general, if I want to compute something like an infix f(g(x), h(g(x))), is there a most elegant way to avoid computing g(x) twice?

6:03 spariev: (let [g-res (g x)] (f g-res (h g-res))) maybe

6:05 Chousuke: let is your friend

6:06 Intensity: spariev: Ok, I'll work with that idea. Thanks. The code I am interfacing with is Java, and it's using (. this MethodName) repeatedly. Both myself and the one who wrote this temporary Clojure interface to that Java code are very new to Clojure. And I am also generally new to Java as well, although I'm not interested in picking up Java (only Clojure).

6:06 Chousuke: Intensity: prefer (.methodName obj) to (. obj methodName)

6:07 Intensity: Chousuke: Ok. And in chains of methods, then would I prefer (.. obj method1 method2)?

6:07 Chousuke: (and AClass/staticMethod also to explicit . forms)

6:07 well, actually I prefer (-> obj .method1 (.method2 args))

6:08 since it allows you to use clojure functions in the pipeline too

6:09 ,(-> "foobar" .toUpperCase (subs 3)) for example

6:09 clojurebot: "BAR"

6:10 spariev: ,(doto (java.util.HashMap.) (.put "a" 1) (.put "b" 2))

6:10 clojurebot: #<HashMap {b=2, a=1}>

6:11 Intensity: Chousuke: Ok. I'm told that "this" was bound to the local class. The code is wrapped in a (proxy ...). And the corresponding Java code is calling methods like GetCurrentState(), not this.GetCurrentState().

6:12 Chousuke: within a proxy form, this is bound to an *instance* of the proxy.

6:12 and I think the GetCurrentState() call in that case is just a shortcut for this.GetCurrentState()

6:13 or a static method, in which case you need to do (ClassName/GetCurrentState)... But it probably isn't.

6:13 Intensity: Chousuke: Ok. Is it a great idea to use "this" within the Clojure code also? Presumably I'd use (-> this .method1 (method2)), or maybe (method2) doesn't need parenthesis.

6:13 Chousuke: Intensity: you need to use this if you want to call methods on the object

6:14 Intensity: and yeah, parentheses aren't needed if the method/function doesn't any other parameters besides the object itself.

6:15 Intensity: Chousuke: Ok. Thanks for clarifying. Given that I'm using "this", then, I'd prefer using it once. (doto ...) and (-> ...) or maybe also ".." seem to be powerful tools I can use here.

6:15 Chousuke: Intensity: From the clojure perspective it's good to think of java instance methods always taking the object they're called on as the first parameter

6:15 Intensity: yeah. They're all macros :)

6:15 Intensity: Once you get used to clojure you'll be able to write such tools yourself.

6:16 but for now, enjoy using the existing ones :D

6:17 Intensity: Chousuke: Great. Does the fact that those are macros mean that (-> obj .method1 (.method2)) and the same thing with .method2's parenthesis removed are considered identical? I'd guess if -> was not a macro, then surrounding .method2 with parenthesis would make a difference.

6:17 Chousuke: Intensity: yes.

6:17 Intensity: the -> macro expects list forms eg. "(foo)" as its parameters but if it sees just a symbol "foo", it wraps it in a list first

6:19 what it does is pretty simple. it takes the first parameter (a piece of code) and puts it in the second place in the following piece of code (a list). That's then recursively repeated until there are no arguments left

6:19 and as I said, if the second parameter is not a list, it's wrapped in one

6:20 Intensity: Ok. I'm trying to simplify: (. (. this (getStateMachine)) (getLegalMoves (.. this (getCurrentState) (getRole)))). I'm guessing I can make the highest level "." into a ".." and assume that the parenthesis can indicate to .. what structure I want to apply to the sequence of calls. Perhaps (doto this) or "->" could be useful here too.

6:20 Chousuke: so in (-> obj .method) it first internally "becomes" (-> obj (.method)) and then (.method obj)

6:21 yeah

6:21 bozhidar: I was wondering something about this snippet of code from clojure's site

6:22 http://gist.github.com/383420

6:22 why is the logging line outputted 5 times?

6:22 shouldn't it be just one

6:22 Chousuke: I think that would be something like (-> this .getStateMachine (.getLegalMoves (-> this .getCurrentState .getRole)))

6:23 Intensity: Ok. It's my guess that I might turn that into: (.. this getStateMachine (getLegalMoves (getCurrentState getRole))), somehow inferring that each method is meant to operate on "this" in a recursive way. I'm wondering if I can avoid using "this" twice.

6:25 Chousuke: Intensity: I'm not sure if that works.

6:25 Intensity: I don't think there is a way in this case that isn't unnecessarily contrived

6:26 Intensity: Chousuke: It seems that I could describe a macro to work in the way to support a statement like the above. But then it would need to differentiate between Clojure functions imbedded within the structure and Java methods that were meant to be called in this pyramid fashion.

6:27 Chousuke: bozhidar: hm I can't even test that in my repl due to binding being ineffective on str

6:27 Intensity: You could write a macro to interpret C++ code in Clojure. :)

6:27 Intensity: but yeah, you can't with ..

6:28 bozhidar: Chousuke: in my repl it show this exact output as in http://clojure.org/concurrent_programming

6:28 Chousuke: -> can differentiate between methods and functions because it just deals with the symbols

6:28 bozhidar: so I think that binding works on str

6:29 Chousuke: bozhidar: in your version, but I'm running 1.2-master here

6:29 bozhidar: and it might just be that str is calling itself recursively

6:29 bozhidar: thus resulting in more logging prints

6:29 bozhidar: Chousuke: I assume so, I'm running 1.1

6:30 Raynes: I wish people would stop telling me that it's bad for my projects to depend on. 1.2 >:|

6:30 I live for the danger, man.

6:30 * Raynes kicks the misplaced period off of the screen.

6:31 Intensity: Chousuke: Ok. Thanks for the help.

6:32 Chousuke: I think str calls itself once for each argument and then finally once for the final stringbuilder -> string conversion

6:32 which would nicely account for all five logging prints.

6:38 Raynes: Is there something similar to filter/remove that returns a sequence of what was removed after it's finished?

6:38 _ato: I doubt it

6:38 rhickey: Raynes: returns 2 sequences?

6:39 Raynes: rhickey: Indeed.

6:39 Chousuke: you can do (juxt filter remove)

6:39 Raynes: Chousuke: I planned on doing that. Just wanted to be sure there wasn't already a function for that in core.

6:39 :>

6:40 rhickey: http://richhickey.github.com/clojure-contrib/seq-api.html#clojure.contrib.seq/separate

6:40 Chousuke: the problem with having two sequences like that is that they will both hold onto the head of the original sequence :/

6:40 Raynes: That isn't a problem.

6:40 It's for my defplugin macro.

6:41 Expanding it for some hooking stuff.

6:41 I don't think I'm going to do it like this.

6:42 Just running ideas around my head.

6:42 :>

6:48 vu3rdd: partial can take arguments in the order, not any arbitrary args, am I right?

6:49 Chousuke: right. I think.

6:49 IF I understood you correctly

6:49 bozhidar: rhickey: can I bother you with a question about one of the example on clojure.org?

6:51 kzar: So how should I escape variables I put into the SQL when I use with-query-results?

6:52 vu3rdd: Chousuke: were you replying to me?

6:52 Chousuke: yes

6:52 vu3rdd: thanks

6:53 carkh: kzar : something like (with-query-results rs ["select * from customer where id=?" customer-id] (dostuff rs))

6:53 escaping occurs automatically

6:54 Chousuke: if you're going to work a lot with SQL take a look at ClojureQL

6:54 kzar: carkh: Awesome thanks carkh

6:54 Chousuke: OK, I avoid it generally but this project needed to create a MySQL database

6:54 carkh: Chousuke: clojureql sometimes won't go as far as needed

6:55 like when using database engine specific features

6:55 for instance (last time i checked) the returning statement from postgres

6:55 Chousuke: carkh: it does support raw SQL when needed doesn't it?

6:55 carkh: well then what's the point =P

6:55 vu3rdd: Is there a way to give default value to function parameters?

6:56 Chousuke: vu3rdd: not directly, but arity overloading is a common workaround

6:56 vu3rdd: Chousuke: oh.. I forgot about it. Thanks

6:57 cemerick: There's also :or in map destructuring, which is a nice route

6:58 Chousuke: a defn-with-defaults might be useful

6:58 carkh: i like the addition from hiredman for that : (defn bleh [& {destructuring here}] ...) you get real named parameters !

6:58 Chousuke: (blah somefn [foo = 2, bar = 3, something] ...)

6:58 cemerick: carkh: yeah, that's quickly becoming my default, outside of absolutely required params.

6:59 carkh: yes absolutely love it =)

6:59 Raynes: vu3rdd: Note that in 1.2, we actually have default keyword arguments.

6:59 vu3rdd: It's map destructuring without the map.

6:59 vu3rdd: Raynes: yes, I have seen that.

6:59 Raynes: sexpbot uses it.

6:59 Chousuke: how did the syntax for that go again?

6:59 * vu3rdd still on 1.1. have to move to 1.2 soon

6:59 Raynes: Chousuke: Same as for map destructuring.

7:00 Chousuke: was it just & {map-form}

7:00 carkh: Chousuke: yes

7:00 Raynes: (defn func [& {:keys [omg wtf bbq] :or {omg "omg"}}] ..)

7:00 Chousuke: there aren't too many tickets left with 1.2

7:01 carkh: Raynes: i wonder what that function's doc string says ...

7:01 Raynes: "Omgs your wtf with your bbq."

7:03 * cemerick just locked my clojure and contrib snapshots to a build from Tuesday

7:04 vu3rdd: paredit slurp is really really awesome!

7:07 carkh: i eventually switched to paredit after several years, it takes a bit of time getting used to it =/

7:08 specially ctrl-arrow not doing what expected anymore

7:09 vu3rdd: switching back to arity, one problem with variable arity to handle defaults is that we need to repeat the body of the code in certain situations.

7:10 cemerick: vu3rdd: you mean with overloads? Yes -- another reason why kwargs are so much friendlier in such circumstances.

7:11 vu3rdd: hmm.

7:12 Chousuke: vu3rdd: that's why I had the idea for a defn-defaults

7:13 vu3rdd: it would be trivial to generate the extra arities in a macro

7:13 as long as you accept that (defn [foo = 1, bar, zonk = 3] ...) makes no sense

7:13 vu3rdd: Chousuke: yes, I was also thining like that.

7:14 it is a very neat idea to have a macro for that.

7:21 Raynes: carkh: The docstring is "Omgs your wtf with your bbq."

7:21 $(update-in {:wtf []} [:wtf] #(conj % "LOL"))

7:21 sexpbot: result: {:wtf ["LOL"]}

7:25 Raynes: $(update-in {:wtf []} [:wtf] conj "LOL")

7:25 sexpbot: result: {:wtf ["LOL"]}

7:25 Raynes: Cool.

7:33 SynrG: hmm

7:33 $(update-in {:wtf {:omg []}} [:wtf :omg] #(conj % "LOL"))

7:33 sexpbot: result: {:wtf {:omg ["LOL"]}}

7:34 carkh: $(update-in {:wtf {:omg []}} [:wtf :omg] conj "LOL")

7:34 sexpbot: result: {:wtf {:omg ["LOL"]}}

7:35 carkh: why mùake it hard to read ?

7:54 SynrG: carkh: good call. i didn't take suitable note of "... and any supplied args" in the doc

7:54 carkh: =)

7:56 Raynes: SynrG: Neither did I at first.

7:56 carkh: question : if i have a var cark.a/a in namespace cark.a and a var in namespace cark.b defined as (def b cark.a/a), when i recompile cark.a, the value of cark.b/b doesn't change (of course).

7:56 what would be an easy way to have the value of cark.b/b to follow the value of cark.a/a as i recompile the later

7:57 Raynes: You could reload cark.b.

7:57 SynrG: you know, clojure is so great, it's kinda depressing. because then i have to return to work on our huge, legacy codebase rife with mutable state, side-effects, and really grotty interfaces in my day job

7:57 carkh: so far i'm defining cark.b/b as this : (def b ((fn [] cark.a/a)))

7:58 but that's ugly

7:58 Raynes: i'm trying to avoid reloading

7:58 that's the whole point actually =)

7:58 _ato: that's weird

7:58 Raynes: ^

7:58 _ato: how does that help?

7:58 carkh: err actually it doesn't

7:59 but what i'm doing is make everything functions and call them

7:59 tried to simplify the example, but it was too simplified

7:59 =P

8:00 Raynes: You could use a ref. ;)

8:00 carkh: or an atom yes

8:00 but then i need to sprinkle @ everywhere

8:00 which is ugly too

8:01 what i'm trying to achieve : i don't like compojure because it doesn't scale to hundreds of pages

8:01 cgrand: carkh: (refer '[cark.a :only [a] :rename {a b}])

8:01 carkh: mhhh

8:01 Raynes: We have :rename?

8:01 carkh: let me explain further

8:02 so i have this routing system that will route the request from namespace to namespace until it reaches a page

8:02 something like this : (def top (matchers customers users))

8:03 then in another namespace (def customers (mactchers ["add" add-customer] ["list" list-customers]))

8:03 and so on

8:04 but when i make a change in customers, it won't reflect in top unless i reload the whole thing

8:04 which defeats the purpose of image based hacking =P

8:06 Raynes: If I have a sequence of functions with side-effects whose values I do not care about, what is the best way to iterate through the sequence calling them all?

8:06 (doseq [f fns] (f)) is simple enough, of course.

8:09 carkh: ,(dorun (map #(%1 %2) (repeat print) [1 2 3 4]))

8:09 clojurebot: 1234

8:09 carkh: returns nil

8:09 but yes doseq seems more appropriate

8:10 LauJensen: Raynes: doseq is better, because it implies that you're going for side-effects

8:18 cgrand: Raynes: yes doseq

8:18 Raynes: Thanks, friends. <3

8:23 AWizzArd: a nice thing could be a pdoseq

8:24 eevar2: AWizzArd: aren't side effects the whole point of doseq? how do you paralellize that?

8:25 assuming that's what you ment by p

8:25 Chousuke: AWizzArd: I think (dorun (pmap ...)) is good enough for parallel execution of side-effects :)

8:25 Raynes: Rich could parallelize two 6 ton pipes at an angle from each other with his bare hands.

8:26 Chousuke: :P

8:26 AWizzArd: Chousuke: yes, i currently use pmap for that

8:27 eevar2: the seq we traverse may be a seq of independend jobs.

8:30 spariev: so pdoseq would be basically syntactic sugar for (dorun (pmap ... ))

8:32 zakwilson: I want a function that, gives a seq and a predicate gives me a collection of the items matching the predicate and a collection of the items not matching the predicate. partition-by is almost it, but not quite

8:32 err... given a seq...

8:32 mmarczyk: there's separate in contrib, I think

8:32 ,(doc clojure.contrib.seq-utils/separate)

8:32 clojurebot: "([f s]); Returns a vector: [ (filter f s), (filter (complement f) s) ]"

8:34 zakwilson: Yes... that does what I want (and I pretty much wrote it myself already), but it calls f (or (complement f)) twice for each element, which I hoped to avoid.

8:34 carkh: ~def clojure.contrib.seq-utils/separate

8:35 ah yes it does =/

8:36 http://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/seq.clj#L42

8:37 zakwilson: It probably won't become too speed-critical. I'll go with that until I have a problem.

8:38 jacortinas: test

8:38 mmarczyk: right

8:38 well, you could (map #(vector % (f %)) your-seq)

8:39 then filter on the second item in each vector

8:39 then (map first ...)

8:39 if (f %) is really expensive to make this worthwhile

8:40 cgrand: separate aka (juxt filter remove)

8:40 ,((juxt filter remove) even? (range 10))

8:40 clojurebot: [(0 2 4 6 8) (1 3 5 7 9)]

8:40 slyphon: hello?

8:40 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline slyphon

8:41 slyphon: hah

8:41 The-Kenny: Oo

8:42 (Is hiredman just as crazy as his creation?)

8:42 mmarczyk: cgrand: that still calls even? twice per element, right?

8:43 cgrand: right

8:44 chouser: ((juxt filter remove) (memoize even?) coll)

8:44 that doesn't. :-)

8:44 mmarczyk: but surely we don't need to have a `separate' function if (juxt filter remove) is available :-)

8:45 chouser: oh, now you're making my convoluted solution look bad :-)

8:46 chouser: well, you have to be pretty careful with a plain memoize like that. can eat a lot of memory

8:46 _ato: heh, chouser's solution is also a huge memory leak though, yours is not ;-)

8:47 mmarczyk: well, I suppose, for a really large coll :-)

8:48 btw, apparently it's possible to create a function which takes 20 positional arguments *and* rest args

8:49 which then consistently returns nil without evaluating its body if applied to >= 20 args

8:49 (throws arity for less)

8:50 chouser: >= 20 literal args, right? not 'apply' with a seq of >= 20

8:50 mmarczyk: right

8:51 although it's the same with apply, just checked

8:51 _ato: ,((fn foo [a b c d e f g h i j k l m n o p q r s t & z] z) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22)

8:51 clojurebot: nil

8:52 _ato: ,((fn foo [a b c d e f g h i j k l m n o p q r s & z] z) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22)

8:52 clojurebot: (20 21 22)

8:52 _ato: interesting

8:52 chouser: not good

8:52 mmarczyk: it's the same with latest (close to latest?) checkout from github

8:52 bendlas: Hi folks

8:52 mmarczyk: someone on SO asked why Clojure limits arg number to 20, ran into this while replying

8:54 fogus: mmarczyk: Do you have a link to that SO question?

8:54 mmarczyk: I was going to write about & args, then about mixing that with 20 positional args, then had to change that to 19... haven't investigated the reasons yet

8:54 yes, sure, just a sec

8:54 http://stackoverflow.com/questions/2735600/why-is-there-a-limit-of-max-20-parameters-to-a-clojure-function

8:54 sexpbot: "Why is there a limit of max 20 parameters to a clojure function - Stack Overflow"

8:54 mmarczyk: latest one in the clojure tag

8:54 fogus: mmarczyk: thank you

8:56 vegai: anyone know how I get a new version of a MEAP book in Manning?

8:56 mmarczyk: vegai: you should receive an e-mail from Manning with a d/l link

8:56 vegai: I was going to check out if there's a later version of Joy of Clojure, but the link I got in mail is no longer valid

8:57 mmarczyk: vegai: if you don't, e-mail them

8:57 fogus: vegai: That link is only valid for 5 days

8:57 I think if you email them they will send another

8:57 (seems to have worked for others)

8:57 vegai: oh, now I see that I got the previous mail on 13th

8:57 no wonder there haven't been newer versions yet

8:58 fogus: vegai: We're hoping to have 2 more chapters out soon, but I wouldn't want to place any Vegas bets on that

9:00 vegai: righto

9:02 LauJensen: fogus: if I buy your book today, how many chapters can I read and how many are still pending ?

9:03 fogus: There are 5 chapters available right now and two more in the pipeline, leaving 5 remaning chapters (in various stages of completion)

9:03 LauJensen: ah ok ... I might just hold off for a liiitle bit longer then :)

9:04 One of my old colleagues bought Programming Clojure way too early, so he ended up having to re-read the whole thing once it was released

9:04 fogus: LauJensen: We'd love your feedback, but I can sympathize

9:05 LauJensen: Arent you guys getting a ton of feedback already fogus ?

9:05 fogus: indeed

9:06 LauJensen: Ok - If you really were in need of help I would happily pitch in, but it sounds like you guys are right on track

9:34 jacortinas: I'm wondering if I can use http-agent(in clojure.contrib) with an http proxy, anyone do anything like this?

9:35 ordnungswidrig: jacortinas: doesn't the java.net system properties work?

9:35 s/doesn't/don'/

9:35 s/'/t/

9:35 *sigh*

9:35 jacortinas: ordnungswidrig: is that really all it would take?

9:36 ordnungswidrig: I'm not sure...

9:37 Raynes: Swank is worthless with compile-time errors.

9:37 "Who needs a line number? Psh, let's just throw a bunch of random useless swank stuff into the stack-trace, and you can work with that. kthnxbai"

9:38 ordnungswidrig: it uses HttpURLConnection which should make use of http.proxyHost and http.proxyPort

9:39 Raynes: are you uptodate? For me it reports the line number

9:39 zakwilson: ,(contains '(:foo :bar) :bar)

9:39 clojurebot: java.lang.Exception: Unable to resolve symbol: contains in this context

9:39 Raynes: ordnungswidrig: Yes, I am.

9:39 1.2-SNAPSHOT.

9:39 zakwilson: ,(contains? '(:foo :bar) :bar)

9:39 clojurebot: false

9:39 zakwilson: why?

9:39 clojurebot: why not?

9:39 ordnungswidrig: Raynes: ok, I'm using clojure-1.1

9:39 Raynes: If I try to require something, and no dice, it gives me an error message and a random bunch of garbage.

9:40 ordnungswidrig: I mean 1.2-SNAPSHOT swank.

9:40 zakwilson: Silly bot... why not? Because it obviously *does* contain :bar.

9:40 ordnungswidrig: ,(doc contains?)

9:40 clojurebot: "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."

9:40 Raynes: And 1.2 Clojure, but that's irrelevant.

9:41 ordnungswidrig: Raynes: ah, yes, the require issue. It likes to report line no: 0, right?

9:41 Raynes: It reports line number nothing.

9:41 It doesn't even try to give me a line number.

9:41 zakwilson: Oh, I get it.

9:41 Raynes: Unable to resolve symbol: prepend in this context

9:41 [Thrown class java.lang.Exception]

9:41 And that's it, besides the worthless stacktrace. :p

9:41 ordnungswidrig: Raynes: or like that

9:42 Raynes: java -jar clojure.jar mybrokenscript.clj will do better?

9:43 Raynes: Yeah, I can track it down. It's just annoying sometimes. :<

9:43 ordnungswidrig: C-c C-k also does better reporting than C-c C-l

9:44 Raynes: I usually use that, but I'm not using either at the moment. My code loads all of the plugins whenever I use sexpbot.run.

9:52 That's weird.

9:52 paredit-mode randomly disabled.

9:52 stuartsierra: ohai

9:52 stuartsierra: hi

9:55 vu3rdd: stuartsierra: the dotrace procedure you wrote in the c.c.trace is really nice. Very helpful to me. Thanks for that.

10:01 stuartsierra: wu3rdd: you're welcome

10:01 actually, I think someone else added dotrace after I wrote the original lib

10:06 vu3rdd: stuartsierra: oh.. ok

10:06 JoC new MEAP has arrived!

10:07 Chousuke: it has? where's my mail :(

10:07 * vu3rdd downloading TJoC

10:07 The-Kenny: Chousuke: Mine hasn't arrived yet too

10:07 vu3rdd: May be the electrons travel faster to India. :-)

10:07 The-Kenny: *Hitting Refresh in Gmail"

10:08 vu3rdd: There was the case of the 300 Mile Email

10:08 vu3rdd: :-)

10:08 The-Kenny: Some strange stuff with timing etc. which prevented emails from going farther than 300 miles

10:08 spariev: Postmen these days ...

10:08 vu3rdd: 7 chapters now

10:08 ch 6 functional programming and ch 7 macros

10:08 The-Kenny: http://www.csua.berkeley.edu/~ranga/humor/500_mile_email.txt There it is

10:09 Ok, looks down. Here's a mirror if someone is interested: http://www.ibiblio.org/harris/500milemail.html?

10:09 sexpbot: "The case of the 500-mile email"

10:11 vu3rdd: When is the next MEAP? The last sentence of ch 7 says: "In the next chapter we will cover various powerful way to organize and categorize data types and functions using Clojure's namespaces, multimethods, types, and protocols."

10:11 "

10:21 kzar: If you have something like this {:dumb "example"}, how do you destructure it to the key and value without knowing what the key is?

10:22 cYmen_: Does anybody know of sample code or tutorials on image processing using clojure?

10:22 mmarczyk: kzar: you don't

10:23 kzar: mmarczyk: Well how would I get the key and the value out of something like that without destructuring?

10:23 LauJensen: cYmen_: define 'processing'

10:24 mmarczyk: kzar: I'm not sure what you mean by that, but...

10:24 ,(seq {:dumb "example"})

10:24 clojurebot: ([:dumb "example"])

10:24 cYmen_: LauJensen: Read image from $foo invert save to $bar...

10:24 mmarczyk: you can map a function across a map

10:24 if you need to process entries one by one

10:25 then you get [key value] pairs

10:25 LauJensen: cYmen_: I suggest you check out the ImageIO class which lets you read the image and work on the graphics context, then save it again, should be only a few lines

10:25 $google Best In Class Tribute to Steve Ballmer

10:25 sexpbot: First out of 1650 results is:

10:25 My tribute to Steve Ballmer | BEST IN CLASS

10:25 http://www.bestinclass.dk/index.php/2010/02/my-tribute-to-steve-ballmer/

10:25 kzar: mmarczyk: Sweet doing seq on it is a good idea, that lets me do what I wanted. Thanks

10:25 spariev: horaay for JoC, received my MEAP letter :)

10:25 LauJensen: I think I do almost that in this post, only I dont invert the colors but scale it @ cYmen_

10:25 mmarczyk: LauJensen: that was one seriously cool blog entry! :-)

10:25 LauJensen: mmarczyk: Thanks! :)

10:25 mmarczyk: kzar: hth :-)

10:26 (as in happy th)

10:26 eevar2: cYmen_: and do have a look the java2d api docs

10:26 cYmen_: LauJensen: Thanks.

10:26 eevar2: and tutorial

10:26 cYmen_: eevar2: and to you, too.

10:26 esj: hooray - Fresh MEAP !

10:36 Chousuke: ooh, now I got mine too

10:39 bsteuber: me not yet *sniff*

10:42 cYmen_: meap?

10:43 pjstadig: everytime i see meap i think they missed out by not calling it the Manning Early Access Trial

10:44 LauJensen: pjstadig: they actually tried that when ...

10:44 ~suddenly

10:44 clojurebot: CLABANGO!

10:45 djpowell: do manning nicen up the typesetting a bit before release?

10:45 pjstadig: clojurebot: meap is manning missed the opportunity to call it Manning Early Access Trial

10:45 clojurebot: 'Sea, mhuise.

10:45 pjstadig: ~meap

10:45 clojurebot: meap is manning missed the opportunity to call it Manning Early Access Trial

10:45 pjstadig: bah

10:45 been too long since i've instructed clojurebot

10:46 chouser: djpowell: I hope so. At least move the footnotes to the bottom of the page...

10:47 fogus: djpowell: I believe they have a more formal layout process for the printed book.

10:48 djpowell: how do I do clojure patches? I posted #300 a while ago re newlines, but i worry I've made some patch process faux pas.

10:49 do i have to post the mailing list about the patch before i create a ticket?

10:49 stuartsierra: that is preferred

10:50 http://clojure.org/patches

10:52 djpowell: hmm, actually I did post back in november

11:00 Raynes: Shuffle is in core now? Cool.

11:02 bsteuber: oh, didn't know about the /patches documentation

11:03 would have kept me from doing things in a silly order :)

11:06 stuartsierra: so how are people supposed to find the clojure.org/patches page?

11:06 wthidden: stuartsierra: why does json/read return 0 for an element that is an empty string?

11:07 cgrand: stuarthalloway: looking at your patch for :added in vars metadata, no :added "1.0"?

11:07 stuarthalloway: cgrand: true

11:07 rich wanted to leave that implicit

11:09 cgrand: stuarthalloway: ok, so I guess the policy is to tag all new vars with :added as soon as they are created.

11:10 stuarthalloway: cgrand: as soon as they are public and have a docstring

11:10 which of course requires creation :-)

11:10 example corner case: definterface

11:11 it is public, but not doc'ed or metadata'ed yet

11:12 djpowell: by public, do you mean not-private or publicised?

11:13 stuartsierra: bsteuber: dunno

11:13 djpowell: is this to avoid clashes between clojure.core and your code?

11:13 stuartsierra: wthidden: dunno, maybe that's a bug, got a test case?

11:16 djpowell: i like cgrand's :as suggestion

11:17 cgrand: I'm trying to figure out the rules for adding :as-of in refer..., if nil means "1.0" and below, definterface will be refered even when refering core :as-of "1.1"

11:18 djpowell: i guess it would require even non-publicised vars in core to be given an :added tag

11:19 cgrand: should I check :doc too?

11:19 djpowell: which I don't think should be a big problem?

11:20 I think var polution will be a problem in clojure if we don't do something

11:21 chouser: this is strictly about var-existence, right? If the behavior or arglist of a fn changes, that won't be reflected in the metadata at all?

11:21 djpowell: i wonder who it will benefit though?

11:22 cgrand: only about preventing nameclashes

11:22 djpowell: if you are going to the trouble of adding :as-of tags to your code, then you could probably fix the nameclash at the same time

11:24 I got bitten by char-array in 1.1, cause I'd already created my own char-array function for 1.0

11:24 cgrand: for example Enlive is designed for 1.1 but worked fine with clojure 1.2 until the addition of flatten

11:26 djpowell: even C has some namespacing of global functions via _ prefixes to prevent compiler supplied functions from clashing with user ones

11:32 rhickey: stuarthalloway, cgrand : changed my mind on "1.0", I think it will be more useful with it

11:33 cgrand: definterface is due for a docstring and then a "1.2" designation

11:33 stuarthalloway: rhickey: ok

11:43 cgrand: rhickey: ok, so all vars listed here http://gist.github.com/383775 should not be referred?

11:45 rhickey: cgrand: other than definterface, they all look like implementation details to me, yes

11:46 cgrand: ok, thanks

11:53 Raynes: Who was it that asked me to combine the first and second lines of $google results?

11:53 Anyways

11:53 $google omg

11:53 sexpbot: First out of 6190000 results is: omg! Celebrity gossip, news, photos, babies, couples, hotties, and ...

11:53 http://omg.yahoo.com/

11:55 cburroughs: Is there a clojure json library that can handle unquoted keys?

11:57 heh, google tells me I asked that here on 2009-12-09 and apparently did not find one

11:59 hiredman: cburroughs: you know thats not valid json, right?

12:00 cburroughs: oh yes, I want to read it, not write it

12:02 cemerick: cburroughs: sounds like you want to use rhino's eval or somesuch

12:13 cburroughs: cemerick, that is a special mixture of crazy and genius

12:14 cemerick: cburroughs: which?

12:15 cburroughs: I'll tell you after I get it to work

12:15 cemerick: heh

12:16 chouser / rhickey: any chance "non-eager" AOT-compilation will make it into 1.2?

12:17 rhickey: cemerick: what's that?

12:17 cemerick: hrm, right, sorry

12:17 chouser: cemerick: you mean some way to turn off AOT for some 'require'd namespaces?

12:17 cemerick: rhickey: this, although it was filed in contrib for some reason: https://www.assembla.com/spaces/clojure-contrib/tickets/23

12:17 sexpbot: "#23 - Clojure AOT compilation will compile unwanted classes (Invalid) | Clojure Contrib | Assembla"

12:18 cemerick: chouser: or, better, have AOT performed only for explicitly-named libs

12:19 rhickey: cemerick: no

12:19 cemerick: bummer

12:20 rhickey: wasn't even on the radar, and we're trying to wrap up

12:20 cemerick: rhickey: Sure -- I just thought of it, and figured I'd see if it was on the table. Are you sympathetic to the issue for future?

12:20 the* future, that is

12:21 rhickey: cemerick: yes, also want to tackle the generated names, now we have the possibility of stable, e.g. function names

12:21 cemerick: OK; I'll file a ticket for it in the clojure assembla.

12:22 I'm going to start lobbying to have source distributions become the norm for clojure-maven-plugin-based builds. If this issue could be resolved, that would eventually make things a lot easier w.r.t. distribution concerns.

12:23 technomancy: btw, ticket #315 would help quite a bit for reducing dependence on AOT

12:23 and it's only 7 lines

12:23 (for stuff that is intended for CLI usage at least)

12:25 cburroughs: cemerick, I'm sticky with both: (.eval e (slurp* "http://www.matsblog.com/static/matsblog/files/JSON-js-prettyPrint.js"))

12:25 (read-json (.eval e "eval({foo:1}).toJSONString()"))

12:25 {"foo" 1}

12:25 chouser: #315 is also an nice reduction in the need to use gen-class. is good!

12:25 cemerick: cburroughs: ah, glad it worked out for you :-)

12:26 technomancy: ticket #315

12:26 stuartsierra: For lazytest: what do people think of having assertions inside a vector, like pre/post conditions?

12:26 chouser: hope that's trustworthy input

12:26 cemerick: cburroughs: though, do you need the round trip through JSON? Surely rhino's eval returns a java.util.Map given a js object literal.

12:26 technomancy: ~ticket #315

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

12:29 cburroughs: cemerick, I get #<NativeObject [object Object]>

12:33 tomoj: not sure where this question really belongs, but..

12:33 if I 'sudo su', then run 'lein clean', it works fine

12:33 if I sudo sh -c 'lein clean' it complains that leiningen is not installed

12:33 I'm assuming this is an environment variable thing

12:33 slyphon: PATH

12:34 tomoj: not PATH, the error comes from lein

12:34 slyphon: hrm

12:34 tomoj: it's the "Leiningen is not installed. Please run "lein self-install"."

12:34 cemerick: cburroughs: I don't know jack about rhino, but it looks like NativeObject (or its superclasses?) has a .getIds and a .get(id-name, object) method...using those would surely be better than str -> eval -> json-string -> eval -> read-json

12:34 tomoj: it is installed, in /root/.m2

12:34 slyphon: one is running with root privs as your user

12:34 i.e. your $HOME is the same

12:34 tomoj: right

12:34 slyphon: the other is actually running *as* root

12:34 tomoj: so which env var does lein care about, I wonder

12:34 slyphon: $HOME, i'll bet

12:34 sexpbot: Command not found. No entiendo lo que estás diciendo.

12:34 tomoj: oh, of course

12:35 cemerick: cburroughs: http://stackoverflow.com/questions/2559450/rhino-how-to-get-all-properties-from-scriptableobject

12:35 tomoj: well, except...

12:35 sexpbot: "Rhino: How to get all properties from ScriptableObject? - Stack Overflow"

12:35 tomoj: there's no ~me/.m2

12:35 cemerick: cburroughs: though, watch out for the .toString that guy is using on the return from .getProperty

12:35 slyphon: hum

12:35 cburroughs: interesting

12:35 stilkov_: send (on agents) and swap! (on atoms) inside a dosync get invoked only if the transaction is successful

12:35 tomoj: there is a /root/.m2 though

12:35 stilkov_: where is this documented?

12:35 slyphon: why are you running lein as root, anyway?

12:36 tomoj: I don't know a better way to do it yet

12:36 slyphon: that's a "shell script" you "downloaded off the internets"

12:36 tomoj: what I really want is a systemwide install

12:36 cburroughs: I find it ironic that so many hoops need to be jumped through to get javascript to have decent json support

12:36 tomoj: yeah, I trust technomancy though :)

12:36 slyphon: heh

12:36 and somewhere, a unix sysadmin loses his wings

12:36 tomoj: maybe I should just have all this clojure build stuff happen offline

12:37 I have hudson set up already, it can run the build and drop artifacts in S3

12:37 stilkov_: I don't really mean invoked, I meant the functions passed to them get executed

12:37 I can't seem to find this documented in the official documentation

12:37 tomoj: ... except the output of my build is mixed in with my source checkout because it's solr :(

12:38 maybe I need to use maven

12:38 chouser: a rhino NativeObject is apparently not at all a java.util.Map

12:38 slyphon: how would you say Object[] in clojure?

12:38 cemerick: Yeah, it's too bad that there's no easy way to get there.

12:39 chouser: roundtripping through another json reader is surely not necessary, but probably the shortest path to a correct solution.

12:39 * slyphon needs to pass that to wall-hack-method

12:39 cemerick: chouser: I'm guessing it's a quick (into {} (for ...))) away.

12:40 slyphon: or, i need to know how to call a varargs via wall-hack

12:40 chouser: yes, plus recursion, key-type coersion...

12:40 cemerick: cburroughs: FWIW, unquoted keys are not JSON.

12:40 xeqi: ,(into-array Object [])

12:40 clojurebot: #<Object[] [Ljava.lang.Object;@12a5896>

12:40 slyphon: xeqi: that's an instance

12:40 i guess

12:40 cburroughs: I meant the "toJSON" part of javascript support

12:40 slyphon: ,(class (into-array Object []))

12:40 clojurebot: [Ljava.lang.Object;

12:41 slyphon: "ew"

12:46 tomoj: slyphon: you were right, it's $HOME

12:46 slyphon: yay!

12:47 tomoj: when you sudo sh -c '...', $HOME is your user's home

12:47 when you sudo su, it's /root

12:47 it looks like lein doesn't respect M2_HOME though..

12:47 or maybe I misunderstand M2_HOME's purpose

12:48 chouser: I'm so looking forward to Clojure's built-in abstractions being protocols.

12:49 stuartsierra: chouser: me too

12:49 chouser: (extend-class NativeObject PersistentMap ...)

12:49 cemerick: tomoj: isn't M2_HOME only used by the mvn bootstrap scripts?

12:50 * slyphon facepalms

12:50 slyphon: variadic args are really crap in java

12:50 cemerick: FYI: http://www.assembla.com/spaces/clojure/tickets/322

12:50 sexpbot: "#322 - Enhance AOT compilation process to emit classfiles only for explicitly-specified namespaces (New) | Clojure | Assembla"

12:51 stuartsierra: chouser: would that work if NativeObject were mutable?

12:51 tomoj: cemerick: you're probably right

12:51 I just guessed from the name

12:52 that M2_HOME would point to wherever your .m2 is

12:52 it always looks in $HOME/.m2, I guess?

12:52 chouser: stuartsierra: yeah, you'd just have to implement COW

12:52 cemerick: by default, yeah

12:52 stuartsierra: chouser: or choose a less restrictive protocol, like Associative

12:52 chouser: good point

12:54 cemerick: chouser: bleh, I *totally* forgot about the clojure.xml/emit patch you tasked me to bundle up. (http://www.assembla.com/spaces/clojure/tickets/277) Is that something you want to fold in to 1.2?

12:54 sexpbot: "#277 - Making clojure.xml/emit a little friendler to xml consumers (New) | Clojure | Assembla"

12:54 npoektop: hi! how to use clojure.contrib.http.agent with ssl? i want to do (http-agent "https://..." ...)

12:55 stuartsierra: npoektop: I think you need supporting SSL libraries for Java.

12:55 Or a better HTTP client, like Apache's.

12:56 npoektop: supporting libraries?

12:56 stuartsierra: SSL libraries

12:56 SSL is a pain almost everywhere, including Java.

12:57 npoektop: how to get and use them?

12:57 stuartsierra: no idea, sorry

12:58 Try the Apache HTTP client, it may have built-in support.

12:59 cemerick: npoektop, stuartsierra: the JRE includes a perfectly well-functioning SSL HTTP client.

13:00 chouser: zipmap still doesn't use transients

13:01 mmarczyk: any reason in particular why seq-contains? isn't defined as (fn [coll x] (some #(= % x) coll)), without the if?

13:01 (looking at the newly promoted functions...)

13:02 ahhh

13:02 ,(some #(= % 5) [])

13:02 clojurebot: nil

13:03 mmarczyk: right.

13:05 chouser: http://gist.github.com/383892 -- includes at least 50% premature optimization!

13:07 cburroughs, cemerick ^^^

13:08 tomoj: cemerick: on the one that's in the JVM, don't you have to do funky stuff with certs?

13:08 at least for ssl sockets

13:09 cburroughs: oh my

13:10 mmarczyk: chouser: 1s/set/set!/ :-)

13:10 cemerick: chouser: nice :-)

13:11 chouser: mmarczyk: oh no!

13:11 cemerick: everyone: FYI, there's a good chance that if you talk about some work you're doing, chouser will just do it for you. ;-)

13:11 chouser: heh. not a reputation I need. I deny it!

13:11 mmarczyk: cemerick: spot on :-D

13:12 chouser: huh, I thought extend-protocol would hint my arg for me

13:18 oh, of course it's the calls in the inner fn that aren't hinted. bleh.

13:19 there, that's better: http://gist.github.com/383892

13:19 now, really, back to work...

13:25 abedra: technomancy: you around?

13:26 technomancy: I have some time today to tackle the leiningen exit code issue and wanted to see if you had started any work on it yet

13:28 stuartsierra: Does swank-clojure-binary work with current swank-clojure?

13:29 tomoj: abedra: lein test exit code? or is there another problem?

13:29 abedra: tomoj: that's the one

13:40 cemerick: tomoj: you shouldn't have to mess with any certs to use the JRE's SSL client -- at least in JDK 1.4+ -- I think you might have had to do something special to enable SSL in 1.2 or 1.3.

13:40 e.g. (slurp* "https://paypal.com") works just fine.

13:43 joshua-choi: I'm looking at the promoted seq functions. What is the difference between the intended uses of keep-indexed and map-indexed?

13:47 technomancy: abedra: no, I haven't had a chance to look into it. would be great if you could; thanks.

13:48 tomoj: cemerick: oh, just ssl sockets then, maybe

13:48 technomancy: stuartsierra: it should, but I don't know if anyone uses it, so there's a decent chance it's bitrotten

13:48 tomoj: I was looking into not-yet-commons-ssl

13:48 cemerick: tomoj: you mean if you were going to implement an ssl sever?

13:48 server*

13:49 tomoj: I mean for example doing APN

13:50 no server, just open a socket to some server over ssl

13:50 I read there's something funky you have to do to use what's in the jvm

13:50 cemerick: tomoj: is that not what https is doing?

13:50 says cemerick, exposing his ignorance...

13:50 tomoj: isn't it?

13:51 but there's something funny

13:51 cemerick: tomoj: what's APN, btw? http://en.wikipedia.org/wiki/Access_Point_Name ?

13:51 sexpbot: "Access Point Name - Wikipedia, the free encyclopedia"

13:51 tomoj: apple push notification

13:51 cemerick: ah

13:51 tomoj: you have to open an ssl socket with some cert and push raw bytes

13:52 abedra: technomancy: cool, just forked and started digging in. When you create the java task i don't see where you would set failonerror=true

13:52 tomoj: but I just found a java project for it, so I will just do whatever they do

13:52 abedra: technomancy: that would make ant exit non zero if the tests didn't pass

13:52 but i'm looking further

13:52 replaca: technomancy: does swank work with the latest clojure 1.2? I thought I saw something yesterday that indicated that it might not.

13:53 cemerick: tomoj: if you're going to use "unlimited" strength ciphers, you do need to install the appropriate policy files in order to get those (e.g. 256-bit AES, etc)

13:53 tomoj: and what do you with the cert?

13:53 technomancy: replaca: it should be fixed, yeah

13:53 replaca: technomancy: do I need to pull a new one then?

13:53 cemerick: tomoj: well, the policy files are essentially orthogonal to certificates

13:54 technomancy: replaca: the fix is on clojars; that would be the easiest

13:54 replaca: technomancy: got it. thanks!

13:54 Raynes: technomancy: Ohai, philjure.

13:54 :D

13:54 technomancy: ...!

13:55 cemerick: tomoj: if you download this, you'll find info about them in the readme: https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jce_policy-6-oth-JPR@CDS-CDS_Developer

13:57 tomoj: cemerick: I'm just going to save that link and hope I don't have to look at it

13:57 :)

13:57 cemerick: yeah

13:58 it's absolutely *absurd* that those policy files aren't the default yet

13:58 the export controls were lifted like, 3 years ago

13:58 * technomancy coughs *openjdk*

13:58 cemerick: ha

13:59 technomancy: only if I absolutely had to, but yeah.

13:59 * abedra cries

13:59 technomancy: I have yet to see with my own eyes a difference between openjdk and sun's. I've heard stories, but I require empirical proof.

14:01 cemerick: they're different codebases, so I take it as a given that there are differences. *shrug*

14:01 rcg: technomancy just as you mention it .. i have to use some strange client application for a kvm switch which refuses to run with icedtea but runs with sun-jdk ..

14:02 technomancy: rcg: bah, hearsay. I'll believe it when I see it.

14:02 =)

14:02 cemerick: hrm, right, I remember now: glassfish v2 wouldn't run with openjdk, but did just fine under sun's

14:02 rcg: hehe

14:03 cemerick: 'course, that could be bad packaging for ubuntu's openjdk, but that was enough of an experience. :-)

14:05 abedra: technomancy: are there expected failures in the test suite for -stable?

14:05 LauJensen: I've been burned badly by openjdk as well

14:11 slyphon: hiredman: hey, is that colorized paren thing for emacs you were talking about "cparen"?

14:22 stuartsierra: does gist.el work?

14:22 slyphon: stuartsierra: i was wondering the same thing

14:22 stuartsierra: I get "Symbol's value as variable is void: login"

14:22 headius: cemerick: they're the same codebase

14:23 some devs still use internal working copies, but it all pushes to the openjdk repos

14:23 * slyphon waves to headius

14:23 cemerick: headius: well, now they are, but not for JDK 6

14:23 ?

14:23 headius: there's not much difference between 7 and 6

14:23 recent updates of 6 have invokedynamic bits hidden in them

14:24 just disabled

14:24 cemerick: hrm. Maybe it's all in the packaging. *shrug*

14:24 headius: there's only a few months lag between the hotspot that's in 7 and what gets into current 6 updates

14:24 cemerick: in any case, it's hard to argue with installing sun-java-6, and then having everything work after a couple hours of pain :-)

14:25 headius: we get almost weekly reports against our openssl library because of those missing policy files

14:25 cemerick: headius: is that going to be resolved for JDK 7?

14:25 or better, a JDK 6 update...

14:25 headius: beats me

14:25 it would be nice

14:28 hiredman: slyphon: rainbow-paren-mode

14:28 slyphon: yeah? i couldn't find that

14:28 i found highlight-paren-mode

14:28 hiredman: best bet may be searching clojurebot's url log

14:28 slyphon: which does colorization based on the position of the point

14:28 kk

14:28 ty

14:29 hiredman: http://delicious.com/search?p=rainbow&chk=&context=userposts%7Cclojurebot%7C&fr=del_icio_us&lc=0

14:29 sexpbot: "Search results for rainbow on Delicious"

14:29 slyphon: ooh

14:30 thanks :)

14:35 tcepsa: If I have a Clojure namespace with :gen-class that I compile into Java classes, and that namespace also depends on other namespaces (which don't have :gen-class), it looks like the other namespaces get compiled into classes as well. Is that correct?

14:36 (depends on == :requires)

14:36 chouser: tcepsa: yes, though it has nothing to do with :gen-class

14:37 tcepsa: All right, so far so good (though I'd like to know more about what it does have to do with, if not :gen-class, I think that's tangential to my actual question)

14:38 karchie: I just wrote a function take-after [xs x], which returns the subsequence of xs starting after the first appearance of x (or nil if x isn't found). is there a core (or contrib) equivalent that I should have seen but missed?

14:39 tcepsa: My actual question is if I then change one of those namespaces that the first namespace :requires and recompile the first namespace, the changed namespaces do not appear to be recompiled. Is that a bug, and is there something else that I have to do to force the changed namespace to recompile?

14:39 cemerick: tcepsa: AOT compilation occurs any time a namespace is loaded, and the flag that controls AOT is thread-bound, so transitively-loaded namespaces get caught up in the compilation when they're :require'd

14:39 tcepsa: are you doing this interactively in a REPL?

14:40 tcepsa: cemerick: I am calling (compile 'namespace

14:40 ) in a REPL, yes (sorry about the extra linebreak!)

14:40 cemerick: tcepsa: right -- so, the namespaces required by your top-level namespace are already loaded at that point, so they won't get AOT-compiled.

14:40 chouser: ,(next (drop-while #(not= 4 %) (range 10)))

14:40 clojurebot: (5 6 7 8 9)

14:40 chouser: karchie: ^^^

14:41 abedra: technomany: soooooooo close, just need a way to *actually* do the exit

14:41 karchie: chouser: there it is, drop-while. thanks much

14:42 cemerick: tcepsa: if you add a :reload-all to your :require in the ns declaration, then the dependency(ies) should be reloaded when you call compile

14:42 (I think)

14:43 tcepsa: cemerick: Ah, okay, thanks--and I may have spoken too soon, as it looks like the classes for the :required namespace were actually recompiled, but it just took a couple of minutes for that to happen. I'll experiment with it a bit more, and I'll try that

14:44 :reload-all flag as well

14:44 cemerick: tcepsa: AFAIK, compiling interactively is quite atypical

14:44 You really want to have a tool do repeatable builds for you, e.g. maven or lein

14:45 tcepsa: cemerick: Ahh, yeah, that makes sense. How is Lein for Windows at this point? I've shied away from it so far because I thought I saw something that said it wasn't really stable.

14:46 cemerick: tcepsa: No idea. I'm of the maven persuasion. :-)

14:46 tcepsa: (And I'm completely unfamiliar with Maven. If I have to learn it for this project I will, but it doesn't seem like this is complicated enough to really require something that involved)

14:47 (At least I get the impression that Maven is involved. Perhaps that is a misconception on my part as well.)

14:47 cemerick: It's pretty simple to get started with IMO, but you'll find a lot of disagreement there.

14:48 tcepsa: All right, I'll have a look at both of them and see whether I can get it working. Thanks!

14:48 cemerick: tcepsa: here's a summary of my perspective, entirely FWIW: http://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer

14:48 sexpbot: "Why using Maven for Clojure builds is a no-brainer - Chas Emerick - Muck and Brass"

15:01 stuartsierra: Starting to think a real I/O library should use java.nio instead of java.io.

15:02 chouser: sounds right

15:02 danlarkin: io and nio have different use cases I think

15:02 stuartsierra: nio is lower-level

15:02 chouser: I've got a pile of code here using java.io and a sneaking suspicion it would be a good deal better on nio abstractions instead

15:03 danlarkin: nio is async, so when that's not what you want, you don't want nio

15:03 chouser: nio has sync methods

15:04 http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html#read(java.nio.ByteBuffer)

15:04 sexpbot: "FileChannel (Java Platform SE 6)"

15:04 chouser: returns number of bytes read.

15:05 stuartsierra: The combination of asynch I/O and Clojure's thread protections might be very powerful.

15:06 danlarkin: maybe I misjudged nio

15:06 arkahn: has anybody seen an async way to 'tail' a file (e.g. a logfile) in a separate thread? If not, I think I'll write one

15:11 abedra: technomancy: We've got something that is "working" http://gist.github.com/384079 but I fear that we've missed something here

15:11 especially with shutdown-agents

15:12 can you take a quick look and tell me what is wrong?

15:14 arohner: stuartsierra: what kind of shape is clojure-rdf in?

15:15 stuartsierra: none

15:15 it is unfinished, unmaintained, and unloved

15:15 arohner: stuartsierra: hah, ok. thanks

15:15 stuartsierra: np

15:16 I need to flag most of my github projects as "disowned"

15:16 slyphon: as a general rule, when you have multiple arities of a function providing default values, should you "call your way up the chain"?

15:17 chouser: slyphon: not necessarily, though that removes duplicated default value.

15:17 * slyphon nods

15:17 chouser: Other than that, not much wrong with just calling the real implementation.

15:18 slyphon: k

15:19 chouser: depending on various factors, it's often nicer to just use destructuring and a single arity. (fn [a & [b c d]] ... (or b 25) ... (or d "hello")...)

15:19 slyphon: hmmm

15:20 i hadn't thought of that

15:20 destructuring the & more

15:20 LauJensen: chouser: Doesn't that go directly against the code-standard which says its better to unroll args ?

15:20 slyphon: interesting :)

15:20 chouser: LauJensen: heh, could be. where is that doc again?

15:20 LauJensen: assembla I think

15:21 chouser: http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards

15:21 sexpbot: "Clojure Library Coding Standards | Clojure | Assembla"

15:21 LauJensen: hmm

15:21 Unroll optional named arguments. Callers should not have to wrap optional named arguments in a map literal:


15:21 (release-sharks 2 :laser-beams true) ; good (release-sharks 2 {:laser-beams true}) ; bad

15:22 tcepsa: Is there a way to read in data structures (e.g. vectors or maps) from some kind of config file at runtime?

15:22 chouser: LauJensen: that's not what I'm talking about

15:22 LauJensen: chouser: oh, sorry

15:22 chouser: the only item that may apply is "only destructure in the arg list if you want to communicate the substructure as part of the caller contract"

15:23 slyphon: yeah, i was just using this

15:23 chouser: which is related, but doesn't advocate exclusively one way or the other.

15:23 slyphon: er, reading this

15:23 LauJensen: $(read-string "{:one 1 :two 2}")

15:23 sexpbot: result: {:one 1, :two 2}

15:23 LauJensen: @ tcepsa

15:23 slyphon: hmm

15:24 tcepsa: Perfect!

15:24 slyphon: if *blah* is only meant for rebinding, is there a convention for vars that are meant to be constants?

15:24 chouser: slyphon: yep. all lower-case, dash-separated words.

15:25 slyphon: oh

15:25 cemerick: I like the +constant+ convention

15:25 chouser: for example: clojure.core/drop-last is a constant. don't change its value to some other function please.

15:25 cemerick: most others don't, I suppose

15:25 slyphon: heh

15:25 cemerick: is that CL?

15:25 cemerick: slyphon: I think that's its origin, yeah.

15:26 * slyphon has seen that somewheres

15:26 * slyphon nods

15:26 cemerick: Though I'm no CL expatriot. :-)

15:26 I just like to distinguish what are really, honestly constants, vs. fns and other defs that you *could* rebind if you needed to.

15:27 * chouser occasionally rebinds +pi+ for fun.

15:28 chouser: there are some interesting non-Cartesian maths out there!

15:29 abedra: chouser: others have tried http://en.wikipedia.org/wiki/Indiana_Pi_Bill

15:29 sexpbot: "Indiana Pi Bill - Wikipedia, the free encyclopedia"

15:29 pjstadig: I might like the +constant+ convention more if there was actually a way to make constants

15:31 LauJensen: Clojure: The Lisp that makes Perl dynamic

15:31 cemerick: defonce should probably have prevented rebinding

15:31 pjstadig: not only for constantness, but also for speed

15:31 like symbol macros or something

15:32 cemerick: well, direct linking is already there, although I don't know how to use it.

15:32 pjstadig: yeah i may be out-of-date...ignore me

15:34 chouser: direct linking isn't yet available for general use

15:34 technomancy: no, pretty sure you can't opt-in to direct linking

15:34 cemerick: ah, I thought it was floating around in there somewhere

15:34 technomancy: even so you can always with-ns+redef

15:34 slyphon: LauJensen: huh?

15:34 technomancy: not to mention alter-var-root

15:35 LauJensen: slyphon: Just saying, you and me read -> ->> -?> @ #() % etc as plain english, but new-comers will stumble

15:35 slyphon: ah

15:35 indeed

15:36 a little confusion is good every once in a while

15:46 remleduff: rhickey: Hi, was just reading irc logs and saw you mention that you were hoping to wrap up 1.2 soonish. Was hoping you could look at ticket #317, it was driving me batty having my repl unexpectely quit like that while debugging a 3rd party library.

15:48 technomancy: abedra: sorry, headed off for a while; will try to look at that tonight.

16:52 wthidden: Is there a known issue with partial in the latest clojure build?

16:54 chouser: I've not heard of one

16:55 wthidden: hmm the issue is as follows

16:56 i have a function x that takes 3 args so I make a partial of it and supply 2 args so i get a function taking one arg.

16:56 abedra: technomancy: no worries

16:56 wthidden: but the issue may be that within this function x I make another partial

16:57 that is this the current function, sorta of a self-reference partial.

16:57 it used to work, pre-1.2

16:58 chouser: wthidden: can you paste a small example that generates the error?

16:58 clojurebot: api examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples

16:58 wthidden: no blows up NoClassDefFoundError

16:58 sure

16:58 to where should i paste?

16:59 chouser: http://paste.lisp.org/new/clojure

17:01 hiredman: fyi, http://delicious.com/clojurebot/pastbin

17:01 sexpbot: "clojurebot's pastbin Bookmarks on Delicious"

17:02 technomancy: chouser: I wonder if you could get lisppaste back in here if you set it so unregistered nicks weren't banned

17:02 chouser: technomancy: ooh! could be...

17:02 Or if lisppaste8 registered itself

17:02 I have the authority to do neither.

17:03 wthidden: http://paste.lisp.org/+241S

17:03 technomancy: oh, you can't change the channel policy just by being an op?

17:03 wthidden: is the paste

17:03 chouser: I don't have op.

17:03 technomancy: oh, bummer

17:03 chouser: I had it for a few days, but whoever gave it to me apparently did it manually rather than through ChanServ, so next time I logged out I lost it.

17:04 technomancy: =\

17:04 chouser: wthidden: thanks, but that refers to several unreferred vars

17:05 wthidden: oops

17:05 ok..

17:07 hmmm here is the def for substitute-sym http://paste.lisp.org/+241T

17:08 chouser: wthidden: do you get the error if you just leave out that call? the smaller the example, the easier it will be to find the problem.

17:08 wthidden: hmmm trying to make it smaller.

17:08 chouser: thanks

17:09 wthidden: so what is somewhat strange is the i can call resolve-task-symbols fine

17:10 and i think it creates a partial of itself without issue.

17:10 but the closer i look at the def it may not call the parital with the test data i give it.

17:13 when test data is a sequence gives the same error.. working on a simpler example.

17:14 arohner: is there another way to create the symbol "^" aside from (symbol "^")?

17:15 \^ doesn't seem to work

17:15 or '^

17:15 chouser: arohner: that's not a valid symbol

17:16 arohner: so then why does (symbol "^") work?

17:16 chouser: 'symbol' is overly permissive

17:16 arohner: chouser: ok, thanks

17:17 chouser: ,(read-string (pr-str (symbol "(+ 2 3 4)")))

17:17 clojurebot: (+ 2 3 4)

17:17 arohner: nice

17:17 chouser: ,(read-string (pr-str (symbol "foo")))

17:17 clojurebot: foo

17:17 chouser: ,(read-string (pr-str (symbol "^")))

17:17 clojurebot: java.lang.RuntimeException: java.lang.Exception: EOF while reading

17:18 chouser: that a somewhat better way to check, though really you're only safe using the chars listed at http://clojure.org/reader

17:24 wthidden: ok how about this paste: http://paste.lisp.org/+241X

17:24 unlink: am I missing something here? (reify IFoo (bar ([] 0) ([a] 1)))

17:24 Why can't I do this?

17:27 wthidden: chouser: i have to go catch the train.. will be back in a few hours.. maybe anotate will work, maybe not.... I'll restate my issue at a later date.

17:28 chouser: wthidden: ok

17:29 wthidden: that last paste produces your error?

17:42 remleduff: Why is it read-"string" and pr-"str"?

17:42 Vowel shortage?

17:44 ,(read-string (pr-str (symbol "\u2038")))

17:44 clojurebot:

17:45 remleduff: ,(read-string (pr-str (symbol "\u02c4")))

17:45 clojurebot: ˄

17:45 remleduff: So many hats

17:51 unlink: ,(reify Object (toString [] ""))

17:51 clojurebot: java.lang.Exception: Unable to resolve symbol: reify in this context

17:57 DavideAngelocola: hi all

17:58 unlink: ah. reify is different from proxy.

18:01 DavideAngelocola: I'm trying to use swank with maven but .. http://gist.github.com/384329

18:01 any idea?

18:07 remleduff: I think the updates moving stuff from contrib to core last night broke the newest swank, you have to use the versions with timestamps that are listed in http://groups.google.com/group/clojure/msg/07eacb58a63de596

18:08 Hmm, but you have contrib set to 1.1, so that shouldn't be the problem you're seeing

18:09 Maybe you have an extra contrib 1.2-SNAPSHOT jar lying around somewhere

18:13 DavideAngelocola: I'm trying updating to clojure 1.2-SNAPSHOT

18:15 remleduff: I'm not sure swank works with the newest snapshot, I think it doesn't

18:18 DavideAngelocola: indeed, still the same error :(

18:18 arohner: remleduff: I'm getting a lisp reader error

18:19 remleduff: arohner: Those were silly play examples, the ^'s you get out of them won't actually be useable for anything resembling ^{metadata}

18:27 arohner: I was able to get swank-clojure to start and pass the tests by replacing #^ with ^. Give me a minute and I'll tell you if I can connect

18:31 ok, I'm having problems building my new changes

18:31 Caused by: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Named

18:38 technomancy: clojure-test-mode may also need an update

18:40 arohner: technomancy: what is the deal with src/winston/rpc.clj? its formatting is all kinds of screwed up

18:41 sorry, src/swank/rpc.clj

18:45 etate: hey, why aren't monads idiomatic?

18:48 technomancy: don't look at me, I'm just the maintainer. =\ that's seriously ancient code

18:55 ataggart: etate: who said they weren't and in what context?

18:57 etate: ataggart: stuarthalloway at disclojure.org 28th april

18:58 "Number of monads in Clojure 1.0: Zero. In 1.1: Zero. In 1.2: Zero. Monads are not idiomatic "

18:58 ataggart: link?

18:58 clojurebot: your link is dead

18:59 etate: ataggart: http://disclojure.org/2010/04/28/today-in-the-intertweets-april-28th-ed/

18:59 sexpbot: "Today in the Intertweets (April 28th Ed) | disclojure: all things clojure"

18:59 etate: i just don't get whats not idiomatic about monads in a mostly purely functional programming languge

19:02 mmarczyk: etate: I prefer to take that to be a statement of the present state of affairs

19:02 zakwilson: I'm inclined to say that most of the things you'd want to do with monads are easier by other means in Clojure.

19:02 mmarczyk: after all, people don't seem to be writing lots of monadic ("explicitly monadic"?) code in Clojure

19:02 zakwilson: That said, I'd really like it if that port of Parsec was usable.

19:02 ataggart: the quote is "Number of monads in Clojure 1.0: Zero. In 1.1: Zero. In 1.2: Zero. Monads are not idiomatic #clojure.:

19:02 mmarczyk: say goes for Scheme, even when it's being used in a purely functional manner (which it often is)

19:02 ataggart: which I take to mean Stuart is drawin a conclusion based on the lack of usage of monads

19:03 it's twitter, don't read too much into it

19:03 etate: okay :)

19:03 mmarczyk: if "idiomatic" means "widely used by the community", then he's right

19:03 if it were to mean "shouldn't be used cause it doesn't mesh with the language"

19:04 well, he's entitled to his opinion :-)

19:04 ataggart: meh, I don't care either way. IT's a tweet. Use monads if you want.

19:04 there are more important things to get worked up over

19:05 etate: i was more just curious as to why he said it, rather than getting worked up

19:05 as in i didn't know whether it was referring to monads in the implementation of clojure, or in daily usage or ?

19:06 mmarczyk: must be the impl given the 1.0-1.1-1.2 tags

19:06 etate: i thought maybe he had something else in mind than monads which solve the same problems

19:06 but is more idiomatic

19:07 mmarczyk: yeah, like impure functions and ref types for mutable state :-)

19:07 etate: lol, not exactly what i had in mind :)

19:08 ataggart: I have hopes that some day I'll grok monads.

19:08 zakwilson: Lists, or seqs in Clojure are pretty obviously monads - just not explicitly so.

19:08 arohner: ataggart: a monad is just a set of rules for chaining together function calls

19:09 etate: yeah was just going to say that i thought let etc was basically monadic

19:09 ataggart: "monad" and "just" don't belong in the same sentence

19:09 so comp is a monad?

19:10 etate: well, if stuart says there are no monads, i guess not?

19:10 ataggart: smells like monad is more adjective than noun

19:10 etate: :p

19:10 mmarczyk: monad is a way of making a more funky comp :-)

19:10 arohner: ataggart: sort of. monads have an "interface" for how to chain function calls

19:10 comp is a way of chaining together that doesn't follow the monad interface

19:10 huh. That would be an interesting blog article

19:10 monads for java programmers

19:10 define monads as java interfaces

19:12 zakwilson: I think the definition of return for Clojure seqs would be #(apply concat (map %1 %2))

19:12 err... bind

19:14 return is #(seq [%])

19:21 arohner: to the people who are having problems with swank-clojure + clojure-1.2-SNAPSHOT, try out my branch

19:21 http://github.com/arohner/swank-clojure

19:21 http://clojars.org/org.clojars.arohner/swank-clojure

19:21 sexpbot: "swank-clojure | Clojars"

19:21 arohner: I had some problems, and then it magically started working, so I *think* it works, but I'm not 100%

19:22 if you have problems, tell me on github

19:27 technomancy: hang on, if you have trouble with my fork tell me too. =)

19:28 arohner: technomancy: you already have 1.2 fixes?

19:28 technomancy: arohner: I believe so, are you having issues?

19:28 arohner: technomancy: yeah, with #^ in swank source

19:28 technomancy: arohner: jochu's fork?

19:29 arohner: technomancy: yours

19:29 technomancy: interesting... I thought that had been cleaned up a long time ago.

19:30 arohner: it's not in master. maybe another branch?

19:31 ok, my branch is *not* working, but I have to run

19:31 technomancy: arohner: oh wait, #^... I was thinking of using ^ as meta

19:31 which has been removed

19:31 what's wrong with #^?

19:32 arohner: technomancy: http://github.com/richhickey/clojure/commit/a5ca8243e3ea45e6387b2b00d0e9b2624d16adbf

19:33 getting rid of old ^'s was the first step towards #^ being replaced with ^

19:33 I gotta run

19:33 technomancy: I think it's just that ^ and #^ become the same thing

19:34 pretty sure #^ is not going anywhere

19:34 since we haven't seen any deprecation warnings for it.

19:53 mmarczyk: technomancy: not yet

19:53 http://clojure-log.n01se.net/date/2010-04-26.html#08:57

19:53 sexpbot: "#clojure log - Apr 26 2010"

19:53 technomancy: I hope that's pretty far down the line

19:53 since it will make it impossible to be backwards-compatible

19:54 maybe for 2.0?

19:54 mmarczyk: right... though ^String is *so much prettier*!

20:00 rhudson: Looks like the logbot is dead -- the last entry for today is about 7 hrs ago

20:10 alexyk: so... is ^ already the replacement for #^ in the trunk?

20:14 chouser: alexyk: yes

20:14 alexyk: nicee

20:51 what's the shortest wy to test that ^ works instead of #^, in repl?

20:52 way

20:52 mmarczyk: ^#'+

20:52 qbg: Call meta on something read in using it?

20:52 mmarczyk: if the above doesn't work, then presumably ^String foo will

20:52 _ato: ,'#^inc

20:52 clojurebot: EOF while reading

20:53 _ato: ,'#'inc

20:53 clojurebot: (var inc)

20:53 mmarczyk: ,(meta '^foo foo)

20:53 clojurebot: java.lang.Exception: Unable to resolve symbol: foo in this context

20:53 _ato: ,'^inc

20:53 clojurebot: (clojure.core/meta inc)

20:53 mmarczyk: ,(meta '#^foo foo)

20:53 clojurebot: {:tag foo}

20:53 _ato: ,(= (name (first '^inc)) "meta") ; heh, ugly

20:53 clojurebot: true

20:54 alexyk: so, clojurebot knows about ^ already?

20:54 ~ how do you know anout ^?

20:54 mmarczyk: no, it still uses it to mean (meta ...)

20:54 clojurebot: Excuse me?

21:04 tomoj: anyone happen to be around who's made a custom assembly descriptor?

21:13 unlink: It seems that leiningen didn't expect the promotion of seq-utils to core.

21:14 That is, it will happily run an up-to-the-minute build of clojure with software which doesn't understand the changes introduced in 1.2.0.

21:24 How do I tag a function as returning void? (for reify)

21:32 eslick: When using 'lein swank' to launch a clojure process, the files in the /src directory are compiled, but the namespaces don't appear to be loaded

21:32 So I have to manually compile the files

21:33 Is there a method by which this should happen automatically?

21:37 leifw: any clojure-hadoop users around?

21:37 I need some help figuring out how to submit a jar

21:52 mmarczyk: eslick: actually you only have to (require ...) your namespaces at the REPL

21:52 eslick: or (use ...) them, or do your work (in-ns your-namespace)

21:53 eslick: I do in-ns

21:53 But the namespace is not defined after connecting to clojure via swank

21:53 * mmarczyk going off to check this

21:54 eslick: So the /src directory is properly on the jvm classpath

21:54 But none of the functionality in the .clj files are loaded

21:54 mmarczyk: seems to work for me

21:54 with the latest (unstable) leiningen

21:55 eslick: How do I upgrade to unstable?

21:55 mmarczyk: you mean you can't call your functions?

21:55 eslick: Yes

21:56 mmarczyk: um, strange

21:56 and which version of Lein are you using?

21:56 the repo's here, btw:

21:56 http://github.com/technomancy/leiningen

21:57 see the README for instructions on how to set it up

21:57 eslick: Better to stick with the leading edge?

21:58 I was on 1.1.0

21:58 mmarczyk: well, no, I thought it was more reasonable to stay on 1.1

21:59 if it does its job fine

21:59 eslick: Except of course it's not (although more likely it's operator error)

21:59 mmarczyk: but if it doesn't, the checkout way might be worth a shot

21:59 eslick: Been 5 years since I've used Java and I've got common lisp hardwired in my head

21:59 mmarczyk: classpath issues certainly are a pain

22:00 not sure this is one of them, mind you

22:00 eslick: So if I have a file in src/com/project/core.clj

22:00 somnium: encountered a problem once where (swank-clojure-project) worked but lein swank + slime-connect didnt

22:00 eslick: with (ns com.project.core (:use ...))

22:00 When I connect, I should be able to do in-ns and then call the functions from that file, correct?

22:01 mmarczyk: somnium: do you know what the problem was?

22:01 slyphon: you have to require them

22:01 somnium: and at the repl (use 'com.project.core)

22:01 slyphon: eslick: (require 'com.project.core) first

22:01 mmarczyk: you should be able to do (in-ns 'com.project.core), if that's what you want

22:01 hiredman: eslick: in-ns just creates a namespace with the name you give it and puts you in it

22:01 mmarczyk: tried that a moment ago and it worked for me

22:01 hiredman: it doesn't load any files

22:01 eslick: So if I have a large system, I have to (require all the namespaces I may depend on?)

22:01 somnium: I have no idea, we kind of shotgunned it

22:02 mmarczyk: hiredman: I just started lein swank on Leiningen itself

22:02 typed in (in-ns 'swank.swank)

22:02 then I could do (start-repl) just fine

22:02 slyphon: eslick: i've found having a foo_init.clj file is useful, with the requires for a given level of the project

22:02 hiredman: mmarczyk: lein may load your stuff for you

22:02 mmarczyk: but not for eslick? :-)

22:03 hiredman: at work we gen-class something with a java main and do java some.class.here

22:03 slyphon: and then in user.clj i have a repl-init function that does requires of those _init.clj files

22:03 hiredman: mmarczyk: regardless of what lein may or may not do, I know what in-ns does

22:03 mmarczyk: hiredman: no argument about that

22:03 slyphon: :)

22:03 hiredman: mmarczyk: which was what I told eslick

22:04 eslick: Does require recursively load everything that the namespace so required depends on?

22:04 mmarczyk: hiredman: just pointing out that the thing it does should be sufficient for functions from foo.core to be available when lein swanking the foo project, after nothing more than (in-ns 'foo.core)

22:04 eslick: yup

22:05 hiredman: well, it's not that require is recursive, it is that those files also call require

22:05 eslick: slyphon: where do you put the foo_init.clj file so it's run on startup?

22:05 Ah, of course.

22:05 It does take a bit to rebuild ones mental model of the world.

22:06 slyphon: well, for the repl, if you have a user.clj in the classpath, it's automatically required

22:06 eslick: Any clojure gurus in the bay area looking for full time jobs or a short term consulting contract? :)

22:06 slyphon: i dunno if that's true in other cases

22:07 mmarczyk: hm, I wonder if I'm wrong about lein vs. in-ns actually

22:08 apparently I am

22:09 sorry for introducing confusion then

22:10 leifw: I submitted a job to my hadoop cluster, as a jar, with main class clojure_hadoop.job and a mapper my.namespace/mapper-function

22:10 and I get a classnotfoundexception for my.namespace

22:10 helpz!

22:11 eslick: So the answer to my original question is 'require

22:11 hiredman: do you have a class named clojure_hadoop.job?

22:11 eslick: Thank you everyone for the help

22:11 !

22:11 leifw: hiredman: that's part of the clojure-hadoop library

22:11 eslick: And I was serious about the job opportunity...

22:11 leifw: I built this jar with lein uberjar, so it's finding that

22:12 it doesn't get the classnotfound until it tries to load the mapper function in my namespace

22:12 hiredman: leifw: and do you have a class named my.namespace?

22:13 (if you don't that would be the reason you get the class not found exception)

22:13 leifw: no, I don't know why it thinks that's a class

22:13 mmarczyk: eslick: try posting your offer to the ggroup maybe :-)

22:13 leifw: oh hang on maybe I remember this

22:13 hiredman:

22:14 eslick: mmarczyk: good suggestion. Lispjobs too

22:14 mmarczyk: right

22:14 leifw: riiiiiiiiiiight I have to add a :gen-class

22:14 no clue why this was working on my machine then

22:15 thanks, hiredman

22:15 oops

22:15 nope

22:15 :-/

22:15 I guess I'll bang on this later

22:20 chessguy: is there a typical way to raise/throw an error in clojure?

22:21 slyphon: clojure.contrib.except/throwf is pretty handy

22:24 _brian2_: noon question> what do I do with third party java jar files in leiningen projects?

22:24 rhudson: ,(throw (RuntimeException. "yowza"))

22:24 clojurebot: java.lang.RuntimeException: yowza

22:24 slyphon: _brian2_: either install them locally, or make a clojars acct

22:25 _brian2_: slyphon: how do I install locally?

22:26 slyphon: maven will tell you when it can't find a dependency

22:26 looks something like:

22:26 mvn install:install-file -DgroupId=org.powermock.modules -DartifactId=powermock-module-testing -Dversion=1.3.7 -Dpackaging=jar -Dfile=/path/to/file

22:26 (that one was due to a typo)

22:27 _brian2_: so I need to run maven?

22:27 slyphon: "run maven"?

22:27 maven keeps a cache of stuff in ~/.m2

22:28 it's like rubygems or CPAN

22:28 _brian2_: yes, I sort of familar with maven , but leiningen doesn't handle third party jar files by itself

22:29 slyphon: well, leiningen is a thin wrapper of awesome around maven

22:29 at least in the "handles your dependencies" regard

22:30 _brian2_: well, if I have a jar file, I shouldn't need maven

22:31 its already built

22:31 I just want to call it in the leiningen project

22:33 alexyk: how do I make lein work with clojure/c.c. trunk?

22:36 lithper1_: when you run swank-clojure-project, is it possible for the project directory to be created, and all the proper files moved there in order to start a new REPL? for now, i patched swank-clojure.el to do it, but maybe there's a better way? i'm trying to avoid any massive build tools.

23:53 vu3rdd: /quit

Logging service provided by n01se.net