#clojure logs

2010-04-29

00:27replacadid I hear that clojure-swank is broken with the latest 1.2 clojure?
00:35replacaah, the tumbleweeds are rolling around in here tonight...
01:30palamasGood 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)
01:32leifwtechnomancy|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.
01:33unlinkHow do I achieve the effect of apply when I want to apply to a Java method call? e.g. (.someMethod obj [expand me])
01:33Chousukewrap it in a function
01:34leifwunlink: I remember hearing that memfn was bad for some reason, but I'd probably do (apply (memfn .someMethod obj) list)
01:34Chousukeleifw: I don't think memfn is bad as much as outdated (#() is easier most of the time)
01:35Chousukeand I think memfn doesn't need the . in the method name
01:35Chousuke(doc memfn)
01:35clojurebot"([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."
01:35leifwtrue
01:40unlinkChousuke: How would you wrap it in a function?
01:43Chousukejust (apply #(.someFoo %1 %2) [1 2])
01:43jacortinastest
01:43jacortinaswoo
01:43Chousukebut then you need to know how many parameters there are
01:45unlinkChousuke: right, that's the issue I'm facing
01:45Chousukethen try memfn
01:45unlinkIt's a static function
01:46Chousukehm
01:46unlinker
01:46unlinkbut memfn pokes a hole in the place of the object
01:47Chousuke,(apply (memfn Integer/valueOf) ["1"]) testing
01:47clojurebotjava.lang.IllegalArgumentException: No matching method found: valueOf for class java.lang.String
01:47Chousukeright. :(
01:47ChousukeI suppose then you're left with manually writing a multi-arity fn
01:47unlinkmeh, I've never heard a better excuse to use a macro
01:48unlinkum. false.
01:48unlinkyeah I guess you're right.
01:49ChousukeYou can write a macro if you're going to need to do this a lot
01:49hoeckunlink: or try reflection
01:49unlinkbut the number of args isn't known in advance
01:50unlink(defmacro wrap [method args] `(info (apply #(. EWrapperMsgGenerator ~method) ~args)))
01:50unlinkobviously the apply #( ... ) doesn't work
01:50Licenser_morgn
01:50unlinkbut it will be used like this: (proxy [cls] [] (meth1 [& args] (wrap meth1 args)) (meth2 [& args] (wrap meth2 args) (meth3 [& args] (wrap meth3 args)))
01:51hoeckLicenser_: moring
01:51unlinkclose parens to taste :-)
01:51Chousukeunlink: that doesn't look right.
01:52unlinkI 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]))
01:52unlinkChousuke: Yeah it's a funky API
01:53Chousukeunlink: would the vectors always be literal like that?
01:53unlinkChousuke: in which case?
01:53Chousukefor your wrap invocations
01:53unlinkChousuke: those are supposed to be argument vectors
01:54unlinkChousuke: actually, I can accomplish this with a macro that wraps proxy.
01:54unlink...which I would really not like to do.
01:54Chousukewell, I'll take your word for it because I have no clue what you're trying to do
01:55unlinkChousuke: I'm implementing one interface which basically delegates its work to another object (which doesn't implement that interface)
01:55unlinks/object/class
01:56Chousukeonce or many times?
01:56unlinkmany times, like 50
01:56Chousukeie. do you have many class/class pairs doing this delegation?
01:56unlinkoh, no
01:56Chousukeor just objects?
01:57Chousukeremember 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
01:57unlinkI have an object with about 50 different methods which all get delegated to a class with methods of the same name
01:57Chousukeah.
01:58Chousukeso that's why you want a macro .p
01:58ChousukeI think writing a macro that generates a proxy form would be the easiest
01:58unlinkI promise I had nothing to do with the design of those APIs :-)
01:58unlinkYeah I can't think of anything else
01:59Chousuke(make-wrapping-proxy from-class to-class methodname [arg1 arg2] methodname2 [arg1 arg2] ...)
01:59Chousukethough I'm not sure how you'd handle the static/instance method difference in this case.
02:04ChousukeIn 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))))))
02:04Chousukeexcept with fewer metasyntactic variables :P
02:05unlinkwow
02:05unlinkthat is almost *identical* to what I wrote
02:06unlinkI used a real classname instead of whatever and foo, and meth and args instead of methdname and argvec, but otherwise identical
02:06Chousukeheh
02:13unlinkexcept it's a little more complicated because of multiple arity methods
02:14Chousukehm
02:14Chousukewell you can also try using reflection in the macro
02:15Chousuke(note: not in the generated code :))
02:15unlinkhaha
02:15Chousukebut that'll be a bit more difficult to write
02:16Chousukebut it's entirely possible as long as the class is known at compile-time
02:16Chousukewhich it has to be, I suppose.
02:25unlinkWow, really? http://paste.plurk.com/show/242337/
02:30vegaiuh oh, I've been voted to speak about clojure at work next friday
02:30vegaiI guess it's high time to learn the thing :P
02:31zmilavegai: you speak about Clojure once, then second time, finally you learn it.
02:32vegai;)
02:38Raynes"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
02:38vegaibogglesome.
02:39vegaiI know I shouldn't say this, having designed no languages... but I don't have much respect for Matz
02:39vegaioops, I said it.
02:39RaynesAt least Ruby isn't Java.
02:39RaynesOr C.
02:41Raynesvegai: Elaborate! :D
02:42vegaiI've used ruby at work for about 3 years
02:45leifwI would probably use ruby if there were no lisps left
02:45Raynesleifw: I'd probably use Haskell. But once I got sick of monads, I'd go to Ruby.
02:46vegaiwhile it's quite nice for writing code, I've been suffering a bit from its lack of design
02:46Raynesvegai: I'm not going to defend Ruby or anything. I was just curious. :>
02:46leifwRaynes: I've tried to figure out haskell so many times it's just getting depressing.
02:46Raynesleifw: I figured it out once.
02:46vegaiRaynes: I'm not rabidly against it... we have couple of much much worse languages in use here :P
02:46leifwthat must've been fun
02:47RaynesBut I went to Clojure because I couldn't grok monads enough to find a use for them in my own code.
02:47vegaiperhaps it's more rails that bites me. It doesn't scale.
02:47RaynesI understood how monads worked, but I didn't understand how they were useful outside of the general stdlib monads.
02:47RaynesI think I need to do a Clojure monad tutorial.
02:47vegaipeople like to blog how rails scales and everyone who says it doesn't are idiots
02:47Raynescgrand: ohai
02:47vegaiand I fear that readers believe that
02:48RaynesI don't care for Ruby because nobody seems to use it except for rails.
02:48vegaiyeah, I was heavily into haskell for several years also. I guess I still am in a way
02:48Raynes._.
02:48leifwvegai: if you don't mind, where do you work?
02:48RaynesAnd I don't do webdev.
02:49vegaileifw: in a small company that makes billing systems for telcos and such
02:49cgrandgood morning #clojure!
02:50leifwugh...good late late late night, cgrand
02:51Raynes(defplugin (:hicgrand "Says hi to cgrand." ["hicgrand" "hiChristophe"] [{:keys [irc channel]}] (ircb/send-message irc channel "cgrand: "HAI!")))
02:51RaynesAw, damn.
02:51RaynesMisplaced a quote.
02:51RaynesThat would have been clever, otherwise.
02:52cgrandRaynes: tank you for the comment in respond.clj
02:52Raynes<3
03:04replacamorning cgrand!
03:50LauJensenMorning all
03:51RaynesLauJensen: Moin.
03:52RaynesThat's used in Denmark, right?
03:52LauJensenWell How'dy Mr. Alabama :)
03:56LauJensenRaynes: Its used in the south tip of Jutland (Denmarks main piece of land), but its German in origin
03:56LauJensenbtw, could we rename your bot to The-Richinator ?
03:56RaynesI don't think I can consent to that.
03:56Raynes._.
03:58RaynesYesterday's exposure got me 4 new sexpbot watchers on Github. :D
03:58LauJensenIts a popular project?
03:59RaynesIt's my most popular project. It's not popular though.
03:59RaynesI've just never had a popular project to compare it to.
04:00LauJensenOk
04:29LauJensenhmm, where's philjure? still nighttime in the US I guess
04:34sparievit's suspiciously quiet here ... Raynes finally got some sleep ?
04:34Raynes>.>
04:34RaynesI slept from 11:00am yesterday until 9:00pm last night. It's 3:34am now.
04:37sparievI envy your schedule :)
04:38ChousukeLauJensen: I think you might be the only *jure proponent on this channel ;P
04:38LauJensenChousuke: Im not though
04:38LauJensenI just hate communism and *jure in equal measure
04:39Chousukewait, whaT?
04:39Chousukewhere does communism come into this?
04:39LauJensenChousuke: When my build tool has an oppinion about my naming strategy, thats communism, dont you recognize?
04:39Chousukeno
04:39Chousukejust, no,.
04:39LauJensenThen you're a commujure yourself
04:40Chousuke:P
04:40Chousukeyou shouldn't joke about things like this, someone might take it seriously
04:40RaynesLet's just rename Clojure, rumblethunderchickenfinger, and nobody will ever want to use the name as a pun.
04:41LauJensenRaynes makes a good point
04:41LauJensenChousuke: 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
04:42LauJensenAnd I'll be happy to rantjure about it
04:42ChousukeLauJensen: I think you might have some really distorted ideas about communism
04:43Chousukea build tool discouraging you from stupid naming schemes is simply opinionated, not communist :P
04:43Chousukeby your logic, clojure itself is communist because it's definitely opinionated. And that's just silly
04:44LauJensenNo 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
04:44Chousukebut I think bringing a political ideology of any kind to the discussion is a mistake to begin with
04:45ChousukeLauJensen: right, it's okay to think that explicitly discouraging bad naming schemes is a bad idea, but please don't call it communist.
04:45Raynes#politics
04:45LauJensenChousuke: np, if it offends you or anybody else I wont
04:45Chousukebecause that's just an association fallacy
04:46ChousukeLauJensen: You'll find many people are put off by faulty logic :)
04:46RaynesI'm renaming sexpbot botjure
04:47LauJensenWoohoo!
04:47Chousukegah.
04:47LauJensenpwnagejure
04:47vegaiRaynes: how about 'RAMIREZ'?
04:47LauJensenChousuke: But now that we're beyond the name calling, where do you see the logic failing?
04:47vegaiand force all commands te be uppercase.
04:47Raynes:>
04:48ChousukeLauJensen: the fallacy is simply associating an opinionated feature with a political ideology :P
04:48RaynesNobody ever called anybody any names.
04:48RaynesAt least, what I read of it.
04:48LauJensenRaynes: I called leinjure communistic
04:48RaynesDid you call Chousuke a commie?
04:49ChousukeLauJensen: I mean, it's just an easter egg. You can still name your project whatever you want.
04:49ChousukeLauJensen: leiningen just wont help you if you choose to show a lack of taste :P
04:50LauJensenChousuke: 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"
04:50Chousuke:D
04:50SynrG#politics++
04:50Chousukeyeah, I think this is getting a bit out of hand
04:50LauJensenAlright alright, go back to your coffee and news sites :)
04:51SynrGcoffee and clojure101 exercises
04:51RaynesSuch arguments can only be solved with a fight to the death.
04:51SynrGno, to the pain!
04:51RaynesSynrG: New ones?
04:51Chousukeno. this must be solved by a robot battle
04:51SynrGRaynes: i'm very slow and deliberate :) also i only have scraps of time for it.
04:51RaynesSynrG: I did the last ones in my head in about 60 seconds. :>
04:51Chousukeand the robots must be controlled by an AI written in Clojure
04:52SynrGRaynes: ah, but you weren't a clojure virgin
04:52Raynes$google robocode
04:52sexpbotFirst out of 34900 results is:
04:52sexpbotRobocode Home
04:52sexpbothttp://robocode.sourceforge.net/
04:52sexpbotFirst out of 26 results is:
04:52sexpbotRobocode - Wikipedia, the free encyclopedia
04:52sexpbothttp://en.wikipedia.org/wiki/Robocode
04:52ChousukeRaynes: hm, that's a bit floody :P
04:52RaynesHuh
04:52RaynesIt isn't normally.
04:52RaynesA small bug.
04:53RaynesI introduced a few when I tried to rewrite 26 plugins in an hour last night.
04:53SynrGRaynes: 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
04:55LauJensen$google define: floody
04:55sexpbotFirst out of results is:
04:55sexpbotFirst out of 3 results is:
04:55sexpbotTully (Irish sept) - Wikipedia, the free encyclopedia
04:55sexpbothttp://en.wikipedia.org/wiki/Tully_(Irish_sept)
04:55LauJensenhmmm :)
04:56RaynesMismatched parens that weren't really mismatched.
04:56RaynesJust in the wrong place.
04:58Raynes$google wtf
04:58sexpbotFirst out of 4530000 results is:
04:58sexpbotThe Daily WTF: Curious Perversions in Information Technology
04:58sexpbothttp://thedailywtf.com/
04:58RaynesFixed.
04:58LauJensenRaynes: is the first line necessary ?
04:59RaynesLauJensen: It's the exact same thing clojurebot does.
04:59LauJensenyes, but if nobody is reading it, why not just let it go ?
04:59RaynesBecause I think it's generally useful.
04:59LauJensenok
04:59ChousukeRaynes: you could combine the first and second lines
05:00RaynesThat would just be horizontal spam instead of vertical.
05:00Raynes:p
05:00RaynesI'll do that later.
05:00RaynesWorking on another branch right now.
05:00Chousukeexcellent!
05:02LauJensen(chousuke is really Mr Burns btw)
05:38stilkovI can't seem to find a way to invoke set! on any kind of var
05:38stilkovI must be missing something plainly obvious
05:39_atostilkov: it needs to be thread-locally bound first
05:39stilkovyou mean using binding?
05:39_atoyep
05:39_atoeg (binding [foo 1] (set! foo 2))
05:40stilkovah ? now it makes sense; should have been more than obvious in hindsight
05:40stilkovesp. since I'm using binding all over the place
05:42Chousukehmm, running git gc on my clojure clone once in a while seems to be beneficial
05:43Chousukejust shrank it from 55MB to 8.6MB :P
05:44RaynesWe herd u liek Clojure, so we put some recurshen in ur recurshen so you can (apply str (repeat "recurshen while you "))
05:45RaynesShould probably be 'rescursh', but nobody is perfect.
05:45RaynesExcept Rich.
05:45Chousuke:P
05:45Chousukeno-one is perfect. Some just are better at making others think so.
05:48RaynesChousuke: In that case, wouldn't the perfect person be the one who could is perfect that making others think he/she is perfect?
05:58IntensityI'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.
05:59LauJensenIntensity: rand-nth
06:01IntensityLauJensen: 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?
06:03spariev(let [g-res (g x)] (f g-res (h g-res))) maybe
06:05Chousukelet is your friend
06:06Intensityspariev: 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).
06:06ChousukeIntensity: prefer (.methodName obj) to (. obj methodName)
06:07IntensityChousuke: Ok. And in chains of methods, then would I prefer (.. obj method1 method2)?
06:07Chousuke(and AClass/staticMethod also to explicit . forms)
06:07Chousukewell, actually I prefer (-> obj .method1 (.method2 args))
06:08Chousukesince it allows you to use clojure functions in the pipeline too
06:09Chousuke,(-> "foobar" .toUpperCase (subs 3)) for example
06:09clojurebot"BAR"
06:10spariev,(doto (java.util.HashMap.) (.put "a" 1) (.put "b" 2))
06:10clojurebot#<HashMap {b=2, a=1}>
06:11IntensityChousuke: 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().
06:12Chousukewithin a proxy form, this is bound to an *instance* of the proxy.
06:12Chousukeand I think the GetCurrentState() call in that case is just a shortcut for this.GetCurrentState()
06:13Chousukeor a static method, in which case you need to do (ClassName/GetCurrentState)... But it probably isn't.
06:13IntensityChousuke: 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.
06:13ChousukeIntensity: you need to use this if you want to call methods on the object
06:14ChousukeIntensity: and yeah, parentheses aren't needed if the method/function doesn't any other parameters besides the object itself.
06:15IntensityChousuke: 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.
06:15ChousukeIntensity: 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
06:15ChousukeIntensity: yeah. They're all macros :)
06:15ChousukeIntensity: Once you get used to clojure you'll be able to write such tools yourself.
06:16Chousukebut for now, enjoy using the existing ones :D
06:17IntensityChousuke: 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.
06:17ChousukeIntensity: yes.
06:17ChousukeIntensity: 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
06:19Chousukewhat 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
06:19Chousukeand as I said, if the second parameter is not a list, it's wrapped in one
06:20IntensityOk. 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.
06:20Chousukeso in (-> obj .method) it first internally "becomes" (-> obj (.method)) and then (.method obj)
06:21Chousukeyeah
06:21bozhidarI was wondering something about this snippet of code from clojure's site
06:22bozhidarhttp://gist.github.com/383420
06:22bozhidarwhy is the logging line outputted 5 times?
06:22bozhidarshouldn't it be just one
06:22ChousukeI think that would be something like (-> this .getStateMachine (.getLegalMoves (-> this .getCurrentState .getRole)))
06:23IntensityOk. 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.
06:25ChousukeIntensity: I'm not sure if that works.
06:25ChousukeIntensity: I don't think there is a way in this case that isn't unnecessarily contrived
06:26IntensityChousuke: 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.
06:27Chousukebozhidar: hm I can't even test that in my repl due to binding being ineffective on str
06:27ChousukeIntensity: You could write a macro to interpret C++ code in Clojure. :)
06:27ChousukeIntensity: but yeah, you can't with ..
06:28bozhidarChousuke: in my repl it show this exact output as in http://clojure.org/concurrent_programming
06:28Chousuke-> can differentiate between methods and functions because it just deals with the symbols
06:28bozhidarso I think that binding works on str
06:29Chousukebozhidar: in your version, but I'm running 1.2-master here
06:29Chousukebozhidar: and it might just be that str is calling itself recursively
06:29Chousukebozhidar: thus resulting in more logging prints
06:29bozhidarChousuke: I assume so, I'm running 1.1
06:30RaynesI wish people would stop telling me that it's bad for my projects to depend on. 1.2 >:|
06:30RaynesI live for the danger, man.
06:31IntensityChousuke: Ok. Thanks for the help.
06:32ChousukeI think str calls itself once for each argument and then finally once for the final stringbuilder -> string conversion
06:32Chousukewhich would nicely account for all five logging prints.
06:38RaynesIs there something similar to filter/remove that returns a sequence of what was removed after it's finished?
06:38_atoI doubt it
06:38rhickeyRaynes: returns 2 sequences?
06:39Raynesrhickey: Indeed.
06:39Chousukeyou can do (juxt filter remove)
06:39RaynesChousuke: I planned on doing that. Just wanted to be sure there wasn't already a function for that in core.
06:39Raynes:>
06:40rhickeyhttp://richhickey.github.com/clojure-contrib/seq-api.html#clojure.contrib.seq/separate
06:40Chousukethe problem with having two sequences like that is that they will both hold onto the head of the original sequence :/
06:40RaynesThat isn't a problem.
06:40RaynesIt's for my defplugin macro.
06:41RaynesExpanding it for some hooking stuff.
06:41RaynesI don't think I'm going to do it like this.
06:42RaynesJust running ideas around my head.
06:42Raynes:>
06:48vu3rddpartial can take arguments in the order, not any arbitrary args, am I right?
06:49Chousukeright. I think.
06:49ChousukeIF I understood you correctly
06:49bozhidarrhickey: can I bother you with a question about one of the example on clojure.org?
06:51kzarSo how should I escape variables I put into the SQL when I use with-query-results?
06:52vu3rddChousuke: were you replying to me?
06:52Chousukeyes
06:52vu3rddthanks
06:53carkhkzar : something like (with-query-results rs ["select * from customer where id=?" customer-id] (dostuff rs))
06:53carkhescaping occurs automatically
06:54Chousukeif you're going to work a lot with SQL take a look at ClojureQL
06:54kzarcarkh: Awesome thanks carkh
06:54kzarChousuke: OK, I avoid it generally but this project needed to create a MySQL database
06:54carkhChousuke: clojureql sometimes won't go as far as needed
06:55carkhlike when using database engine specific features
06:55carkhfor instance (last time i checked) the returning statement from postgres
06:55Chousukecarkh: it does support raw SQL when needed doesn't it?
06:55carkhwell then what's the point =P
06:55vu3rddIs there a way to give default value to function parameters?
06:56Chousukevu3rdd: not directly, but arity overloading is a common workaround
06:56vu3rddChousuke: oh.. I forgot about it. Thanks
06:57cemerickThere's also :or in map destructuring, which is a nice route
06:58Chousukea defn-with-defaults might be useful
06:58carkhi like the addition from hiredman for that : (defn bleh [& {destructuring here}] ...) you get real named parameters !
06:58Chousuke(blah somefn [foo = 2, bar = 3, something] ...)
06:58cemerickcarkh: yeah, that's quickly becoming my default, outside of absolutely required params.
06:59carkhyes absolutely love it =)
06:59Raynesvu3rdd: Note that in 1.2, we actually have default keyword arguments.
06:59Raynesvu3rdd: It's map destructuring without the map.
06:59vu3rddRaynes: yes, I have seen that.
06:59Raynessexpbot uses it.
06:59Chousukehow did the syntax for that go again?
06:59RaynesChousuke: Same as for map destructuring.
07:00Chousukewas it just & {map-form}
07:00carkhChousuke: yes
07:00Raynes(defn func [& {:keys [omg wtf bbq] :or {omg "omg"}}] ..)
07:00Chousukethere aren't too many tickets left with 1.2
07:01carkhRaynes: i wonder what that function's doc string says ...
07:01Raynes"Omgs your wtf with your bbq."
07:04vu3rddparedit slurp is really really awesome!
07:07carkhi eventually switched to paredit after several years, it takes a bit of time getting used to it =/
07:08carkhspecially ctrl-arrow not doing what expected anymore
07:09vu3rddswitching 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.
07:10cemerickvu3rdd: you mean with overloads? Yes -- another reason why kwargs are so much friendlier in such circumstances.
07:11vu3rddhmm.
07:12Chousukevu3rdd: that's why I had the idea for a defn-defaults
07:13Chousukevu3rdd: it would be trivial to generate the extra arities in a macro
07:13Chousukeas long as you accept that (defn [foo = 1, bar, zonk = 3] ...) makes no sense
07:13vu3rddChousuke: yes, I was also thining like that.
07:14vu3rddit is a very neat idea to have a macro for that.
07:21Raynescarkh: The docstring is "Omgs your wtf with your bbq."
07:21Raynes$(update-in {:wtf []} [:wtf] #(conj % "LOL"))
07:21sexpbotresult: {:wtf ["LOL"]}
07:25Raynes$(update-in {:wtf []} [:wtf] conj "LOL")
07:25sexpbotresult: {:wtf ["LOL"]}
07:25RaynesCool.
07:33SynrGhmm
07:33SynrG$(update-in {:wtf {:omg []}} [:wtf :omg] #(conj % "LOL"))
07:33sexpbotresult: {:wtf {:omg ["LOL"]}}
07:34carkh$(update-in {:wtf {:omg []}} [:wtf :omg] conj "LOL")
07:34sexpbotresult: {:wtf {:omg ["LOL"]}}
07:35carkhwhy mùake it hard to read ?
07:54SynrGcarkh: good call. i didn't take suitable note of "... and any supplied args" in the doc
07:54carkh=)
07:56RaynesSynrG: Neither did I at first.
07:56carkhquestion : 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).
07:56carkhwhat 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
07:57RaynesYou could reload cark.b.
07:57SynrGyou 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
07:57carkhso far i'm defining cark.b/b as this : (def b ((fn [] cark.a/a)))
07:58carkhbut that's ugly
07:58carkhRaynes: i'm trying to avoid reloading
07:58carkhthat's the whole point actually =)
07:58_atothat's weird
07:58Raynes^
07:58_atohow does that help?
07:58carkherr actually it doesn't
07:59carkhbut what i'm doing is make everything functions and call them
07:59carkhtried to simplify the example, but it was too simplified
07:59carkh=P
08:00RaynesYou could use a ref. ;)
08:00carkhor an atom yes
08:00carkhbut then i need to sprinkle @ everywhere
08:00carkhwhich is ugly too
08:01carkhwhat i'm trying to achieve : i don't like compojure because it doesn't scale to hundreds of pages
08:01cgrandcarkh: (refer '[cark.a :only [a] :rename {a b}])
08:01carkhmhhh
08:01RaynesWe have :rename?
08:01carkhlet me explain further
08:02carkhso i have this routing system that will route the request from namespace to namespace until it reaches a page
08:02carkhsomething like this : (def top (matchers customers users))
08:03carkhthen in another namespace (def customers (mactchers ["add" add-customer] ["list" list-customers]))
08:03carkhand so on
08:04carkhbut when i make a change in customers, it won't reflect in top unless i reload the whole thing
08:04carkhwhich defeats the purpose of image based hacking =P
08:06RaynesIf 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?
08:06Raynes(doseq [f fns] (f)) is simple enough, of course.
08:09carkh,(dorun (map #(%1 %2) (repeat print) [1 2 3 4]))
08:09clojurebot1234
08:09carkhreturns nil
08:09carkhbut yes doseq seems more appropriate
08:10LauJensenRaynes: doseq is better, because it implies that you're going for side-effects
08:18cgrandRaynes: yes doseq
08:18RaynesThanks, friends. <3
08:23AWizzArda nice thing could be a pdoseq
08:24eevar2AWizzArd: aren't side effects the whole point of doseq? how do you paralellize that?
08:25eevar2assuming that's what you ment by p
08:25ChousukeAWizzArd: I think (dorun (pmap ...)) is good enough for parallel execution of side-effects :)
08:25RaynesRich could parallelize two 6 ton pipes at an angle from each other with his bare hands.
08:26Chousuke:P
08:26AWizzArdChousuke: yes, i currently use pmap for that
08:27AWizzArdeevar2: the seq we traverse may be a seq of independend jobs.
08:30sparievso pdoseq would be basically syntactic sugar for (dorun (pmap ... ))
08:32zakwilsonI 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
08:32zakwilsonerr... given a seq...
08:32mmarczykthere's separate in contrib, I think
08:32mmarczyk,(doc clojure.contrib.seq-utils/separate)
08:32clojurebot"([f s]); Returns a vector: [ (filter f s), (filter (complement f) s) ]"
08:34zakwilsonYes... 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.
08:34carkh~def clojure.contrib.seq-utils/separate
08:35carkhah yes it does =/
08:36carkhhttp://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/seq.clj#L42
08:37zakwilsonIt probably won't become too speed-critical. I'll go with that until I have a problem.
08:38jacortinastest
08:38mmarczykright
08:38mmarczykwell, you could (map #(vector % (f %)) your-seq)
08:39mmarczykthen filter on the second item in each vector
08:39mmarczykthen (map first ...)
08:39mmarczykif (f %) is really expensive to make this worthwhile
08:40cgrandseparate aka (juxt filter remove)
08:40cgrand,((juxt filter remove) even? (range 10))
08:40clojurebot[(0 2 4 6 8) (1 3 5 7 9)]
08:40slyphonhello?
08:40clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline slyphon
08:41slyphonhah
08:41The-KennyOo
08:42The-Kenny(Is hiredman just as crazy as his creation?)
08:42mmarczykcgrand: that still calls even? twice per element, right?
08:43cgrandright
08:44chouser((juxt filter remove) (memoize even?) coll)
08:44chouserthat doesn't. :-)
08:44mmarczykbut surely we don't need to have a `separate' function if (juxt filter remove) is available :-)
08:45mmarczykchouser: oh, now you're making my convoluted solution look bad :-)
08:46chouserwell, you have to be pretty careful with a plain memoize like that. can eat a lot of memory
08:46_atoheh, chouser's solution is also a huge memory leak though, yours is not ;-)
08:47mmarczykwell, I suppose, for a really large coll :-)
08:48mmarczykbtw, apparently it's possible to create a function which takes 20 positional arguments *and* rest args
08:49mmarczykwhich then consistently returns nil without evaluating its body if applied to >= 20 args
08:49mmarczyk(throws arity for less)
08:50chouser>= 20 literal args, right? not 'apply' with a seq of >= 20
08:50mmarczykright
08:51mmarczykalthough it's the same with apply, just checked
08: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)
08:51clojurebotnil
08: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)
08:52clojurebot(20 21 22)
08:52_atointeresting
08:52chousernot good
08:52mmarczykit's the same with latest (close to latest?) checkout from github
08:52bendlasHi folks
08:52mmarczyksomeone on SO asked why Clojure limits arg number to 20, ran into this while replying
08:54fogusmmarczyk: Do you have a link to that SO question?
08:54mmarczykI 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
08:54mmarczykyes, sure, just a sec
08:54mmarczykhttp://stackoverflow.com/questions/2735600/why-is-there-a-limit-of-max-20-parameters-to-a-clojure-function
08:54sexpbot"Why is there a limit of max 20 parameters to a clojure function - Stack Overflow"
08:54mmarczyklatest one in the clojure tag
08:54fogusmmarczyk: thank you
08:56vegaianyone know how I get a new version of a MEAP book in Manning?
08:56mmarczykvegai: you should receive an e-mail from Manning with a d/l link
08:56vegaiI 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
08:57mmarczykvegai: if you don't, e-mail them
08:57fogusvegai: That link is only valid for 5 days
08:57fogusI think if you email them they will send another
08:57fogus(seems to have worked for others)
08:57vegaioh, now I see that I got the previous mail on 13th
08:57vegaino wonder there haven't been newer versions yet
08:58fogusvegai: We're hoping to have 2 more chapters out soon, but I wouldn't want to place any Vegas bets on that
09:00vegairighto
09:02LauJensenfogus: if I buy your book today, how many chapters can I read and how many are still pending ?
09:03fogusThere are 5 chapters available right now and two more in the pipeline, leaving 5 remaning chapters (in various stages of completion)
09:03LauJensenah ok ... I might just hold off for a liiitle bit longer then :)
09:04LauJensenOne 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
09:04fogusLauJensen: We'd love your feedback, but I can sympathize
09:05LauJensenArent you guys getting a ton of feedback already fogus ?
09:05fogusindeed
09:06LauJensenOk - If you really were in need of help I would happily pitch in, but it sounds like you guys are right on track
09:34jacortinasI'm wondering if I can use http-agent(in clojure.contrib) with an http proxy, anyone do anything like this?
09:35ordnungswidrigjacortinas: doesn't the java.net system properties work?
09:35ordnungswidrigs/doesn't/don'/
09:35ordnungswidrigs/'/t/
09:35ordnungswidrig*sigh*
09:35jacortinasordnungswidrig: is that really all it would take?
09:36ordnungswidrigI'm not sure...
09:37RaynesSwank is worthless with compile-time errors.
09:37Raynes"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"
09:38ordnungswidrigit uses HttpURLConnection which should make use of http.proxyHost and http.proxyPort
09:39ordnungswidrigRaynes: are you uptodate? For me it reports the line number
09:39zakwilson,(contains '(:foo :bar) :bar)
09:39clojurebotjava.lang.Exception: Unable to resolve symbol: contains in this context
09:39Raynesordnungswidrig: Yes, I am.
09:39Raynes1.2-SNAPSHOT.
09:39zakwilson,(contains? '(:foo :bar) :bar)
09:39clojurebotfalse
09:39zakwilsonwhy?
09:39clojurebotwhy not?
09:39ordnungswidrigRaynes: ok, I'm using clojure-1.1
09:39RaynesIf I try to require something, and no dice, it gives me an error message and a random bunch of garbage.
09:40Raynesordnungswidrig: I mean 1.2-SNAPSHOT swank.
09:40zakwilsonSilly bot... why not? Because it obviously *does* contain :bar.
09:40ordnungswidrig,(doc contains?)
09:40clojurebot"([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'."
09:40RaynesAnd 1.2 Clojure, but that's irrelevant.
09:41ordnungswidrigRaynes: ah, yes, the require issue. It likes to report line no: 0, right?
09:41RaynesIt reports line number nothing.
09:41RaynesIt doesn't even try to give me a line number.
09:41zakwilsonOh, I get it.
09:41RaynesUnable to resolve symbol: prepend in this context
09:41Raynes [Thrown class java.lang.Exception]
09:41RaynesAnd that's it, besides the worthless stacktrace. :p
09:41ordnungswidrigRaynes: or like that
09:42ordnungswidrigRaynes: java -jar clojure.jar mybrokenscript.clj will do better?
09:43RaynesYeah, I can track it down. It's just annoying sometimes. :<
09:43ordnungswidrigC-c C-k also does better reporting than C-c C-l
09:44RaynesI usually use that, but I'm not using either at the moment. My code loads all of the plugins whenever I use sexpbot.run.
09:52RaynesThat's weird.
09:52Raynesparedit-mode randomly disabled.
09:52Raynesstuartsierra: ohai
09:52stuartsierrahi
09:55vu3rddstuartsierra: the dotrace procedure you wrote in the c.c.trace is really nice. Very helpful to me. Thanks for that.
10:01stuartsierrawu3rdd: you're welcome
10:01stuartsierraactually, I think someone else added dotrace after I wrote the original lib
10:06vu3rddstuartsierra: oh.. ok
10:06vu3rddJoC new MEAP has arrived!
10:07Chousukeit has? where's my mail :(
10:07The-KennyChousuke: Mine hasn't arrived yet too
10:07vu3rddMay be the electrons travel faster to India. :-)
10:07The-Kenny*Hitting Refresh in Gmail"
10:08The-Kennyvu3rdd: There was the case of the 300 Mile Email
10:08vu3rdd:-)
10:08The-KennySome strange stuff with timing etc. which prevented emails from going farther than 300 miles
10:08sparievPostmen these days ...
10:08vu3rdd7 chapters now
10:08vu3rddch 6 functional programming and ch 7 macros
10:08The-Kennyhttp://www.csua.berkeley.edu/~ranga/humor/500_mile_email.txt There it is
10:09The-KennyOk, looks down. Here's a mirror if someone is interested: http://www.ibiblio.org/harris/500milemail.html?
10:09sexpbot"The case of the 500-mile email"
10:11vu3rddWhen 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:11vu3rdd"
10:21kzarIf you have something like this {:dumb "example"}, how do you destructure it to the key and value without knowing what the key is?
10:22cYmen_Does anybody know of sample code or tutorials on image processing using clojure?
10:22mmarczykkzar: you don't
10:23kzarmmarczyk: Well how would I get the key and the value out of something like that without destructuring?
10:23LauJensencYmen_: define 'processing'
10:24mmarczykkzar: I'm not sure what you mean by that, but...
10:24mmarczyk,(seq {:dumb "example"})
10:24clojurebot([:dumb "example"])
10:24cYmen_LauJensen: Read image from $foo invert save to $bar...
10:24mmarczykyou can map a function across a map
10:24mmarczykif you need to process entries one by one
10:25mmarczykthen you get [key value] pairs
10:25LauJensencYmen_: 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:25LauJensen$google Best In Class Tribute to Steve Ballmer
10:25sexpbotFirst out of 1650 results is:
10:25sexpbotMy tribute to Steve Ballmer | BEST IN CLASS
10:25sexpbothttp://www.bestinclass.dk/index.php/2010/02/my-tribute-to-steve-ballmer/
10:25kzarmmarczyk: Sweet doing seq on it is a good idea, that lets me do what I wanted. Thanks
10:25sparievhoraay for JoC, received my MEAP letter :)
10:25LauJensenI think I do almost that in this post, only I dont invert the colors but scale it @ cYmen_
10:25mmarczykLauJensen: that was one seriously cool blog entry! :-)
10:25LauJensenmmarczyk: Thanks! :)
10:25mmarczykkzar: hth :-)
10:26mmarczyk(as in happy th)
10:26eevar2cYmen_: and do have a look the java2d api docs
10:26cYmen_LauJensen: Thanks.
10:26eevar2and tutorial
10:26cYmen_eevar2: and to you, too.
10:26esjhooray - Fresh MEAP !
10:36Chousukeooh, now I got mine too
10:39bsteuberme not yet *sniff*
10:42cYmen_meap?
10:43pjstadigeverytime i see meap i think they missed out by not calling it the Manning Early Access Trial
10:44LauJensenpjstadig: they actually tried that when ...
10:44LauJensen~suddenly
10:44clojurebotCLABANGO!
10:45djpowelldo manning nicen up the typesetting a bit before release?
10:45pjstadigclojurebot: meap is manning missed the opportunity to call it Manning Early Access Trial
10:45clojurebot'Sea, mhuise.
10:45pjstadig~meap
10:45clojurebotmeap is manning missed the opportunity to call it Manning Early Access Trial
10:45pjstadigbah
10:45pjstadigbeen too long since i've instructed clojurebot
10:46chouserdjpowell: I hope so. At least move the footnotes to the bottom of the page...
10:47fogusdjpowell: I believe they have a more formal layout process for the printed book.
10:48djpowellhow 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:49djpowelldo i have to post the mailing list about the patch before i create a ticket?
10:49stuartsierrathat is preferred
10:50stuartsierrahttp://clojure.org/patches
10:52djpowellhmm, actually I did post back in november
11:00RaynesShuffle is in core now? Cool.
11:02bsteuberoh, didn't know about the /patches documentation
11:03bsteuberwould have kept me from doing things in a silly order :)
11:06bsteuberstuartsierra: so how are people supposed to find the clojure.org/patches page?
11:06wthiddenstuartsierra: why does json/read return 0 for an element that is an empty string?
11:07cgrandstuarthalloway: looking at your patch for :added in vars metadata, no :added "1.0"?
11:07stuarthallowaycgrand: true
11:07stuarthallowayrich wanted to leave that implicit
11:09cgrandstuarthalloway: ok, so I guess the policy is to tag all new vars with :added as soon as they are created.
11:10stuarthallowaycgrand: as soon as they are public and have a docstring
11:10stuarthallowaywhich of course requires creation :-)
11:10stuarthallowayexample corner case: definterface
11:11stuarthallowayit is public, but not doc'ed or metadata'ed yet
11:12djpowellby public, do you mean not-private or publicised?
11:13stuartsierrabsteuber: dunno
11:13djpowellis this to avoid clashes between clojure.core and your code?
11:13stuartsierrawthidden: dunno, maybe that's a bug, got a test case?
11:16djpowelli like cgrand's :as suggestion
11:17cgrandI'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:18djpowelli guess it would require even non-publicised vars in core to be given an :added tag
11:19cgrandshould I check :doc too?
11:19djpowellwhich I don't think should be a big problem?
11:20djpowellI think var polution will be a problem in clojure if we don't do something
11:21chouserthis 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:21djpowelli wonder who it will benefit though?
11:22cgrandonly about preventing nameclashes
11:22djpowellif 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:24djpowellI got bitten by char-array in 1.1, cause I'd already created my own char-array function for 1.0
11:24cgrandfor example Enlive is designed for 1.1 but worked fine with clojure 1.2 until the addition of flatten
11:26djpowelleven C has some namespacing of global functions via _ prefixes to prevent compiler supplied functions from clashing with user ones
11:32rhickeystuarthalloway, cgrand : changed my mind on "1.0", I think it will be more useful with it
11:33rhickeycgrand: definterface is due for a docstring and then a "1.2" designation
11:33stuarthallowayrhickey: ok
11:43cgrandrhickey: ok, so all vars listed here http://gist.github.com/383775 should not be referred?
11:45rhickeycgrand: other than definterface, they all look like implementation details to me, yes
11:46cgrandok, thanks
11:53RaynesWho was it that asked me to combine the first and second lines of $google results?
11:53RaynesAnyways
11:53Raynes$google omg
11:53sexpbotFirst out of 6190000 results is: omg! Celebrity gossip, news, photos, babies, couples, hotties, and ...
11:53sexpbothttp://omg.yahoo.com/
11:55cburroughsIs there a clojure json library that can handle unquoted keys?
11:57cburroughsheh, google tells me I asked that here on 2009-12-09 and apparently did not find one
11:59hiredmancburroughs: you know thats not valid json, right?
12:00cburroughsoh yes, I want to read it, not write it
12:02cemerickcburroughs: sounds like you want to use rhino's eval or somesuch
12:13cburroughscemerick, that is a special mixture of crazy and genius
12:14cemerickcburroughs: which?
12:15cburroughsI'll tell you after I get it to work
12:15cemerickheh
12:16cemerickchouser / rhickey: any chance "non-eager" AOT-compilation will make it into 1.2?
12:17rhickeycemerick: what's that?
12:17cemerickhrm, right, sorry
12:17chousercemerick: you mean some way to turn off AOT for some 'require'd namespaces?
12:17cemerickrhickey: this, although it was filed in contrib for some reason: https://www.assembla.com/spaces/clojure-contrib/tickets/23
12:17sexpbot"#23 - Clojure AOT compilation will compile unwanted classes (Invalid) | Clojure Contrib | Assembla"
12:18cemerickchouser: or, better, have AOT performed only for explicitly-named libs
12:19rhickeycemerick: no
12:19cemerickbummer
12:20rhickeywasn't even on the radar, and we're trying to wrap up
12:20cemerickrhickey: 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:20cemerickthe* future, that is
12:21rhickeycemerick: yes, also want to tackle the generated names, now we have the possibility of stable, e.g. function names
12:21cemerickOK; I'll file a ticket for it in the clojure assembla.
12:22cemerickI'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:23technomancybtw, ticket #315 would help quite a bit for reducing dependence on AOT
12:23technomancyand it's only 7 lines
12:23technomancy(for stuff that is intended for CLI usage at least)
12:25cburroughscemerick, I'm sticky with both: (.eval e (slurp* "http://www.matsblog.com/static/matsblog/files/JSON-js-prettyPrint.js&quot;))
12:25cburroughs (read-json (.eval e "eval({foo:1}).toJSONString()"))
12:25cburroughs{"foo" 1}
12:25chouser#315 is also an nice reduction in the need to use gen-class. is good!
12:25cemerickcburroughs: ah, glad it worked out for you :-)
12:26technomancyticket #315
12:26stuartsierraFor lazytest: what do people think of having assertions inside a vector, like pre/post conditions?
12:26chouserhope that's trustworthy input
12:26cemerickcburroughs: though, do you need the round trip through JSON? Surely rhino's eval returns a java.util.Map given a js object literal.
12:26technomancy~ticket #315
12:26clojurebot{: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:29cburroughscemerick, I get #<NativeObject [object Object]>
12:33tomojnot sure where this question really belongs, but..
12:33tomojif I 'sudo su', then run 'lein clean', it works fine
12:33tomojif I sudo sh -c 'lein clean' it complains that leiningen is not installed
12:33tomojI'm assuming this is an environment variable thing
12:33slyphonPATH
12:34tomojnot PATH, the error comes from lein
12:34slyphonhrm
12:34tomojit's the "Leiningen is not installed. Please run "lein self-install"."
12:34cemerickcburroughs: 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:34tomojit is installed, in /root/.m2
12:34slyphonone is running with root privs as your user
12:34slyphoni.e. your $HOME is the same
12:34tomojright
12:34slyphonthe other is actually running *as* root
12:34tomojso which env var does lein care about, I wonder
12:34slyphon$HOME, i'll bet
12:34sexpbotCommand not found. No entiendo lo que estás diciendo.
12:34tomojoh, of course
12:35cemerickcburroughs: http://stackoverflow.com/questions/2559450/rhino-how-to-get-all-properties-from-scriptableobject
12:35tomojwell, except...
12:35sexpbot"Rhino: How to get all properties from ScriptableObject? - Stack Overflow"
12:35tomojthere's no ~me/.m2
12:35cemerickcburroughs: though, watch out for the .toString that guy is using on the return from .getProperty
12:35slyphonhum
12:35cburroughsinteresting
12:35stilkov_send (on agents) and swap! (on atoms) inside a dosync get invoked only if the transaction is successful
12:35tomojthere is a /root/.m2 though
12:35stilkov_where is this documented?
12:35slyphonwhy are you running lein as root, anyway?
12:36tomojI don't know a better way to do it yet
12:36slyphonthat's a "shell script" you "downloaded off the internets"
12:36tomojwhat I really want is a systemwide install
12:36cburroughsI find it ironic that so many hoops need to be jumped through to get javascript to have decent json support
12:36tomojyeah, I trust technomancy though :)
12:36slyphonheh
12:36slyphonand somewhere, a unix sysadmin loses his wings
12:36tomojmaybe I should just have all this clojure build stuff happen offline
12:37tomojI have hudson set up already, it can run the build and drop artifacts in S3
12:37stilkov_I don't really mean invoked, I meant the functions passed to them get executed
12:37stilkov_I can't seem to find this documented in the official documentation
12:37tomoj... except the output of my build is mixed in with my source checkout because it's solr :(
12:38tomojmaybe I need to use maven
12:38chousera rhino NativeObject is apparently not at all a java.util.Map
12:38slyphonhow would you say Object[] in clojure?
12:38cemerickYeah, it's too bad that there's no easy way to get there.
12:39chouserroundtripping through another json reader is surely not necessary, but probably the shortest path to a correct solution.
12:39cemerickchouser: I'm guessing it's a quick (into {} (for ...))) away.
12:40slyphonor, i need to know how to call a varargs via wall-hack
12:40chouseryes, plus recursion, key-type coersion...
12:40cemerickcburroughs: FWIW, unquoted keys are not JSON.
12:40xeqi,(into-array Object [])
12:40clojurebot#<Object[] [Ljava.lang.Object;@12a5896>
12:40slyphonxeqi: that's an instance
12:40slyphoni guess
12:40cburroughsI meant the "toJSON" part of javascript support
12:40slyphon,(class (into-array Object []))
12:40clojurebot[Ljava.lang.Object;
12:41slyphon"ew"
12:46tomojslyphon: you were right, it's $HOME
12:46slyphonyay!
12:47tomojwhen you sudo sh -c '...', $HOME is your user's home
12:47tomojwhen you sudo su, it's /root
12:47tomojit looks like lein doesn't respect M2_HOME though..
12:47tomojor maybe I misunderstand M2_HOME's purpose
12:48chouserI'm so looking forward to Clojure's built-in abstractions being protocols.
12:49stuartsierrachouser: me too
12:49chouser(extend-class NativeObject PersistentMap ...)
12:49cemericktomoj: isn't M2_HOME only used by the mvn bootstrap scripts?
12:50slyphonvariadic args are really crap in java
12:50cemerickFYI: http://www.assembla.com/spaces/clojure/tickets/322
12:50sexpbot"#322 - Enhance AOT compilation process to emit classfiles only for explicitly-specified namespaces (New) | Clojure | Assembla"
12:51stuartsierrachouser: would that work if NativeObject were mutable?
12:51tomojcemerick: you're probably right
12:51tomojI just guessed from the name
12:52tomojthat M2_HOME would point to wherever your .m2 is
12:52tomojit always looks in $HOME/.m2, I guess?
12:52chouserstuartsierra: yeah, you'd just have to implement COW
12:52cemerickby default, yeah
12:52stuartsierrachouser: or choose a less restrictive protocol, like Associative
12:52chousergood point
12:54cemerickchouser: 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:54sexpbot"#277 - Making clojure.xml/emit a little friendler to xml consumers (New) | Clojure | Assembla"
12:54npoektophi! how to use clojure.contrib.http.agent with ssl? i want to do (http-agent "https://...&quot; ...)
12:55stuartsierranpoektop: I think you need supporting SSL libraries for Java.
12:55stuartsierraOr a better HTTP client, like Apache's.
12:56npoektopsupporting libraries?
12:56stuartsierraSSL libraries
12:56stuartsierraSSL is a pain almost everywhere, including Java.
12:57npoektophow to get and use them?
12:57stuartsierrano idea, sorry
12:58stuartsierraTry the Apache HTTP client, it may have built-in support.
12:59cemericknpoektop, stuartsierra: the JRE includes a perfectly well-functioning SSL HTTP client.
13:00chouserzipmap still doesn't use transients
13:01mmarczykany reason in particular why seq-contains? isn't defined as (fn [coll x] (some #(= % x) coll)), without the if?
13:01mmarczyk(looking at the newly promoted functions...)
13:02mmarczykahhh
13:02mmarczyk,(some #(= % 5) [])
13:02clojurebotnil
13:03mmarczykright.
13:05chouserhttp://gist.github.com/383892 -- includes at least 50% premature optimization!
13:07chousercburroughs, cemerick ^^^
13:08tomojcemerick: on the one that's in the JVM, don't you have to do funky stuff with certs?
13:08tomojat least for ssl sockets
13:09cburroughsoh my
13:10mmarczykchouser: 1s/set/set!/ :-)
13:10cemerickchouser: nice :-)
13:11chousermmarczyk: oh no!
13:11cemerickeveryone: FYI, there's a good chance that if you talk about some work you're doing, chouser will just do it for you. ;-)
13:11chouserheh. not a reputation I need. I deny it!
13:11mmarczykcemerick: spot on :-D
13:12chouserhuh, I thought extend-protocol would hint my arg for me
13:18chouseroh, of course it's the calls in the inner fn that aren't hinted. bleh.
13:19chouserthere, that's better: http://gist.github.com/383892
13:19chousernow, really, back to work...
13:25abedratechnomancy: you around?
13:26abedratechnomancy: 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:28stuartsierraDoes swank-clojure-binary work with current swank-clojure?
13:29tomojabedra: lein test exit code? or is there another problem?
13:29abedratomoj: that's the one
13:40cemericktomoj: 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:40cemericke.g. (slurp* "https://paypal.com&quot;) works just fine.
13:43joshua-choiI'm looking at the promoted seq functions. What is the difference between the intended uses of keep-indexed and map-indexed?
13:47technomancyabedra: no, I haven't had a chance to look into it. would be great if you could; thanks.
13:48tomojcemerick: oh, just ssl sockets then, maybe
13:48technomancystuartsierra: it should, but I don't know if anyone uses it, so there's a decent chance it's bitrotten
13:48tomojI was looking into not-yet-commons-ssl
13:48cemericktomoj: you mean if you were going to implement an ssl sever?
13:48cemerickserver*
13:49tomojI mean for example doing APN
13:50tomojno server, just open a socket to some server over ssl
13:50tomojI read there's something funky you have to do to use what's in the jvm
13:50cemericktomoj: is that not what https is doing?
13:50cemericksays cemerick, exposing his ignorance...
13:50tomojisn't it?
13:51tomojbut there's something funny
13:51cemericktomoj: what's APN, btw? http://en.wikipedia.org/wiki/Access_Point_Name ?
13:51sexpbot"Access Point Name - Wikipedia, the free encyclopedia"
13:51tomojapple push notification
13:51cemerickah
13:51tomojyou have to open an ssl socket with some cert and push raw bytes
13:52abedratechnomancy: cool, just forked and started digging in. When you create the java task i don't see where you would set failonerror=true
13:52tomojbut I just found a java project for it, so I will just do whatever they do
13:52abedratechnomancy: that would make ant exit non zero if the tests didn't pass
13:52abedrabut i'm looking further
13:52replacatechnomancy: does swank work with the latest clojure 1.2? I thought I saw something yesterday that indicated that it might not.
13:53cemericktomoj: 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:53tomojand what do you with the cert?
13:53technomancyreplaca: it should be fixed, yeah
13:53replacatechnomancy: do I need to pull a new one then?
13:53cemericktomoj: well, the policy files are essentially orthogonal to certificates
13:54technomancyreplaca: the fix is on clojars; that would be the easiest
13:54replacatechnomancy: got it. thanks!
13:54Raynestechnomancy: Ohai, philjure.
13:54Raynes:D
13:54technomancy...!
13:55cemericktomoj: 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:57tomojcemerick: I'm just going to save that link and hope I don't have to look at it
13:57tomoj:)
13:57cemerickyeah
13:58cemerickit's absolutely *absurd* that those policy files aren't the default yet
13:58cemerickthe export controls were lifted like, 3 years ago
13:58cemerickha
13:59cemericktechnomancy: only if I absolutely had to, but yeah.
13:59technomancyI 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:01cemerickthey're different codebases, so I take it as a given that there are differences. *shrug*
14:01rcgtechnomancy 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:02technomancyrcg: bah, hearsay. I'll believe it when I see it.
14:02technomancy=)
14:02cemerickhrm, right, I remember now: glassfish v2 wouldn't run with openjdk, but did just fine under sun's
14:02rcghehe
14:03cemerick'course, that could be bad packaging for ubuntu's openjdk, but that was enough of an experience. :-)
14:05abedratechnomancy: are there expected failures in the test suite for -stable?
14:05LauJensenI've been burned badly by openjdk as well
14:11slyphonhiredman: hey, is that colorized paren thing for emacs you were talking about "cparen"?
14:22stuartsierradoes gist.el work?
14:22slyphonstuartsierra: i was wondering the same thing
14:22stuartsierraI get "Symbol's value as variable is void: login"
14:22headiuscemerick: they're the same codebase
14:23headiussome devs still use internal working copies, but it all pushes to the openjdk repos
14:23cemerickheadius: well, now they are, but not for JDK 6
14:23cemerick?
14:23headiusthere's not much difference between 7 and 6
14:23headiusrecent updates of 6 have invokedynamic bits hidden in them
14:24headiusjust disabled
14:24cemerickhrm. Maybe it's all in the packaging. *shrug*
14:24headiusthere's only a few months lag between the hotspot that's in 7 and what gets into current 6 updates
14:24cemerickin any case, it's hard to argue with installing sun-java-6, and then having everything work after a couple hours of pain :-)
14:25headiuswe get almost weekly reports against our openssl library because of those missing policy files
14:25cemerickheadius: is that going to be resolved for JDK 7?
14:25cemerickor better, a JDK 6 update...
14:25headiusbeats me
14:25headiusit would be nice
14:28hiredmanslyphon: rainbow-paren-mode
14:28slyphonyeah? i couldn't find that
14:28slyphoni found highlight-paren-mode
14:28hiredmanbest bet may be searching clojurebot's url log
14:28slyphonwhich does colorization based on the position of the point
14:28slyphonkk
14:28slyphonty
14:29hiredmanhttp://delicious.com/search?p=rainbow&amp;chk=&amp;context=userposts%7Cclojurebot%7C&amp;fr=del_icio_us&amp;lc=0
14:29sexpbot"Search results for rainbow on Delicious"
14:29slyphonooh
14:30slyphonthanks :)
14:35tcepsaIf 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:36tcepsa(depends on == :requires)
14:36chousertcepsa: yes, though it has nothing to do with :gen-class
14:37tcepsaAll 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:38karchieI 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:39tcepsaMy 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:39cemericktcepsa: 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:39cemericktcepsa: are you doing this interactively in a REPL?
14:40tcepsacemerick: I am calling (compile 'namespace
14:40tcepsa) in a REPL, yes (sorry about the extra linebreak!)
14:40cemericktcepsa: right -- so, the namespaces required by your top-level namespace are already loaded at that point, so they won't get AOT-compiled.
14:40chouser,(next (drop-while #(not= 4 %) (range 10)))
14:40clojurebot(5 6 7 8 9)
14:40chouserkarchie: ^^^
14:41abedratechnomany: soooooooo close, just need a way to *actually* do the exit
14:41karchiechouser: there it is, drop-while. thanks much
14:42cemericktcepsa: 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:42cemerick(I think)
14:43tcepsacemerick: 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:44tcepsa:reload-all flag as well
14:44cemericktcepsa: AFAIK, compiling interactively is quite atypical
14:44cemerickYou really want to have a tool do repeatable builds for you, e.g. maven or lein
14:45tcepsacemerick: 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:46cemericktcepsa: No idea. I'm of the maven persuasion. :-)
14:46tcepsa(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:47tcepsa(At least I get the impression that Maven is involved. Perhaps that is a misconception on my part as well.)
14:47cemerickIt's pretty simple to get started with IMO, but you'll find a lot of disagreement there.
14:48tcepsaAll right, I'll have a look at both of them and see whether I can get it working. Thanks!
14:48cemericktcepsa: 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:48sexpbot"Why using Maven for Clojure builds is a no-brainer - Chas Emerick - Muck and Brass"
15:01stuartsierraStarting to think a real I/O library should use java.nio instead of java.io.
15:02chousersounds right
15:02danlarkinio and nio have different use cases I think
15:02stuartsierranio is lower-level
15:02chouserI'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:03danlarkinnio is async, so when that's not what you want, you don't want nio
15:03chousernio has sync methods
15:04chouserhttp://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html#read(java.nio.ByteBuffer)
15:04sexpbot"FileChannel (Java Platform SE 6)"
15:04chouserreturns number of bytes read.
15:05stuartsierraThe combination of asynch I/O and Clojure's thread protections might be very powerful.
15:06danlarkinmaybe I misjudged nio
15:06arkahnhas 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:11abedratechnomancy: We've got something that is "working" http://gist.github.com/384079 but I fear that we've missed something here
15:11abedraespecially with shutdown-agents
15:12abedracan you take a quick look and tell me what is wrong?
15:14arohnerstuartsierra: what kind of shape is clojure-rdf in?
15:15stuartsierranone
15:15stuartsierrait is unfinished, unmaintained, and unloved
15:15arohnerstuartsierra: hah, ok. thanks
15:15stuartsierranp
15:16stuartsierraI need to flag most of my github projects as "disowned"
15:16slyphonas a general rule, when you have multiple arities of a function providing default values, should you "call your way up the chain"?
15:17chouserslyphon: not necessarily, though that removes duplicated default value.
15:17chouserOther than that, not much wrong with just calling the real implementation.
15:18slyphonk
15:19chouserdepending 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:19slyphonhmmm
15:20slyphoni hadn't thought of that
15:20slyphondestructuring the & more
15:20LauJensenchouser: Doesn't that go directly against the code-standard which says its better to unroll args ?
15:20slyphoninteresting :)
15:20chouserLauJensen: heh, could be. where is that doc again?
15:20LauJensenassembla I think
15:21chouserhttp://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards
15:21sexpbot"Clojure Library Coding Standards | Clojure | Assembla"
15:21LauJensenhmm
15:21LauJensenUnroll optional named arguments. Callers should not have to wrap optional named arguments in a map literal:
15:21LauJensen
15:21LauJensen(release-sharks 2 :laser-beams true) ; good (release-sharks 2 {:laser-beams true}) ; bad
15:22tcepsaIs there a way to read in data structures (e.g. vectors or maps) from some kind of config file at runtime?
15:22chouserLauJensen: that's not what I'm talking about
15:22LauJensenchouser: oh, sorry
15:22chouserthe 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:23slyphonyeah, i was just using this
15:23chouserwhich is related, but doesn't advocate exclusively one way or the other.
15:23slyphoner, reading this
15:23LauJensen$(read-string "{:one 1 :two 2}")
15:23sexpbotresult: {:one 1, :two 2}
15:23LauJensen@ tcepsa
15:23slyphonhmm
15:24tcepsaPerfect!
15:24slyphonif *blah* is only meant for rebinding, is there a convention for vars that are meant to be constants?
15:24chouserslyphon: yep. all lower-case, dash-separated words.
15:25slyphonoh
15:25cemerickI like the +constant+ convention
15:25chouserfor example: clojure.core/drop-last is a constant. don't change its value to some other function please.
15:25cemerickmost others don't, I suppose
15:25slyphonheh
15:25slyphoncemerick: is that CL?
15:25cemerickslyphon: I think that's its origin, yeah.
15:26cemerickThough I'm no CL expatriot. :-)
15:26cemerickI just like to distinguish what are really, honestly constants, vs. fns and other defs that you *could* rebind if you needed to.
15:28chouserthere are some interesting non-Cartesian maths out there!
15:29abedrachouser: others have tried http://en.wikipedia.org/wiki/Indiana_Pi_Bill
15:29sexpbot"Indiana Pi Bill - Wikipedia, the free encyclopedia"
15:29pjstadigI might like the +constant+ convention more if there was actually a way to make constants
15:31LauJensenClojure: The Lisp that makes Perl dynamic
15:31cemerickdefonce should probably have prevented rebinding
15:31pjstadignot only for constantness, but also for speed
15:31pjstadiglike symbol macros or something
15:32cemerickwell, direct linking is already there, although I don't know how to use it.
15:32pjstadigyeah i may be out-of-date...ignore me
15:34chouserdirect linking isn't yet available for general use
15:34technomancyno, pretty sure you can't opt-in to direct linking
15:34cemerickah, I thought it was floating around in there somewhere
15:34technomancyeven so you can always with-ns+redef
15:34slyphonLauJensen: huh?
15:34technomancynot to mention alter-var-root
15:35LauJensenslyphon: Just saying, you and me read -> ->> -?> @ #() % etc as plain english, but new-comers will stumble
15:35slyphonah
15:35slyphonindeed
15:36slyphona little confusion is good every once in a while
15:46remleduffrhickey: 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:48technomancyabedra: sorry, headed off for a while; will try to look at that tonight.
16:52wthiddenIs there a known issue with partial in the latest clojure build?
16:54chouserI've not heard of one
16:55wthiddenhmm the issue is as follows
16:56wthiddeni 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:56abedratechnomancy: no worries
16:56wthiddenbut the issue may be that within this function x I make another partial
16:57wthiddenthat is this the current function, sorta of a self-reference partial.
16:57wthiddenit used to work, pre-1.2
16:58chouserwthidden: can you paste a small example that generates the error?
16:58clojurebotapi examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
16:58wthiddenno blows up NoClassDefFoundError
16:58wthiddensure
16:58wthiddento where should i paste?
16:59chouserhttp://paste.lisp.org/new/clojure
17:01hiredmanfyi, http://delicious.com/clojurebot/pastbin
17:01sexpbot"clojurebot's pastbin Bookmarks on Delicious"
17:02technomancychouser: I wonder if you could get lisppaste back in here if you set it so unregistered nicks weren't banned
17:02chousertechnomancy: ooh! could be...
17:02chouserOr if lisppaste8 registered itself
17:02chouserI have the authority to do neither.
17:03wthiddenhttp://paste.lisp.org/+241S
17:03technomancyoh, you can't change the channel policy just by being an op?
17:03wthiddenis the paste
17:03chouserI don't have op.
17:03technomancyoh, bummer
17:03chouserI 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:04technomancy=\
17:04chouserwthidden: thanks, but that refers to several unreferred vars
17:05wthiddenoops
17:05wthiddenok..
17:07wthiddenhmmm here is the def for substitute-sym http://paste.lisp.org/+241T
17:08chouserwthidden: 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:08wthiddenhmmm trying to make it smaller.
17:08chouserthanks
17:09wthiddenso what is somewhat strange is the i can call resolve-task-symbols fine
17:10wthiddenand i think it creates a partial of itself without issue.
17:10wthiddenbut the closer i look at the def it may not call the parital with the test data i give it.
17:13wthiddenwhen test data is a sequence gives the same error.. working on a simpler example.
17:14arohneris there another way to create the symbol "^" aside from (symbol "^")?
17:15arohner\^ doesn't seem to work
17:15arohneror '^
17:15chouserarohner: that's not a valid symbol
17:16arohnerso then why does (symbol "^") work?
17:16chouser'symbol' is overly permissive
17:16arohnerchouser: ok, thanks
17:17chouser,(read-string (pr-str (symbol "(+ 2 3 4)")))
17:17clojurebot(+ 2 3 4)
17:17arohnernice
17:17chouser,(read-string (pr-str (symbol "foo")))
17:17clojurebotfoo
17:17chouser,(read-string (pr-str (symbol "^")))
17:17clojurebotjava.lang.RuntimeException: java.lang.Exception: EOF while reading
17:18chouserthat a somewhat better way to check, though really you're only safe using the chars listed at http://clojure.org/reader
17:24wthiddenok how about this paste: http://paste.lisp.org/+241X
17:24unlinkam I missing something here? (reify IFoo (bar ([] 0) ([a] 1)))
17:24unlinkWhy can't I do this?
17:27wthiddenchouser: 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:28chouserwthidden: ok
17:29chouserwthidden: that last paste produces your error?
17:42remleduffWhy is it read-"string" and pr-"str"?
17:42remleduffVowel shortage?
17:44remleduff,(read-string (pr-str (symbol "\u2038")))
17:44clojurebot
17:45remleduff,(read-string (pr-str (symbol "\u02c4")))
17:45clojurebot˄
17:45remleduffSo many hats
17:51unlink,(reify Object (toString [] ""))
17:51clojurebotjava.lang.Exception: Unable to resolve symbol: reify in this context
17:57DavideAngelocolahi all
17:58unlinkah. reify is different from proxy.
18:01DavideAngelocolaI'm trying to use swank with maven but .. http://gist.github.com/384329
18:01DavideAngelocolaany idea?
18:07remleduffI 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:08remleduffHmm, but you have contrib set to 1.1, so that shouldn't be the problem you're seeing
18:09remleduffMaybe you have an extra contrib 1.2-SNAPSHOT jar lying around somewhere
18:13DavideAngelocolaI'm trying updating to clojure 1.2-SNAPSHOT
18:15remleduffI'm not sure swank works with the newest snapshot, I think it doesn't
18:18DavideAngelocolaindeed, still the same error :(
18:18arohnerremleduff: I'm getting a lisp reader error
18:19remleduffarohner: Those were silly play examples, the ^'s you get out of them won't actually be useable for anything resembling ^{metadata}
18:27arohnerI 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:31arohnerok, I'm having problems building my new changes
18:31arohnerCaused by: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Named
18:38technomancyclojure-test-mode may also need an update
18:40arohnertechnomancy: what is the deal with src/winston/rpc.clj? its formatting is all kinds of screwed up
18:41arohnersorry, src/swank/rpc.clj
18:45etatehey, why aren't monads idiomatic?
18:48technomancydon't look at me, I'm just the maintainer. =\ that's seriously ancient code
18:55ataggartetate: who said they weren't and in what context?
18:57etateataggart: stuarthalloway at disclojure.org 28th april
18:58etate"Number of monads in Clojure 1.0: Zero. In 1.1: Zero. In 1.2: Zero. Monads are not idiomatic "
18:58ataggartlink?
18:58clojurebotyour link is dead
18:59etateataggart: http://disclojure.org/2010/04/28/today-in-the-intertweets-april-28th-ed/
18:59sexpbot"Today in the Intertweets (April 28th Ed) | disclojure: all things clojure"
18:59etatei just don't get whats not idiomatic about monads in a mostly purely functional programming languge
19:02mmarczyketate: I prefer to take that to be a statement of the present state of affairs
19:02zakwilsonI'm inclined to say that most of the things you'd want to do with monads are easier by other means in Clojure.
19:02mmarczykafter all, people don't seem to be writing lots of monadic ("explicitly monadic"?) code in Clojure
19:02zakwilsonThat said, I'd really like it if that port of Parsec was usable.
19:02ataggartthe quote is "Number of monads in Clojure 1.0: Zero. In 1.1: Zero. In 1.2: Zero. Monads are not idiomatic #clojure.:
19:02mmarczyksay goes for Scheme, even when it's being used in a purely functional manner (which it often is)
19:02ataggartwhich I take to mean Stuart is drawin a conclusion based on the lack of usage of monads
19:03ataggartit's twitter, don't read too much into it
19:03etateokay :)
19:03mmarczykif "idiomatic" means "widely used by the community", then he's right
19:03mmarczykif it were to mean "shouldn't be used cause it doesn't mesh with the language"
19:04mmarczykwell, he's entitled to his opinion :-)
19:04ataggartmeh, I don't care either way. IT's a tweet. Use monads if you want.
19:04ataggartthere are more important things to get worked up over
19:05etatei was more just curious as to why he said it, rather than getting worked up
19:05etateas in i didn't know whether it was referring to monads in the implementation of clojure, or in daily usage or ?
19:06mmarczykmust be the impl given the 1.0-1.1-1.2 tags
19:06etatei thought maybe he had something else in mind than monads which solve the same problems
19:06etatebut is more idiomatic
19:07mmarczykyeah, like impure functions and ref types for mutable state :-)
19:07etatelol, not exactly what i had in mind :)
19:08ataggartI have hopes that some day I'll grok monads.
19:08zakwilsonLists, or seqs in Clojure are pretty obviously monads - just not explicitly so.
19:08arohnerataggart: a monad is just a set of rules for chaining together function calls
19:09etateyeah was just going to say that i thought let etc was basically monadic
19:09ataggart"monad" and "just" don't belong in the same sentence
19:09ataggartso comp is a monad?
19:10etatewell, if stuart says there are no monads, i guess not?
19:10ataggartsmells like monad is more adjective than noun
19:10etate:p
19:10mmarczykmonad is a way of making a more funky comp :-)
19:10arohnerataggart: sort of. monads have an "interface" for how to chain function calls
19:10arohnercomp is a way of chaining together that doesn't follow the monad interface
19:10arohnerhuh. That would be an interesting blog article
19:10arohnermonads for java programmers
19:10arohnerdefine monads as java interfaces
19:12zakwilsonI think the definition of return for Clojure seqs would be #(apply concat (map %1 %2))
19:12zakwilsonerr... bind
19:14zakwilsonreturn is #(seq [%])
19:21arohnerto the people who are having problems with swank-clojure + clojure-1.2-SNAPSHOT, try out my branch
19:21arohnerhttp://github.com/arohner/swank-clojure
19:21arohnerhttp://clojars.org/org.clojars.arohner/swank-clojure
19:21sexpbot"swank-clojure | Clojars"
19:21arohnerI had some problems, and then it magically started working, so I *think* it works, but I'm not 100%
19:22arohnerif you have problems, tell me on github
19:27technomancyhang on, if you have trouble with my fork tell me too. =)
19:28arohnertechnomancy: you already have 1.2 fixes?
19:28technomancyarohner: I believe so, are you having issues?
19:28arohnertechnomancy: yeah, with #^ in swank source
19:28technomancyarohner: jochu's fork?
19:29arohnertechnomancy: yours
19:29technomancyinteresting... I thought that had been cleaned up a long time ago.
19:30arohnerit's not in master. maybe another branch?
19:31arohnerok, my branch is *not* working, but I have to run
19:31technomancyarohner: oh wait, #^... I was thinking of using ^ as meta
19:31technomancywhich has been removed
19:31technomancywhat's wrong with #^?
19:32arohnertechnomancy: http://github.com/richhickey/clojure/commit/a5ca8243e3ea45e6387b2b00d0e9b2624d16adbf
19:33arohnergetting rid of old ^'s was the first step towards #^ being replaced with ^
19:33arohnerI gotta run
19:33technomancyI think it's just that ^ and #^ become the same thing
19:34technomancypretty sure #^ is not going anywhere
19:34technomancysince we haven't seen any deprecation warnings for it.
19:53mmarczyktechnomancy: not yet
19:53mmarczykhttp://clojure-log.n01se.net/date/2010-04-26.html#08:57
19:53sexpbot"#clojure log - Apr 26 2010"
19:53technomancyI hope that's pretty far down the line
19:53technomancysince it will make it impossible to be backwards-compatible
19:54technomancymaybe for 2.0?
19:54mmarczykright... though ^String is *so much prettier*!
20:00rhudsonLooks like the logbot is dead -- the last entry for today is about 7 hrs ago
20:10alexykso... is ^ already the replacement for #^ in the trunk?
20:14chouseralexyk: yes
20:14alexyknicee
20:51alexykwhat's the shortest wy to test that ^ works instead of #^, in repl?
20:52alexykway
20:52mmarczyk^#'+
20:52qbgCall meta on something read in using it?
20:52mmarczykif the above doesn't work, then presumably ^String foo will
20:52_ato,'#^inc
20:52clojurebotEOF while reading
20:53_ato,'#'inc
20:53clojurebot(var inc)
20:53mmarczyk,(meta '^foo foo)
20:53clojurebotjava.lang.Exception: Unable to resolve symbol: foo in this context
20:53_ato,'^inc
20:53clojurebot(clojure.core/meta inc)
20:53mmarczyk,(meta '#^foo foo)
20:53clojurebot{:tag foo}
20:53_ato,(= (name (first '^inc)) "meta") ; heh, ugly
20:53clojurebottrue
20:54alexykso, clojurebot knows about ^ already?
20:54alexyk~ how do you know anout ^?
20:54mmarczykno, it still uses it to mean (meta ...)
20:54clojurebotExcuse me?
21:04tomojanyone happen to be around who's made a custom assembly descriptor?
21:13unlinkIt seems that leiningen didn't expect the promotion of seq-utils to core.
21:14unlinkThat 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:24unlinkHow do I tag a function as returning void? (for reify)
21:32eslickWhen 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:32eslickSo I have to manually compile the files
21:33eslickIs there a method by which this should happen automatically?
21:37leifwany clojure-hadoop users around?
21:37leifwI need some help figuring out how to submit a jar
21:52mmarczykeslick: actually you only have to (require ...) your namespaces at the REPL
21:52mmarczykeslick: or (use ...) them, or do your work (in-ns your-namespace)
21:53eslickI do in-ns
21:53eslickBut the namespace is not defined after connecting to clojure via swank
21:54eslickSo the /src directory is properly on the jvm classpath
21:54eslickBut none of the functionality in the .clj files are loaded
21:54mmarczykseems to work for me
21:54mmarczykwith the latest (unstable) leiningen
21:55eslickHow do I upgrade to unstable?
21:55mmarczykyou mean you can't call your functions?
21:55eslickYes
21:56mmarczykum, strange
21:56mmarczykand which version of Lein are you using?
21:56mmarczykthe repo's here, btw:
21:56mmarczykhttp://github.com/technomancy/leiningen
21:57mmarczyksee the README for instructions on how to set it up
21:57eslickBetter to stick with the leading edge?
21:58eslickI was on 1.1.0
21:58mmarczykwell, no, I thought it was more reasonable to stay on 1.1
21:59mmarczykif it does its job fine
21:59eslickExcept of course it's not (although more likely it's operator error)
21:59mmarczykbut if it doesn't, the checkout way might be worth a shot
21:59eslickBeen 5 years since I've used Java and I've got common lisp hardwired in my head
21:59mmarczykclasspath issues certainly are a pain
22:00mmarczyknot sure this is one of them, mind you
22:00eslickSo if I have a file in src/com/project/core.clj
22:00somniumencountered a problem once where (swank-clojure-project) worked but lein swank + slime-connect didnt
22:00eslickwith (ns com.project.core (:use ...))
22:00eslickWhen I connect, I should be able to do in-ns and then call the functions from that file, correct?
22:01mmarczyksomnium: do you know what the problem was?
22:01slyphonyou have to require them
22:01somniumand at the repl (use 'com.project.core)
22:01slyphoneslick: (require 'com.project.core) first
22:01mmarczykyou should be able to do (in-ns 'com.project.core), if that's what you want
22:01hiredmaneslick: in-ns just creates a namespace with the name you give it and puts you in it
22:01mmarczyktried that a moment ago and it worked for me
22:01hiredmanit doesn't load any files
22:01eslickSo if I have a large system, I have to (require all the namespaces I may depend on?)
22:01somniumI have no idea, we kind of shotgunned it
22:02mmarczykhiredman: I just started lein swank on Leiningen itself
22:02mmarczyktyped in (in-ns 'swank.swank)
22:02mmarczykthen I could do (start-repl) just fine
22:02slyphoneslick: i've found having a foo_init.clj file is useful, with the requires for a given level of the project
22:02hiredmanmmarczyk: lein may load your stuff for you
22:02mmarczykbut not for eslick? :-)
22:03hiredmanat work we gen-class something with a java main and do java some.class.here
22:03slyphonand then in user.clj i have a repl-init function that does requires of those _init.clj files
22:03hiredmanmmarczyk: regardless of what lein may or may not do, I know what in-ns does
22:03mmarczykhiredman: no argument about that
22:03slyphon:)
22:03hiredmanmmarczyk: which was what I told eslick
22:04eslickDoes require recursively load everything that the namespace so required depends on?
22:04mmarczykhiredman: 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:04mmarczykeslick: yup
22:05hiredmanwell, it's not that require is recursive, it is that those files also call require
22:05eslickslyphon: where do you put the foo_init.clj file so it's run on startup?
22:05eslickAh, of course.
22:05eslickIt does take a bit to rebuild ones mental model of the world.
22:06slyphonwell, for the repl, if you have a user.clj in the classpath, it's automatically required
22:06eslickAny clojure gurus in the bay area looking for full time jobs or a short term consulting contract? :)
22:06slyphoni dunno if that's true in other cases
22:07mmarczykhm, I wonder if I'm wrong about lein vs. in-ns actually
22:08mmarczykapparently I am
22:09mmarczyksorry for introducing confusion then
22:10leifwI submitted a job to my hadoop cluster, as a jar, with main class clojure_hadoop.job and a mapper my.namespace/mapper-function
22:10leifwand I get a classnotfoundexception for my.namespace
22:10leifwhelpz!
22:11eslickSo the answer to my original question is 'require
22:11hiredmando you have a class named clojure_hadoop.job?
22:11eslickThank you everyone for the help
22:11eslick!
22:11leifwhiredman: that's part of the clojure-hadoop library
22:11eslickAnd I was serious about the job opportunity...
22:11leifwI built this jar with lein uberjar, so it's finding that
22:12leifwit doesn't get the classnotfound until it tries to load the mapper function in my namespace
22:12hiredmanleifw: and do you have a class named my.namespace?
22:13hiredman(if you don't that would be the reason you get the class not found exception)
22:13leifwno, I don't know why it thinks that's a class
22:13mmarczykeslick: try posting your offer to the ggroup maybe :-)
22:13leifwoh hang on maybe I remember this
22:13hiredman
22:14eslickmmarczyk: good suggestion. Lispjobs too
22:14mmarczykright
22:14leifwriiiiiiiiiiight I have to add a :gen-class
22:14leifwno clue why this was working on my machine then
22:15leifwthanks, hiredman
22:15leifwoops
22:15leifwnope
22:15leifw:-/
22:15leifwI guess I'll bang on this later
22:20chessguyis there a typical way to raise/throw an error in clojure?
22:21slyphonclojure.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:24rhudson,(throw (RuntimeException. "yowza"))
22:24clojurebotjava.lang.RuntimeException: yowza
22:24slyphon_brian2_: either install them locally, or make a clojars acct
22:25_brian2_slyphon: how do I install locally?
22:26slyphonmaven will tell you when it can't find a dependency
22:26slyphonlooks something like:
22:26slyphonmvn install:install-file -DgroupId=org.powermock.modules -DartifactId=powermock-module-testing -Dversion=1.3.7 -Dpackaging=jar -Dfile=/path/to/file
22:26slyphon(that one was due to a typo)
22:27_brian2_so I need to run maven?
22:27slyphon"run maven"?
22:27slyphonmaven keeps a cache of stuff in ~/.m2
22:28slyphonit'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:29slyphonwell, leiningen is a thin wrapper of awesome around maven
22:29slyphonat least in the "handles your dependencies" regard
22:30_brian2_well, if I have a jar file, I shouldn't need maven
22:31_brian2_its already built
22:31_brian2_I just want to call it in the leiningen project
22:33alexykhow do I make lein work with clojure/c.c. trunk?
22:36lithper1_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:53vu3rdd /quit