#clojure logs

2010-04-10

00:05technomancysweet; jumped to #18 on the github high-score list: http://github.com/languages/Clojure
00:13defnyay!
00:13defnexplaining why using clojure is a good idea to non-technical types is very challenging
00:14defnthe second i mention MVCC and STM they get on the defensive
00:15lancepantzi wouldn't even mention those to non-technicals
00:16defnlancepantz: it's tough not to, but yeah you're probably right
00:16defnlancepantz: how would you pitch it in a way that doesn't make it sound like "just another toy language"
00:17hiredmana. functional b. lisp c. libraries
00:17hiredmandone
00:17lancepantzthe thing that helped me sell it the most was the ability to use that java libs
00:18lancepantzs/that/all the/
00:18lancepantzthat in addition to the performance
00:18lancepantzit was either clojure or c++ for us
00:19defninstead of saying lisp right away i like to say it means more modular code, talk a little bit about the benefits of a functional language when it comes to testing and changes
00:19hiredmaneach of those three things can be expanded further
00:19defnand then i say "oh and it's a lisp...but it's not scheme"
00:19hiredmanand I think rhickey calls c. "embracing a platform"
00:20defni heard a funny interview with rich not too long ago where he gave the advice when pitching clojure to say it's just java, "it's a jar file!"
00:20technomancyit's lisp, but it's not scheme, and it's not from the 80's.
00:20lancepantzthat's basically what we did
00:21defn"this ain't yo daddy's lisp-- and yet it is (but only the good parts)"
00:21lancepantzmy boss is far more concerned about switching to tokyo cabinet from postgres than ruby to clojure
00:21slyphondefn: that's actually a good pitch
00:21lancepantzhe's technical though, so different point
00:21slyphonlancepantz: owah, postgres -> tokyo cabinet
00:22slyphonuh, wut?
00:22lancepantzhahah
00:22lancepantzit's a graph db
00:22defni usually find that im talking to a range of people, some moderately technical, some technical in other areas, some non-technical
00:22defnthe trouble is they talk and someone who has a moderate understanding of lisp starts spouting off the myths to non-tech folks
00:22defnthings go down hill from there
00:23defnand when i say moderate understanding i mean they have seen lisp code before, and they didnt like it
00:24technomancycollege scheme classes, I bet. =)
00:31defn:) indeed
00:35Licensergreetings
00:40Licenserso defn your walton page is really cool :)
00:41lancepantzlink?
00:41clojurebotyour link is dead
00:41lancepantzheh
00:41hiredman~botsnack
00:41clojurebotthanks; that was delicious. (nom nom nom)
00:58defnLicenser: thanks -- id really like to do some automatic indentation stuff, but that looks to be /hard/
00:59defnto turn these long one-liners into readable blocks
00:59defnlancepantz: getclojure.org:8080/examples/concat , replace concat with a fn name -- very much a WIP
01:01lancepantzoh wow
01:01lancepantzthat's awesome defn
01:01lancepantza very needed resource
01:02defnlancepantz: if you'd like to help out im trying to get it into more of a "finished" mode by adding some filters, javascript noshow for the results, and ultimately a way to "vote" for examples, or at least "favorite" them or something
01:03lancepantzdo you have it on github?
01:03defni do
01:03defnhttp://github.com/defn/walton
01:04lancepantzcool man, i'll look through it and see if there's anything i can do
01:04lancepantzso does this only pull examples parsed by clojurebot?
01:09defnnope, it run's licenser's awesome sanbdox
01:09defnit goes through and finds all of the valid sexps in all of the #clojure logs and then runs them in the sandbox
01:09Licenserheh thanks defn
01:10lancepantzit would be cool to source the mailing lists as well
01:10defnLicenser: query: why doesn't juxt work? Is that not an approved fn?
01:10defnlancepantz: oh that will come!
01:10defni have big plans, but i need to focus on getting the basics working
01:10Licenserlet me see
01:10Licenser(doc juxt)
01:10clojurebot"([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
01:11LicenserI think we forgot it :P
01:11defnLicenser: they all must fail in the sandbox i think
01:11defnoh, or that! :)P
01:12LicenserI think because it is alpha ut I'll add it
01:14Licenser0.2.13 should be up spj
01:14defnspj?
01:15Licensernow I think
01:15defnah yes, thanks Licenser
01:16Licenserdefn: you can whitelist functions on your own you know that?
01:17defnLicenser: yes but i like working with your official version because a.) you know what you're doing whereas i do not, and b.) if this is distributed it will be with your official version anyways :)
01:18Licenserheh
01:18Licenseryea but you can get things faster :P
01:21defnLicenser: do you have any suggestions for re-indenting one-liners?
01:22Licenserhmm yes some
01:27LicenserA) identation deepth 2 sapaces behind the opening (
01:28defnwould you use something like fnparse?
01:28LicenserB) Don't split functions with only native values (only after 80 chars)
01:28LicenserI have no clue didn't got fnparse to work :P
01:28defnyeah me either yet! :)
01:28defnLicenser: what do you mean native values?
01:28Licensernon functions
01:28defnah okay
01:28Licenseras 2 or 'bla or :bla or "bla"
01:31defnLicenser: hmm, those aren't bad ideas
01:31defnkind of like how emacs does it
01:31defn(i think)
01:32Licenser*nods*
02:08tomojam I repeatedly disconnecting or something?
02:12Licenseryes
02:17Licenserdefn: perhaps the enclojure project can give you sime ideas about code formating since they have something like that and I think it is written in clojure :P
02:22Licenserthen again browsing the code it looks very NB specific
02:24mikemis there a more idiomatic way to set an atom to a certain value other than (swap! atom (fn [_] value)) ?
02:30Licensermikem: there is constantly
02:30Licenser(swap! atom (constatly value))
02:31mikemLicenser: ah, cool :) that'll do it. thanks
02:33LicenserI found that some time back I wrote me a static function like (defn static [v] (fn [& _] v)) ;)
02:47_ato,(doc reset!)
02:47clojurebot"([atom newval]); Sets the value of atom to newval without regard for the current value. Returns newval."
02:47_atomikem, Licenser: ^
02:47Licenserah sneaky
02:48LicenserI used it in update in so not in swap :) but always good to know
02:48mikem_ato: haha cool
02:48Licenserhmm so _ato what do you think want to bang our heads together and make a really good search lein dependency thingy stuff for clojars?
02:49_atoah yeah
02:49_atoyou were talking about description
02:49Licensercool :)
02:49Licenseryap
02:49Licensersince they all have a short description text it'd be awsome if it would be possible to search those
02:49_atoas maven central is quite useful to search as well
02:50Licenser*nods* But from where I stand clojars is more important since it are 'true' clojure libraries there
02:50_atoyeah
02:50LicenserI mean in an ideal world we'd just install clojure libs that have dependencies to java libs :P
02:52Licenserbut the index you serve now is really cool I'll go and use that in the next push of lein-search since it saves so much time, bandwith and effort
03:01Licenserso it'd be nice to have like a third entry in the map that gives the description but I'm not sure if that would break lein if copied in
03:07_atoI'll make a seperate "full" feed that has the description. It'll probably be a gzipped text-file with one map per line that looks like: {:group-id "org.clojure" :artifact-id "clojure" :versions ["1.0.0" "1.1.0" "1.2.0-master-SNAPSHOT"] :description "Clojure is a functional Lisp on the JVM."}
03:09_atomight extend it with github url at some point as well
03:09Licenser_ato: sounds good
03:09_atoimagine: lein clone clj-sandbox
03:09LicenserI can give you some code to sort version number :)
03:09Licenseryea that'd be awsome
03:10_atoit's alright, I've already got a function for sorting maven version numbers
03:10Licenserokay
03:12IntertricityHow far do you think ClojureCLR is from a binary release?
03:15Licenser_ato: I currently use something like this as data:http://gist.github.com/361886
03:15Licensergrrr
03:15Licenserhttp://gist.github.com/361886
03:15Licenserthere w/o data:
03:30dcnstrctI'm getting this error when I do an insert using contrib/sql but only from inside emacs: No matching method found: println for class clojure.proxy.java.io.StringWriter
03:30dcnstrcthas anyone seen it before ?
03:34Licenserthere we go _ato lein-search now reads your index file :)
03:35Licenserand only 8 KB isn't that much traffic
03:37_atocool
03:41Licenseryap
03:41Licenserand way easyer :P
03:41LicenserI don't have to do all the silly web crawling
03:46Licenseralso this is very cool since lein search now has no non java/clojure deps
03:48dcnstrctnow just remove any dependencies on Maven and you're done.
03:48dcnstrct;)
03:49Licenserlein search isn't dependant on maven :D
03:49Licenserwow my read-line is silly
03:49Licenserit just returns nil (without waiting for input) and dies with a NPE
03:50Licenserthat is a very unnice and ugly behaviour!
04:00Licensereveryone ever experienced that behavior or read-line?
04:03vIkSiThi all
04:03vIkSiTanyone still awake? :)
04:03vIkSiTI'm trying to wrap my head around monads - some inputs would be useful!
04:03Licenseryap
04:03LicenserI don't know monands so
04:06vIkSiTLicenser, ah well
04:06hiredmanhttp://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads/
04:11glogichi
04:11glogicjesus
04:12vIkSiThiredman, ah was planning to see that
04:12Licenserheh
04:12vIkSiTI guess my main problem is - I'm trying to find a usecase for monads, or rather..
04:13vIkSiTan understandable reason for why I should learn/use them
04:13glogichiredman: that's a good one
04:13glogichiredman: now that i can send to the channel again
04:14glogicfreakin nickserv
04:15Licenserheh
04:22_atoLicenser: http://clojars.org/repo/feed.clj.gz
04:26bsteuberwhich hook do I need to set in order to enable paredit for slime repls on default?
04:26Licenser_ato: tanks!
04:27_atobsteuber: (add-hook 'slime-repl-mode-hook 'turn-on-paredit)
04:27Licensersweet!
04:28_atobsteuber: where turn-on-paredit is: (defun turn-on-paredit () (paredit-mode t))
04:28bsteuber_ato: thank you :)
04:29bsteuberI use +1 instead of t
04:29bsteubercopied from another tutorial I guess :)
04:29Licenser_ato: that is damn sweet!
04:30RaynesI don't know why, but my REPL is the one place where I don't use paredit or syntax highlighting.
04:31RaynesI wouldn't mind the highlighting, but I think I'd rather stick with no paredit in the REPL for quicker debugging.
04:31_atoLicenser: let me know if there's anything else from the POMs you want in it, it's trivial to add. Here's the code that generates it: http://github.com/ato/clojars-web/blob/no-db/src/clojars/feed.clj
04:38Licenser_ato: *nods* thanks a lot
04:38Licenserso I am still stuck with a very odd behavior of readline
04:40_atoah
04:40_atoyeah
04:40_atoinput doesn't work properly inside lein
04:40Licenserhmm can someone try it if it is a local and or global problem? http://github.com/Licenser/lein-search/downloads there is the jar just drop it in some lein lib folder and try lein add sandbox
04:41Licenserhrm it worked yesterday oddly enough
04:41Rayneshttp://github.com/SFEley/candy/blob/2f964916961a2dcccbb374cd389520ac2ac62226/LICENSE.markdown
04:43_atoNPE
04:43Licenseryea I've the same problem :( that is very sad
04:43Licenserhmm might be because I updated lein today
04:43Licenserthis is a show stopper for lein search somewhat :(
04:45LicenserI of cause could make it non interactive but that would be only half as helpful
04:46_atotry using System/in directly
04:46_atojust give (.read System/in) a try, you can wrap it in a bufferedreader to get readline later if needs be
04:47Licenser*tries that
04:48Licenserah that works sneaky, binding Systen in to *in* doesn't wokr
04:49_ato*in* has to be a PushbackReader IIRC
04:49_ato,(doc *in*)
04:49clojurebot"; A java.io.Reader object representing standard input for read operations. Defaults to System/in, wrapped in a LineNumberingPushbackReader"
04:50Licensersneaky sneaky
04:50_atoso maybe... (binding [*in* (-> System/in (java.io.InputStreamReader.) (clojure.lang.LineNumberingPushbackReader))] ...)
04:51Licenser_ato: how does it come that you know so much and I know so little :P
04:51Licenserand that does the trick :D
04:53_atoI've read a fair bit of Clojure's source code and I used to work as a Java developer so I guess I've picked up a few bits and pieces. :-P
04:53Licenseroh then I pittie you for suffering as a java developer ;)
04:55sthuebnerLicenser: well the language is not so horrible. You can e.g. create something like Clojure with it
04:56LicenserI'm sure you could create clojure in brainfuck
04:56sthuebneror whitespace for that matter... sure
04:57Licenserwhich does not make them useful languages, we are just very very very lucky that rhicky jumped the bullet for us and did the task :P
04:58LicenserSince I know of clojure I even less see a reason for java.
04:59LicenserThere are way worst things then java so
04:59bsteuberLicenser: for me it's the other way round - since I know clojure, I finally know see reason in Java again :)
04:59Licenserbsteuber: for the JVM yes :P for java, no
05:00Licenserthey now could close the entire java world down, continue to make this very nice JVM and just let us write clojure and be happy for ever after!
05:01quotemstrJava isn't all that bad, honestly. It gets a bad rap, but it's far better than PHP.
05:01Licenserquotemstr: that is true
05:01Licenserand java has improved
05:01bsteubernot to mention c++
05:01Licenserbut there was a point where you couldn't add a Integer and a int :P
05:01glogicquotemstr: i usually consider Java as an implementers language like C
05:01quotemstrA lot of people will be stuck with their late-90s prejudices until the day they die.
05:01Licenserwithout typcastig, creating objects or anything that odd
05:02sthuebnerquotemstr: I second that.
05:02Licenserespecially in the latest releases sun has fixed somet things that were really bad
05:03sthuebnerConsider this: Lisp was there for several decades and only few people knew about it.
05:03quotemstrwas? Hey! I still write Common Lisp. :-D
05:03dcnstrctthey should stop trying to add dynamics to java and just let it die already instead of trying to pretend that it can do the same types of things that dynamic languages can do.
05:03sthuebnerJava if nothing else, was prepared the way for a new wave of Lispians
05:03sthuebnerquotemstr: Good on you!
05:04glogichttp://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
05:04sthuebnerdcnstrct: totally agree
05:04dcnstrctstevey rules
05:04glogicdcnstrct: love that article
05:04Licenserbut adding dynamic to java means adding dynamic to jvm which means clojure gets evenb etter :P
05:06dcnstrctdoes that mean clojure may get tail call optimization one of these days ? or is that impossible
05:06quotemstrSo you don't have to use reflection as much?
05:07quotemstrdcnstrct: I'd rather have LOOP and ITERATE (http://common-lisp.net/project/iterate/) than TCO.
05:07glogicquotemstr: well, it's not like there are any specific expectations other than what people want i suppose, clojure being it's own dialect
05:08bsteuberfor me, recur is not that bad of a TCO-replacement - at least you're code is explicit about when recursion will be fst and when not
05:08dcnstrctyeah loop would not suck
05:08bsteuber*fast
05:09quotemstrglogic: The gratuitous incompatibilities with CL drive me up a wall.
05:09_atofrom what I've read TCO isn't going to make it into Java 7
05:09glogicquotemstr: isnt' part of the point of clojure being it's own dialect, that there are really no rules on compatability?
05:11quotemstrSure, there's no _requirement_ to be like CL.
05:11quotemstrBut why be different for the sake of being different? Why use []-notation for LET?
05:11_atobecause it's more readable to those who don't have a lisp background
05:12glogicquotemstr: overspecialize and you breed in weakness, it's slow death
05:12glogicsomeone has to have gottent hat reference
05:13dcnstrctquotemstr, have you seen this ? http://github.com/hoeck/clojurebox2d/blob/master/hoeck/iterate.clj
05:13bsteuber[] instead of () for lists whose first element is not "special" seems very clean to me
05:13Licenserquotemstr: so that the [] looks nicely different from the () :P
05:13Licenseralso you don't have ot escape ()
05:13glogicquotemstr: also, i think most people require a bit more syntax than just () so it's a good slice imho
05:13quotemstrdcnstrct: Nifty.
05:13glogicquotemstr: almost like a requirement for human minds
05:14quotemstrglogic: Natural languages span the whole spectrum from analytic to synthetic.
05:14quotemstrglogic: On one hand, you have Chinese; on the other, Latin.
05:14sthuebnerwell, I for one, don't like the [] notation too much
05:15sthuebnerit's a hassle to type
05:15sthuebner... on the keyboard, I mean
05:15sthuebnerbut it makes sense from a language point of view, I guess
05:15glogicquotemstr: dont' forget ancient languages lke akkadian and aramaic
05:17dcnstrctI like how [] notation lets Rich say things like "this clojure function is much shorter and has fewer parens than the java version".
05:17Licenser_ato: with the new gz this is realy neat
05:18glogicpersonally i like parens
05:18glogicand less sytax
05:18glogicsyntax* even
05:18Licenserthis now almost looks like a real tool :P
05:21Licenserthanks to _ato new index: http://gist.github.com/361932
05:22Borkdudehaha, the []'s really make for fewer parens, but I liked the Full Disclojure project Foil version better: {} instead of ()
05:23sthuebnerLicenser: what's the new gz?
05:23_atoLicenser: nice. when you construct the name, if the artifact-id equals the group-id you can just print one of them. So "sandbar" instead of "sandbar/sandbar".
05:23Licenser_ato: ah cool thanks
05:24Licensersthuebner: the new gz is the new index file ato publishes for clojars
05:24sthuebnerI see
05:25sthuebnerI haven't looked into Clojars yet, since in my environment we heavily rely on internal maven infrastructure
05:26Licenserhttp://gist.github.com/361932
05:28Licenserhmm when you call lein add clj-sandbox would you expect it to be interactive or automatically choose the latest stable versions?
05:28LicenserI'd kind of go for the second and add -i or something for interactive
05:28_atoyes
05:28_ato"lein add clj-sandbox" adds latest sandbox
05:28clojurebotsandbox is http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html
05:29_ato"lein add clj-sandbox 0.2.10-SNAPSHOT" adds that particular version
05:29Licenserat least as long as there is only one group with a clj-sandbox thingy
05:30_ato"lein add org.clojars.ato/clj-sandbox" adds my fork
05:30_atoetc
05:30quotemstr2008? That's ancient news! :-)
05:33Licenser*g*
05:57RaynesLicenser: I forgot juxt?
05:57RaynesI could have swore that I added juxt.
05:57LicenserRaynes: I couldn't find it.
05:57RaynesHrm.
05:57RaynesI must have been too busy playing with it to remember to add it. :p
05:59Licenser*g*
06:01Licenserokay line-search 0.2.0 is out :D
06:01Licensernow with nifty new features and a more comprehensive search
06:02Licensernow people can use maven as much as they want since there is a very thick protective layer :P
06:45RaynesIsn't there a command in Emacs to switch to the REPL to the ns of the file you're currently editing?
06:48Licenser(in-ns 'namespace)?
06:48RaynesI mean, a keybinding. I'm pretty sure there is.
06:49RaynesIt's not important.
06:49RaynesJust curious.
06:50mrSpecHello, I have problem with clj-web-crawler. "org.apache.commons.httpclient.HttpClient Thrown class java.lang.ClassNotFoundException." What should I install to use it? I cant find this apache lib.
06:53BorkdudemrSpec, using google: http://hc.apache.org/downloads.cgi
06:57mrSpecBorkdude: ah, thanks
06:58sthuebnerRaynes: Maybe most-recent-list-mode-buffer, which is bound to 'l' in 'slime-selector
07:03kzarSo I'm reading through the Programming Clojure book and a lot of the Java terms in the Java interop chapter are foreign to me, is there a good guide to read just to learn enough about Java to understand how Clojure interacts with it?
07:03hoeckRaynes: slime-repl-set-package ?
07:05sthuebnerkzar: if your not into Java at all, why did pick Clojure as your Lisp? Just curious
07:06bsteubersthuebner: because it's the best existing programming language maybe :)
07:07hoeckkzar: I would suggest the "official" java tutorial: http://java.sun.com/docs/books/tutorial/java/TOC.html
07:07Rayneshoeck: Might be it.
07:08Rayneshoeck: Yeah, this is it. Thank you.
07:08kzarhoeck: Thanks I'll have a read through that
07:09Rayneskzar: At least they're good Java tutorials as opposed to bad ones.
07:09hoeckthere are far more worse programming languages than java :)
07:09kzarI haven't seen them though heh
07:14BorkdudeI haven't worked with Java for years either
07:14zakwilsonI would like to use a profiler with lein-swank. Could someone point me in the right direction for getting started? I'd also like a recommendation on a profiler. I played with a Yourkit trial about a year ago and liked it, though I'd prefer something open source.
07:14Borkdudebut Clojure + a massive library made a lot of sense to me to start using it
07:15Borkdudesame I reason I started F# when I did .NET programming, but I like Clojure a lot better, because it's Lisp
07:15zakwilsonI came to Clojure not being in to Java or any other JVM language. I did know CL and Scheme first though.
07:15kzarzakwilson: Yea that sounds more like me, I've done some Lisp but never Java
07:16Borkdudezakwilsen: same for me, it's practical lisp, without the common ;)
07:16kzarI guess I liked Common Lisp but it was such a nightmare to deploy on my webserver I never really stuck with it and I had to use Python instead. But Python isn't as nice so I was always looking for something else
07:16zakwilsonThat's essentially been the appeal of Clojure for me as well. Very often, it feels like Rich thought about what I want to do before I did.
07:17zakwilsonkzar: I did not find Common Lisp at all difficult to deploy on a VPS. What tools were you using?
07:17zakwilsonIncidently, I haven't tried deploying a webapp on Clojure. It actually looks like it might be harder than CL.
07:18kzarzakwilson: Well it was the first time I had ever done it so maybe I was just being stupid but it took me AGES to get it all working. I used hunchentoot running on SBCL using cl-who to make html and cl-couch to store data if I remember correctly
07:20BorkdudeClojure took me also ages to setup... all these different IDEs and error msgs... takes a lot of searching and asking around to get it working
07:20Borkdudebut I guess that is how everything works nowadays
07:20zakwilsonkzar: Pretty much my setup. As for deployment, I saved an executable, then wrote a shell script that started it with detachtty and put the app behind Apache using mod_proxy.
07:21kzarzakwilson: Oh nice, I didn't know how to save an executable (still don't) so I had to get it all running on there. Then I wrote a script that started it up at boot and used Nginx to put requests through to it
07:22BorkdudeThe problem is that Emacs is most supported Clojure IDE probably... and learning Emacs and Clojure at once are two learning curves instead of one
07:22zakwilsonAhh. See sb-ext:save-lisp-and-die
07:23kzarBorkdude: I'm already a big emacs fan, I'm in the emacs irc client right now :)
07:23Borkdudebut I'm starting to appreciate it more and more
07:23kzarBorkdude: Stick with it, it's worth learning trust me
07:23Borkdudekzar, I experimented with a twitter client in emacs
07:23BorkdudeI even contributed to the emacs wiki a little for it ;)
07:23kzarheh nice
07:24kzarzakwilson: Ok thanks, I'll look it up later
07:26zakwilsonkzar: You can save a standalone executable that way, and you can define a function that serves as an entry point.
07:27Borkdudegtg
07:31BorkdudeHmm, ok, so this is how it looks from Emacs
07:31Borkdudecool... I try to use this some more in the future... gtg now
07:32kzarbobo_: http://paste.lisp.org/display/97342
07:32kzaroops
07:32kzarOh right I missed him, sorry that was for Borkdude
07:45Rayneshttp://nighthacks.com/roller/jag/entry/time_to_move_on Gosling left Oracle. :o
08:02candelleris there a function that returns the index of an element in a vector/list?
08:04defnsome fun progress: http://getclojure.org:8080/examples/concat
08:04defnyou can now click on expressions to show the result
08:06defnalso, dupes are now removed
08:14_ato,((zipmap [:a :b :c :d :e] (iterate inc 0)) :c)
08:14clojurebot2
08:14_atohehe
08:15_ato,(ffirst (filter (fn [[i v]] (= v :c)) (indexed [:a :b :c :d :e])))
08:15clojurebot2
08:15_atoI like the zipmap way, but it realises the whole list and may not do what you want if there's duplicates
08:16_mst,(first (positions #{:c} [:a :b :c :d :e]))
08:16clojurebot2
08:16_atonice
08:17defncandeller: is there a reason why there is no "index-at" function in core clojure?
08:17defnerr @ _ato, _mst
08:17_atoif you're working with indices, most of the time you're doing something wrong. (not always, but most of the time)
08:18defnyeah that was going through my head
08:18defnseems like a million other ways to do it
08:19candellerhmh, well i am writing a function that takes a collection and randomly shuffles elements within it
08:19candellerso i have 2 collections, one empty at the beginning, the other one to pick elements from
08:20candellerand i am generating a random index, then removing that element and adding it to the empty collection
08:20candellerand so on
08:21Chousukecontrib has a shuffle function
08:21_atowhere does finding the index of an element come into it your algorithm?
08:21defnit's in seq-utils isnt it?
08:22Chousukeit copies your data into an array, uses the java shuffle function, and then creates a vector out of that
08:22chousera seq
08:22Chousukeah. I thought it made a vector
08:23_ato,(class (shuffle [1 2 3]))
08:23clojurebotclojure.lang.IteratorSeq
08:23_atoboo :(
08:23defn,(shuffle [1 2 3 4 5 6 7 8 9 10])
08:23clojurebot(3 4 1 5 8 2 7 10 9 6)
08:24_atoArraySeq would be much better
08:24_ato~def shuffle
08:24clojurebotPardon?
08:25chouserWell, Collections/shuffle actually shuffles an ArrayList in place, so the seq on that is an IteratorSeq
08:26_atoah, and you can't get at the underying array without a copy
08:26_atoannoying
08:26defn,(let [a (ArrayList. (range 10))] (Collections/shuffle a) (vec a))
08:26clojurebotjava.lang.IllegalArgumentException: Unable to resolve classname: ArrayList
08:29defn,(import java.util.ArrayList)
08:29clojurebotjava.util.ArrayList
08:30defn,(let [a (ArrayList. (range 10))] (shuffle a))
08:30clojurebot(6 4 7 2 8 9 0 3 1 5)
08:30defn,(let [a (ArrayList. (range 10))] (shuffle a))
08:30clojurebot(7 8 1 0 9 3 5 2 4 6)
08:35_atocandeller: you might be interested in this implementation of Knuth shuffle by Per Vognsen: http://gist.github.com/356035
08:35defn_ato: wow -- how did you find that?
08:35defn_ato: as in literally, how did you come across that link?
08:38_atohttp://groups.google.com/group/clojure/browse_thread/thread/2a479bc9d9dd5bac
08:39defn_ato: awesome.
08:39defn_ato: if you dont mind me asking, how do you read the groups?
08:39defn(with a browser, email?)
08:39_atoemail (gnus in emacs)
08:40defnah, i still feel pain with gnus
08:40sthuebner_ato: same here
08:40defnim setting up wanderlust
08:40sthuebnerGmane -> gnus
08:40defnim used to mutt and it's a dirty habit
08:41sthuebnerGnus is good. I like the scoring features a lot
08:45zakwilsonI'm trying to make a jar with leiningen. I have ":main foo.bar" in project.clj and "src/foo/bar.clj" contains (defn -main [] (clojure.main/main)). The jar buids, but when I run java -jar Foo.jar, I get Exception in thread "main" java.lang.NoClassDefFoundError: foo/bar
08:46zakwilsonThis structure seems to match leiningen itself, so I'm not sure what I could be doing wrong here.
08:48_atozakwilson: do you have (ns foo.bar (:gen-class)) in foo.bar?
08:59zakwilson_ato: Missing the (:gen-class) bit, and I suspect that's my problem.
09:01zakwilsonFixed that and now get Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn
09:01_atoah good
09:01_atonow try: lein uberjar
09:01_atoand then run java -jar foo-standalone.jar
09:02_atothe plain "lein jar" doesn't produce a jar that includes dependencies (ie clojure)
09:03zakwilsonI knew that, but I somehow expected it to magically work in the project directory. I'm not sure *why* I expected that, not seeing any way that it would set the classpath to include the lib dir, but... I did.
09:05_atoyeah, I've accidentally expected the plain jar to work many times before as well. You can of course do it like: java -cp 'lib/*:foo.jar' foo.bar
09:05zakwilsonAnd now I get Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.NoSuchFieldException: main
09:06_atooh
09:06_atohuh
09:06_atothat's interesting
09:06_atoI guess it's because clojure.main is both a class and a clojure namespace
09:07_atoactually if you're just wanting to run clojure.main, why not set :main to that in project.clj?
09:08zakwilsonBecause I actually want to run it from inside my namespace.
09:09_atoanyway, the problem is likely that you're missing a (:require clojure.main) in foo.bar
09:11zakwilsonThat... could be it.
09:11zakwilsonI haven't used Clojure much in the past year. I'm more rusty than I thought.
09:12zakwilsonLeiningen looks to make deplayment much easier, once I get used to it.
09:16zakwilsonGot it working. Thanks _ato
09:16_atocool :)
09:18zakwilsonNow... let's see why this code is so slow.
09:28moshisushican i get clojure to use gnu-readline for REPL?
09:30moshisushiextremely disturbing without it.. i can't even use backspace right now
09:30_atomoshisushi: sure, install rlwrap
09:31_ato(apt-get it, or whatever the equivalent is for your distro)
09:31arbschtor jline
09:32moshisushiwhich one is preferred?
09:32RaynesHardcore Clojure users don't use any of that. For example, Rich sends expressions to a remote REPL in Antarctica via his mind and it's sent back encrypted with ROT-13, which he decrypts in his mind to get the returned value and output.
09:33arbschtmoshisushi: up to you
09:33carkhmoshisushi: usually you'll use you editor/ide to work with the repl
09:34_atoI've heard reports that jline is buggy under Linux (inserts null characters occasionally) and I don't think it's as featureful as readline, so I'd suggest rlwrap
09:34zakwilsonI think most people use Slime for their repl.
09:34moshisushisure i will use slime later..
09:34raekbtw, which one does lein repl use+
09:34raek?
09:34_atorlwrap
09:35_atooh wait
09:35_atomaybe it uses both
09:35_atohmm
09:35_ato $RLWRAP java -client $JAVA_OPTS -cp "src/:classes/:$CLASSPATH" jline.ConsoleRunner clojure.main ${@:2}
09:35_atoconfusing :p
09:38_atoah... jline doesn't support reverse-isearch, that's a deal-breaker
09:48zakwilsonWould a type hint saying that the keys of a map are all keywords speed up something that does a lot of lookups?
09:51moshisushiwhere do i find clj_completions?
09:55moshisushinevermind...
10:19mikemhow can I coax a number from a floating point representation into an Integer or BigInteger, whichever is appropriate? (int num) will fails on anything larger than Integer/MAX_VALUE
10:20Raynes$(bigint 5.3)
10:20sexpbot5
10:20Raynesmikem: That what you're looking for?
10:21mikem$(type (bigint 10.0))
10:21sexpbotclass java.math.BigInteger
10:21mikemin that case, I'd expect a Integer
10:22mikemI can always use an if, but perhaps there's already a function that does the right thing :)
10:22RaynesYou could check to see if the resulting integer is > MAX_VALUE.
10:22RaynesIf there is, I don't know of it. :\
10:22RaynesBut I don't know a lot of things. ;)
10:24hamzaif we have a pluging that creates other files such as a .exe is it possible to somehow hook into the leain clean to also delete this when lein clean is run?
10:24Raynestechnomancy: ping ^
10:40RaynesWoot, MEAP update (Joy),.
10:46The-Kenny\o/ MEAP updates for Joy of Clojure
10:47khingebjergDid you guys receive emails about the update?
10:48The-Kennykhingebjerg: Yes, I got mine just a few minutes ago
10:48khingebjergThe-Kenny: Ahh ok, I'll just try to be patient then...
10:48Rayneskhingebjerg: Indeed. Moments ago.
10:52defnwhoa wait!
10:52defnnew JoC?
10:52The-Kennydefn: Yes!
10:53defnThe-Kenny: awesome
10:53defnThe-Kenny: where ya been? havent seen you around in weeks
10:54defn:)
10:54The-Kennydefn: huh? I was here every day since saturday.
10:54defnthanks chouser for the JoC
10:54The-Kenny+last
10:54defnThe-Kenny: oh, my bad, must've just missed you
10:55The-Kennydefn: looks so :)
10:55The-KennyBtw. I'm watching "Introductions to Monads" just now: http://www.youtube.com/user/LinkedInTechTalks?feature=mhw5#p/u/0/ObR3qi4Guys
10:56defnthoughts on http://getclojure.org:8080/examples/partial?
10:56defnerr http://getclojure.org:8080/examples/partial
10:56defn(in case your url grabber snagged that ?)
10:58The-Kennyhmm looks good, but there are a lot examples
11:00defnThe-Kenny: heh, yeah, not very well organized yet
11:00defni wonder if it makes more sense to show the result first and the code second
11:01The-KennyI don't think so. But a short description of what the code does would help, in my opinion.
11:03defnlike human readable The-Kenny ?
11:03The-Kennydefn: yeah
11:03defnThe-Kenny: ah, yeah that would be a lot of work
11:03defnthese are just pulled from #clojure
11:03The-Kennydefn: heh, yeah
11:03The-Kennydefn: Oh, I didn't know that
11:03shadowsparThe-Kenny: fwiw, I really liked Marty Pauley's "A Swift Kick in the Monads": http://yapc.tv/2005/ye/marty-monads/
11:04shadowsparmore for the humour value, but also useful when ppl are first wrapping their minds around monads
11:04The-Kennyshadowspar: I'll take a look, thanks
11:04defnoi vey, monads
11:05dullarddefn: On my firefox, the links need to be sorted out with some kind of text-decoration: none css because all the examples are underlined with a varying thickness of blue hideousness
11:08defndullard: care to screenshot it?
11:09defni havent seen that in FF, IE, Chrome, or Safari
11:09dullarddefn: and while I'm at it, have you considered making all the keywords into links to their respective examples pages? That'd be great
11:09dullarddefn: sure will do...
11:09Raynes$walton juxt
11:09sexpbotRaynes: http://getclojure.org:8080/examples/juxt
11:09defndullard: yeah i have -- just working other pieces right now
11:09defndullard: long way to go but that will be implemented eventually guaranteed
11:10defn,((juxt ++))
11:10clojurebotjava.lang.Exception: Unable to resolve symbol: ++ in this context
11:10defn,((juxt + +))
11:10clojurebot[0 0]
11:10defnheh, interesting
11:10defn,((juxt + -))
11:10clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$-
11:10RaynesYay! Examples.
11:11Raynes((juxt identity identity) 0)
11:11Raynes,((juxt identity identity) 0)
11:11clojurebot[0 0]
11:13defnRaynes: :)
11:14dullarddefn: here's the screenie: http://ScrnSht.com/qjnpec
11:14cp2ew
11:15cp2renders fine without that in chrome
11:15defnit's because they're links, technically
11:15defnyour browser is treating those way too literally :)
11:18Raynes$((juxt identity identity) 0)
11:18sexpbot[0 0]
11:18RaynesYay!
11:19Raynesdefn: Also, my Firefox is rendering it the same way his is.
11:19chouserall carefully sandboxed, right?
11:19chouser$(System/exit 42)
11:19sexpbotDENIED!
11:20Rayneschouser: It should be sandboxed really well. For now, you can't even use the . special form.
11:20Chousukechouser: hm, looking at the new MEAP... You have examples about binding references to lazy sequences, and state that eg. (defn mr3 [s rf mf] (let [x (reduce rf (map mf s))] x)) is not safe, but isn't that outdated? Didn't the locals clearing optimisation solve that problem? :/
11:20RaynesFeel free to try to break it in ways that wont damage my system. It can only help clj-sandbox. :>
11:21chouser$(clojure.lang.RT/cons 1 nil)
11:21sexpbotDENIED!
11:21chouser$(println ".")
11:21sexpbot.
11:22kzar$(println "$(println \o)")
11:22sexpbotUnsupported escape character: \o
11:23kzar$(println "$(println \b)")
11:23sexpbot$(println )
11:23kzarheh damn
11:25companion_cube$(let [w (fn [x] (x x))] (w w))
11:25sexpbotnull
11:25companion_cubehello there
11:26RaynesIt said null because it threw a stackoverflow with no message. :p
11:28companion_cubeit was what i expected it to do :)
11:29Drakesonit seems that c.c.lazy-xml is broken (uses reify, has not been updated)
11:30esjoooh ! Fresh Joy of Clojure :)
11:30esjhuzzah
11:30chouserDrakeson: hm, seems likely. :-/
11:31chouserChousuke: I'll double check those examples.
11:32zakwilsonI'm having an issue in that calling set is slow. Is there a well-known faster means of getting the unique elements in a sequence?
11:33Chousukechouser: I suppose you might need to mention the optimisation in 1.2 a bit earlier, at least.
11:33Drakesonzakwilson: can your sequence be sorted?
11:34zakwilsonDrakeson: yes.
11:34Chousukechouser: oh wait, it seems you do. duh. :P
11:35Drakesonzakwilson: then you can get the unique elements with O(n)
11:35Chousukechouser: I was kind of under the impression that this was fixed in 1.1 already but I suppose I'm wrong :/
11:36Drakesonzakwilson: you know how to do that, right?
11:36zakwilsonDrakeson: How to sort it, or how to find the unique elements?
11:37Drakesonhow to find the unique elements in a sorted seq
11:38zakwilsonOff the top of my head, no, but there seems to be a lot of example code on Google.
11:39noidiDrakeson, maybe just stick them in all in a set?
11:39zakwilsonI think I see how to get started on this now. Thanks, Drakeson.
11:39triyoI have an API spread over several clj files. I wish to simplify the client API. How should I simplify the client API so that client can require less "imports/uses"?
11:39noidior maybe you could just use a set in the first place
11:40zakwilsonnoidi: are you responding to his answer to my question?
11:40Drakesonzakwilson: it is trivial, go through the seq, if not= current-element (first unique-element) then conj unique-elements current-element
11:40triyoI've seen strategy before where guys creat a main clj file that calls all other lower-lever APIs
11:41Chousuketriyo: you might want to rethink the organisation of your APIs
11:41zakwilsonI assumed somethnig along those lines. I think that should be worth a substantial speedup.
11:41Drakesontriyo: is it your api? if you cannot change the API, aggressively use immigrate
11:42Chousuketriyo: I think one namespace should ideally be enough to solve one particular problem. Stuffing everything into one super-namespace is not very nice either :/
11:42noidizakwilson, oops, apparently yes :)
11:42triyoDrakeson: I can change as its still in the early dev stage.
11:43triyoChousuke: thinking about it now, my API does have good logical separation and was checking to see what might the response on the "super-namespace" be. :)
11:45Drakesontriyo: (as a library user :p) I would suggest go for fewer namespaces, unless some part is large and not always needed.
11:46Chousukeif some two namespaces end up being really small you might consider "denormalisation" :P
11:46Drakesonadmittedly though, having more separation might help with development
11:47triyohehe, sure "denormalisation" sounds like an appropriate term here. ;)
11:52kzar,(println "$(println /b")
11:52clojurebot$(println /b
11:52sexpbotInvalid token: /b
11:59kzarok last try
11:59kzar$(println ",(println (str \$ \( \p \r \i \n \t \l \n \space \( \s \t \r \space \, \( \p \r \i \n \t \l \n \space \( \s \t \r \space \y \o \! \) \) \)))")
11:59sexpbotUnsupported escape character: \$
12:22technomancyDrakeson: good idea
13:03technomancy_ato: what's no-db all about?
13:10erikcw1I'm trying to find the Clojure equivalent to the Python "in" keyword. Basically I want to do the equivalent of "ABC" in "xxxABCxxx" (ie True if string ABC is in string xxxABCxxx)
13:10erikcw1I looked at contains?, but it doesn't seem to be the fit
13:11The-Kennyerikcw1: just use .contains from java.lang.String
13:11The-Kenny,(.contains "foobar" "foo")
13:11clojurebottrue
13:11The-Kenny,(.contains "foobar" "fooa")
13:11clojurebotfalse
13:12dcnstrctthere are regular expressions built into clojure also.. whatever floats your boat.
13:12erikcw1The-Kenny: I was just looking at the wrong contains... :-)
13:13kzarInside a proxy how do I set the constructor?
13:18chouserkzar: you don't. instead, put your 'proxy' form inside a function that will act as a ctor or factory.
13:20kzarchouser: I don't completely understand, say for example I'm trying to call addMouseListener from within the constructor of MyPanel how could I do that? I'm trying to worth through this Java tutorial to get the hang of Clojure - Java workings http://java.sun.com/docs/books/tutorial/uiswing/painting/step3.html
13:20kzarwork*
13:20chouserIt does require thinking about things in a somewhat different way.
13:20chouserwhy does MyPanel have to be a class?
13:21chouseror, why do you need to call addMouseListener from its ctor?
13:21chouserwhy not from some function that accomplished both things (creating a MyPanel or equiv, and also calling addMouseListener)?
13:22kzarchouser: Well MyPanel is passed to the JFrame I make later so I think it has to be made that way. I'm trying to call the addMouseListener from the constructor of MyPanel yea
13:23kzarchouser: I thought maybe the call to addMouseListener had to be inside the creator for it to add the hook to the JPanel object.
13:25chouserI think the add*Listeners can be called anywhere as long as the target and object are right.
13:27kzarchouser: OK thanks I'll give it a go
13:50Drakesonis there an idiomatic way of saying: (loop [coll coll result result] (if (empty? coll) result (recur (rest coll) (f (first coll) result))))
13:51Chousukereduce?
13:51Chousukeit has a different arg order though
13:51Chousukeso you need to adapt a bit
13:52Chousuke,(reduce (fn [a b] (/ b a)) [1 2 3 4 5]))
13:52clojurebot15/8
13:53Chousuke,(reduce / [1 2 3 4 5]))
13:53clojurebot1/120
13:54kzarI can't figure out how to call addMouseListener properly, what's wrong with this? (. java.awt.Component.addMouseListener mouse)
13:54kzar(I set mouse earlier)
13:54Chousukemouse is probably not a method of j.a.c.addMouseListener :)
13:54carkh(.addMouseListenter myFrame the-listener-instance)
13:55Chousukedon't use plain dot notation
13:55kzaroh so it's a method of the frame?
13:55carkhkzar yes, of any component i think
13:55kzarcarkh: Oh gotya
13:55kzarso a frame is a type of component
13:55carkhright
13:56sexpbotprogramble: You have 2 new messages. Type $getmessages to see them.
14:08kzarWhat's the hotkey to kill a Clojure thread in Emacs again?
14:10DrakesonC-c C-b ?
14:10Drakesonthat interrupts, though.
14:10kzarDrakeson: Did the trick thanks
14:12DrakesonChousuke: thanks. how embarrassing!
14:12kzarsweet thanks guys I've got my red square moving to where I click
14:23erikcw1Does clojure have a function to produce a random number that falls in a range -- something like (rand-range 5 30) to get a random number between 5 and 30?
14:24The-Kennyrand-int
14:24The-Kenny,(doc rand)
14:24clojurebot"([] [n]); Returns a random floating point number between 0 (inclusive) and n (default 1) (exclusive)."
14:24The-Kenny,(doc rand-int)
14:24clojurebot"([n]); Returns a random integer between 0 (inclusive) and n (exclusive)."
14:25erikcw1The-Kenny -- but I want the starting point to be 5, not 0
14:26StartsWithK(+ 5 (rand-int n))
14:26The-Kenny,(+ 5 (rand-int 30))
14:26clojurebot24
14:27The-Kenny:)
14:27erikcw1That would return between 5 and 35
14:27carkh(defn rand-range [start end] (+ start (rand-int (- end start))))
14:27carkhor something close to that
14:27StartsWithK(+ 5 (rand-int (- n 5))
14:28erikcw1ok -- that's what I was thinking -- just was wondering if it was somewhere in the standard lib or in contrib
14:28erikcw1thanks!
14:40Hali_303hi! many times I'd like to test for a non-empty string in a cond function. what's the easiest way to do that? I mean I've found no not-empty? or not-nil? functions..
14:43hiredman,(empty? "foo")
14:43clojurebotfalse
14:43hiredman,((comp not empty?) "foo")
14:43clojurebottrue
14:45tomojno need for a not-nil function
14:45tomojwell, unless false is a possible value
14:50chouser,(seq "")
14:50clojurebotnil
14:53Hali_303sorry guys I don't really get this. I know about function composition and that I can do (not (empty? astring)). I'm just asking why there is no shorthand for such a seemingly common use case
14:53carkh(.isEmpty "")
14:54carkh,(.isEmpty "")
14:54clojurebottrue
14:54TakeVCould also make a function or macro.
14:54Hali_303carkh: the problem is, that this string comes from the web and it may be "" or nil, and the test should return false in both cases
14:54carkhoh sorry you want a "not-empty"
14:55carkhi have written a null-string? predicat just for that
14:55carkhthat's like 2 lines =P
14:55Hali_303yeah I'm thinking about creating a (not-empty? I just thought that there is some way I don't know of
14:56carkh then you need his friends, safe-parse-int and safe-parse-decimal
14:56Hali_303I like to use built in stuff, if possible
14:56carkhwell clojure is a general purpose language, at some point you'll have to write your own functions =P
14:57Hali_303what a shame :D
14:57carkhhehe
14:57Jevgenihi, I have a vector [1 4 5 5 10 12]. What should I use if I want to use "map" and create another vector, but to get access to the left and the right of the vector. For example, if I am processing the 3 element in the row, then I want to perform some operation on the left parts [1 4] and on the right part [5 10 12]. In Java I would use simple for and access the array before i and after i....
14:57Jevgeni...What is the idiomatic way of doing the same in Clojure?
14:59BorkdudeClass clojure.lang.Reflector can not access a member of class Barbara with modifiers "public static"
14:59Borkdude
14:59Borkdudewhy not?
14:59carkhJevgeni: you need the full left and right parts ? or just the value of the first item on each side?
14:59carkhmaybe have a look at zippers
15:00Jevgenicarkh, full parts
15:00Jevgeniokay, I've have a look on zipper.. thanks
15:03hoeckJevgeni: or use map + range
15:03technomancy(map (fn [p x n] (println p x n)) v (rest v) (rest (rest v)))
15:04technomancyalternatively use indexed from seq-utils
15:04hoeck(map (fn [i] ... (nth v (- i 2)) ... ) (range (count v)))
15:05technomancy(map (fn [[i x]] (println (v (dec i)) x (v (inc i)))) (indexed v))
15:07ChousukeJevgeni: split the thing into two subvecs and map over them separately
15:07Jevgenitechnomancy, hoeck okay, I'm checking this too..
15:08Chousuke(doc subvec)
15:08clojurebot"([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."
15:08JevgeniChousuke: I have to do it for every element in the vector
15:08technomancyif you need access to any part of the vector from the mapper fn then indexed is probably better
15:09Chousukehm
15:09ChousukeI suppose I misunderstood your question
15:11carkhclojurebot: paste?
15:11clojurebotlisppaste8, url
15:11carkh!
15:11hiredmanlisppaste8 has been broken for sometime
15:12hiredmansomeone needs to +v it
15:12carkhJevgeni: check this http://gist.github.com/362235
15:13Jevgenicarkh: yes, this is exactly what I am looking for! Thanks. Is is the idiomatic way of writing such things?
15:15carkhi don't know if that's idiomatic =/
15:15carkhi guess it is
15:16BorkdudeIf I have a .class file on my classpath and I (import) it, but make changes to the class file, will Clojure see it?
15:16BorkdudeIt seems like it doesn't to me
15:17ChousukeBorkdude: no.
15:17ChousukeBorkdude: you need to restart the JVM
15:17BorkdudeChousuke, this means restart swank-clojure-project probably
15:17Borkdudein my case
15:18anarson windows I'm invoking my lein.bat to perform the 'uberjar' task for some project I've made. but it keeps telling me "Wrong number of arguments to task uberjar". what am I doing wrong? I've got vimclojure and nailgun running properly if that's any help.
15:18ChousukeBorkdude: maybe
15:18ChousukeBorkdude: never used that, so...
15:18BorkdudeChousuke, what do you use for project mngmt
15:18ChousukeBorkdude: just plain emacs :P
15:18technomancyBorkdude: M-x restart-inferior-lisp
15:18Chousukeand git
15:18Chousukeand emacs to manage git ;P
15:19Borkdudetechnomancy: mine doesn't have that...
15:19ChousukeMagit is great, and any emacs-using git person should give it a try
15:20Chousukethough I would prefer egg if it were actively developed :/
15:22Borkdudetechnomancy: ah, slime-restart-...
15:22Borkdudetnx
15:22Borkdudeand now I have one issue left:
15:22BorkdudeClass clojure.lang.Reflector can not access a member of class Barbara with modifiers "public static"
15:22Borkdude
15:22Borkdudewhy is this?
15:23hiredmanmaybe you are trying to access a static member as an instance member
15:23hiredmanI have not seen that exception before so it is hard to tell without more detail
15:23Borkdudehiredman: I'm doing Barbara/foo
15:24hiredmanand foo is a static member?
15:24Borkdudehiredman: public static String foo = "Foo!";
15:25Chousukedoes class Barbara have a package?
15:25Borkdudeno
15:25Chousukemake it have one
15:25Chousukethat can cause all kinds of weird errors
15:25Borkdudewill try
15:25Chousukereflector failure on default-package classes would not surprise me in the least :P
15:25hiredmanis Barbara public?
15:29Borkdudehiredman, I now put "package foo;" at the top
15:29hiredmanBorkdude: and is barbara public?
15:30Borkdudeyes I made it now, just to be sure
15:30BorkdudeI didn't explicitly say that before, but then it had no problem 'importing' it
15:31Borkdudebut how do I import it now: (import '(foo Barbara))?
15:31hiredmansure
15:32Borkdudefoo.Barbara
15:32Borkdude [Thrown class java.lang.ClassNotFoundException]
15:32Borkdude
15:32Borkdude:-s
15:33hiredmanso directory structures and classpaths all need to be in alignment with packages
15:33hiredmanfoo/Barbara.class
15:33Borkdudeah heck, that's true
15:33hiredmanwith whatever directory foo is in on the classpath
15:34Borkdudeit works now, tnx
15:34moshisushianyone using enclojure?
15:39RaynesGetting there.
15:45anarssorry I'm repeating my question - just giving it one last shot: on windows I'm invoking my lein.bat to perform the 'uberjar' task for some project I've made. but it keeps telling me "Wrong number of arguments to task uberjar". what am I doing wrong? I've got vimclojure and nailgun running properly if that's any help.
15:46Chousukedid you try running lein help uberjar?
15:46BorkdudeI didn't even get lein running on windows
15:46Borkdudethat's why I switched to linux ;-)
15:47BorkdudeI got a "not implemented here" syndrome msg
15:47anarsChousuke: it doesn't give me any syntax or argument specifications. a friend of mine tried it on mac os x.. same cmd and all, and it worked fine.
15:47anarsBorkdude: yeah, I get that too if I do a lein self-install
15:48anarsbut I manually installed the needed jars
15:48anarslein deps works fine, e.g.
15:48Chousukehm, looks like it doesn't.
15:48dgreenspanars: what's your bat file look like?
15:49anarsdgreensp: here http://pastebin.com/KP4jcVQT
15:49anarsbasically, I specify the leiningen and clojure jars explicitly.
15:50anarsthe paths, that is :-)
15:51dgreenspwell, this is beyond my bat-file fu, but it looks like you know to use semicolons on windows and stuff; "wrong number of arguments" sounds like it could be something like that, or your quoting or something
15:52dgreenspi.e. arguments to the java command
15:56anarsdgreensp: that could be. even when running 'lein repl' inside a dir with a project.clj and another clj file with a few functions won't work. it fires up the repl fine, but it does not include my clj file.
15:58anarshmm, it seems like my leiningen standalone jar is of the wrong version
16:06sethsI'm trying to debug a labrepl problem, apparently deftype is changing faster than its documentation on Assembla?
16:06seths,(deftype Foo [bar] :as this Object (toString [] "woah"))
16:06clojurebotDENIED
16:06sethser
16:07sethswell, it pukes saying ":as unsupported"
16:07seths,(deftype Foo [bar] Object (toString [this] "woah"))
16:07clojurebotDENIED
16:07mattreplI recall seeing examples in channel, but have forgotten the latest syntax for key destructuring bind in a let, is it documented anywhere?
16:07sethsbut that works (outside of irc :-)
16:09sethsmattrepl: I seem to remember seeing "strs" involved in destructuring lately on Twitter
16:10sethshaven't found it yet tho. And searching for "destruct" is somewhat scary
16:10triyoHmm, how do I make a reference to macro available in one namespace from another namespace. So I want a macro to be aliest from namespase1 in namespace2.
16:10anarsI got it working! I managed to compile the 1.1.0 leiningen from a git clone, and put my leiningen jar path to the classes-folder containing the 1.1.0 bytecompiled leiningen.
16:10seths,(let [{:strs [a b]} {"a" 5 "b" 6}] (+ a b))
16:10clojurebot11
16:11mattreplwell that looks nice
16:11sethsmattrepl: courtesy of @cleotd
16:11mattrepl,(let [{:keys [a b]} {:a 5 :b 6}] (+ a b))
16:11clojurebot11
16:12StartsWithK,(let [{:syms [a b]} {'a 1 'b 2}] [a b])
16:12clojurebot[1 2]
16:12mattreplok, I was doing it right
16:14RaynesThat's the last time I have to restart that damned bot.
16:14triyoi got it.
16:14triyo,(def #^{:macro true} case #'cond)
16:14clojurebotDENIED
16:15triyohehe well thats how :)
16:15RaynesIf I have to look at another line of code in the next 5 hours, I'll murder a small child.
16:15Raynes:|
16:17StartsWithKma
16:17sethsRaynes: sounds like a good time for lots of yardwork!
16:17Raynesseths: Indeed, sir. Indeed.
16:22Borkdudeseths: who are you on Twitter? I run @cleotd
16:27sethsBorkdude: @foogoof
16:28sethsBorkdude: thanks for providing a neat service
16:28sethsI just followed the account
16:28sethsspeaking of yardwork...
16:29Borkdudeseths: tnx... too late
16:48naeudoes anyone know if there's currently a meap discount on the joy of clojure?
16:48Borkdudenaeu, try the discount code clojure35
16:49Borkdudeit gives you 35% off on both The Joy and In Action
16:49naeuBorkdude: nice, that worked - thanks
16:49Borkdudenp
16:50bittionline 35% joy? doesn't sound good :/
16:51Borkdudeyou mean 35% off the joy?
16:53triyo~joy
16:53clojurebotI don't understand.
16:53triyo~joyofclojure
16:53clojurebotNo entiendo
16:54triyooh well :)
16:58bittiwould be cool when clojurebot could learn from conversation
16:58The-Kennyclojurebot: joyofclojure is http://joyofclojure.com/
16:58clojurebotIn Ordnung
16:58The-Kenny~joyofclojure
16:58clojurebotjoyofclojure is http://joyofclojure.com/
16:59triyoguess bot would not make much sense if that was the case
16:59bitticlojurebot spricht deutsch?
16:59bitticool
16:59The-Kennybitti: And italien. But only one or two sentences.
16:59The-Kenny*italian
16:59naeudoes anyone know why clojure doesn't have a condition system?
16:59triyo~haskell
16:59clojurebothaskell is Yo dawg, I heard you like Haskell, so I put a lazy thunk inside a lazy thunk so you don't have to compute while you don't compute.
17:00The-Kennybitti: If you're interested: There's a small-but-growing german clojure-channel at #clojure.de </advertising>
17:01bittiaha
17:02qbgI'm trying to reify an ActionListener, but I get "Can't define method not in interfaces: actionPerformed", which makes no sense considering that the method is in the interface...
17:02Borkdudehmm no #clojure.nl unfortunately
17:03Borkdudeqbg, maybe you should use proxy?
17:03qbgBorkdude: proxy works, but this should also work
17:04carkhqbg do you have the same number of parameters as the actionPerformed from the interface ?
17:04qbgYes, one argument.
17:04carkhthere was a very recent change to reify
17:04technomancynaeu: there are a couple in contrib
17:04carkho think that now you have to put the self parameter as well
17:04qbgI'm pretty sure it was working last week...
17:05The-KennyCan a experiences java-developer in here tell me if it would be possible to run clojure on a j2me-vm?
17:05carkhyou got latest from github maybe ?
17:05qbgcarkh: Yep, adding a this parameter works
17:05carkh=)
17:06naeutechnomancy: oh, interesting. Do you happen to know if either of them are gaining any traction?
17:07technomancynaeu: not really. they're not that well-known, and java Exceptions are 90% good-enough.
17:07carkhqbg : that's the cost of living on the bleeding edge =P
17:07qbgI don't remember seeing a commit message that mentioned that...
17:07naeuthat's a shame. From my understanding the benefits of having are a condition system are when all the libraries are built upon their abstraction
17:08technomancynaeu: well that would involve getting Java folks on board too; not too likely =\
17:09naeuhaha - true for java interop stuff which is probably the majority of clojure code
17:10rowthqbg: http://github.com/richhickey/clojure/commit/ba6cc3bde1a1ea9801b2133748a45f1277166368
17:11rowthI went through much the same a few days back :)
17:11qbgAh, the commit was farther back than I typically look...
17:13carkhso how is it now ? proxy = implied this ... all the rest explicit this ?
17:13carkhthe rest being gen-calls, deftype, reify
17:13carkhgen-class =/
17:14technomancystraw poll: I'm actually pretty curious about how many folks in here are still interested in keeping a CL environment running with Clojure.
17:15carkhtechnomancy: what do you mean ? inside emacs ?
17:15BorkdudeCL with Clojure?
17:15technomancycarkh: either way; in slime or just in general
17:16carkhi have a cl application that i need to maintain, but i'm using the lispworks editor for this one
17:16Borkdudetechnomancy, I don't
17:16technomancynot in the same running instance, just having them both configured at the same time
17:16carkhi do, just not in emacs
17:17technomancythere's a few people on the mailing list that are still using CL, but I get the feeling it's pretty much an edge case
17:17carkhbut why are you asking?
17:17Chousuketechnomancy: are you going to do something that would break it? :/
17:18ChousukeI think that would be rude :)
17:18technomancyChousuke: they already broke it
17:18dullardwhy not fork slime and make sljme
17:18ChousukeOkay, so "they" are rude :P
17:18Chousukewhat's broken with slime anyway?
17:18technomancyChousuke: I'd be more inclined to fix it if they actually did stable releases instead of just saying "everyone should always use trunk."
17:19technomancythat just strikes me as amateurish
17:19technomancyI'm fuzzy on the details... I have zero interest in CL myself.
17:19Chousukewell, that's fine by me but then they should also commit to keeping trunk stable :P
17:19technomancydullard: that would make it more difficult to sync up in the future if we got a swank-clojure maintainer who did care about CL
17:19technomancybut it's an option
17:20ChousukeI still don't quite understand the swank protocol very well though :/
17:20Chousukeit appears not to be documented in any way
17:20technomancyI don't either, and I'm the maintainer. =P
17:20technomancythe current implementation is almost a line-for-line port of the CL version
17:21Chousukebesides some comments in slime.el or someplace which says "here the protocol magic happens"
17:21technomancyvery un-idiomatic and difficult to maintain
17:21ChousukeIf I were to design a protocol to do something the first thing I would do is document it
17:22Chousukebecause I would inevitably forget how it works
17:22technomancyChousuke: http://twitter.com/jbarnette/status/6469242097
17:23Chousukeundocumented code is not so bad but to understand a protocol you need to understand the code handling the protocol and then piece it all together :P
17:24Chousukethe thing is, once your code gets complicated enough it basically becomes a protocol :/
17:24Chousukeif it's not documented by then, you're screwed :P
17:25technomancyhugod has been doing some good work on it recently
17:25technomancyand from the commits it looks like he does understand the protocol =)
17:25technomancyso that's good
17:26ChousukeI think this might be the primary cause of undocumented code
17:26Chousuke"I can still keep this in my head" *fast forward 6 months of development* "..."
17:30bittiI think the primary cause for lacking documentation is, because just hacking is more fun...
17:30technomancyyeah, and nobody's actually using this stuff for real work
17:31technomancywhich may explain why they don't care about things like stability and releases
17:31bittiwhat, slime?
17:32technomancyyeah. half-joking, but unless all the committers work for ITA software, then there's a much lower percentage of slime maintainers that actually use it for work vs swank-clojure
17:42Chousukehm, I wonder what's wrong with maven now
17:42Chousukeit's failing to build contrib
17:42Chousukeapparently it's not finding clojure :P
17:42Chousukeeven though I have no fewer than six versions installed in my local meven repository
17:42Chousukemaven*
17:53anarsrunning 'lein nailgun' for a new project gives me this: IllegalArgumentException: No matching field found: getCommandLine ... for ant
17:54anarsclass org.apache.tools.ant.taskdefs.Java to be precise.
17:55anarsand also, when I'm doing a 'lein compile' it just tells me 'all :namespaces already compiled' and my classes/ folder is empty.
17:55anarsthis is on windows, mind you.
17:59technomancyanars: you need to list the namespaces you want to compile in project.clj
17:59technomancyare you compiling for purposes of java interop?
18:01technomancyanars: the getCommandLine problem might be an issue with an old version of ant; could you try upgrading to the latest git version of leiningen and doing a clean+deps?
18:01chouserlazy-xml should be fixed now
18:02Borkdudeanars, I had this problem too
18:02chouseralso, the grass in my yard is now neatly trimmed, though I assume there are even fewer people here who care about that than lazy-xml
18:02Borkdudebut my error was that the ns and the filename didn't correspond
18:03Borkdude:-s ...
18:03Borkdudeor maybe just the name of the ns in the project.clj and in the src clj
18:16anarsback! thanks for the responses, technomancy and Borkdude.. I'll try it and get back to you
18:23anarstechnomancy: btw, according to http://github.com/technomancy/leiningen/raw/stable/bin/lein.bat it's indicated that there's supposed to be a leiningen-1.1.0.jar at your website, but I can't seem to find it. is it the leiningen.jar?
18:24sethschouser: did the 1.2 branch change such that the ":as this" option for deftype has become a mandatory initial argument to functions defined by that type? recently?
18:25sethsgiven this protocol: (defprotocol Plane (fly [p to]))
18:25sethsthis doesn't work: (deftype Glider [] :as this Plane (fly [to] (str "slowly glided to " to)))
18:26sethsbut this does: (deftype Glider [] Plane (fly [_ to] (str "slowly glided to " to)))
18:26technomancyanars: check the .sh version; since 1.1.0 it's been hosted at github
18:28anarsahh right - thanks
18:28hoeckseths: yes, just check the commit messages :)
18:29sethshoeck: that's a little lower level than I wanted to go to debug a labrepl problem
18:29sethsI did check assembla though
18:30sethsoh, *shame*, the docstring has been updated. sorry.
18:30hoeckyeah, thats the downside of using the master
18:31sethswell, the mandatory this parameter is very pythonish
18:31sethswhich is a strong not-complement in my worldview
18:42technomancyI'll place a copy of 1.1.0 in repo.hagelb.org anyway if it's causing confusion
18:43anarstechnomancy: I dep'ed HEAD of the leiningen repos and it's working now. thanks again :-)
18:53technomancycools
19:45chouserextending a protocol to a concrete class is a lot like implementation inheritence, isn't it?
19:49tomojwhat's the point of :dependencies vs :dev-dependencies?
19:58hamzaAFAIK :dependencies are placed in the uberjar whereas :dev-dependencies are not.
19:59tomojthat would make sense
20:00tomojbut doesn't seem to be the case
20:02hamzahmm, then thats should be a bug, quote from technomancy " :dev-dependencies key for things that shouldn't be pulled in at production or included in the standalone jar; the syntax is the same."
21:13_atotechnomancy: no-db is just something I've been slowly hacking away at now and then when I have some time, it's nowhere near complete. I realised Clojars doesn't actually need a database and it'd much better if you could just point it at any old maven repo on the filesystem and start it up. Replication would just be rsync. It will also do away with the dependencies on maven and nailgun, which were causing their own set of problems
21:49defntechnomancy: correct me if im wrong, but i added your repo to my emacs for package.el stuff, but i dont notice any updated versions
21:58_atoApr 11 10:04:05 haproxy[21019]: 192.102.239.53:38538 [11/Apr/2010:10:02:29.162] trove trove/stick-8080 0/0/0/165/96485 200 2355214 - - CD-- 114/114/114/111/
21:58_atogah
21:58_atowrong channel
21:58_ato;)
22:04technomancydefn: I haven't released anything since I did my work on package.el =)
22:04technomancytomoj: yeah, you need to run clean before uberjar or they sneak in
22:05technomancyit's an open issue; there's a discussion on the mailing list of the best way to fix it
22:05technomancyhasn't proven to be a big problem so far
22:09tomojtechnomancy: ah, I see
22:09tomojI'm fine with cleaning first, didn't know that would work
22:09technomancytomoj: it's more about transitive deps vs deps only used for that project
22:10technomancyso if you want to hack your project, you want swank as a dep. but projects that depend on your project don't need to pull it in.
22:17tomojI see
22:18tomojthat makes more sense
22:19technomancyI think the uberjar thing is listed under "known issues"
22:19technomancybut yeah, we should fix that