#clojure logs

2010-01-15

00:06qbg,(#(mapcat (fn [[k v] b] (concat (repeat (- k b 1) 0) [v])) % (cons -1 (map first %))) [[0 1] [3 4]])
00:06clojurebot(1 0 0 4)
00:09qbgThat is cleaner
00:10chouserqbg: yes, nice!
00:13chousertomoj: I intend to talk with Manning about the possibility of a kind of donation "bundle" where giving $100 to Rich would get you some kind of deep discount on the book.
00:14chouserThat way you'd get the book, plus the clear concience of a full one-years donation and therefore your name (if you want) on the funders page. Would something like that interest you?
00:14chouseror would it have it it had been available before you bought it. :-/
00:18tomojchouser: it would have been
00:18tomojwould have interested me, I mean
00:18chouserok. I haven't brought it up with the publisher yet, but I will.
00:20tomojI can actually hold off on buying the book now (I hadn't yet made it into the room with my credit card), since I'm busy with non-clojure stuff right now anyway
00:20tomojif the possibility doesn't come up before I can stop resisting my urge to get a sneak peek, I'll just buy it and donate some later.
00:21tomoj(no hurry intended, I can keep myself busy for a couple months at least)
00:21chouserwell, I'm glad I could talk you out of buying the book tonight. :-P
00:21chouserI'll let people know what we're able to work out, if anything.
00:22tomojI shouldn't have bought it now anyway, as I shouldn't really devote the time to reading it, but it looks so attractive :)
00:22kanakIs it possible to create clojure datastructures in clojure (e.g. implement Vector, Maps etc)? What kind of a speed penalty (if any) would that incur?
00:22tomojI think that is a long term goal of c-in-c, yes?
00:23tomojso that these data structures can be automatically provided to various implementations
00:24tomojinstead of having to port every new feature or bugfix in clojure to your favorite implementation
00:24chouserit depends a little on what you mean. to get builtin functions like pop, conj, nth, etc. to work on your new datastructure, as of today you'd have to implement Java interfaces.
00:25tomojoh, and you can do that en clojure eh
00:25tomoj(on the jvm)
00:25kanakchouser: is this even with features such as reify, deftype and others that were recently introduced?
00:25chouserin Clojure 1.0 and 1.1 the best way to do that is with 'proxy', and that is substantially less fast than the current builtins (at least an extra hash-map lookup per method call)
00:25chouserkanak: you're on the right track...
00:26tomojis the eventual plan then to provide clojure implementations of these new features?
00:26tomojor will that be something the non-jvm developer will have to worry about, I wonder
00:26chouserwith today's master branch, you could use deftype, reify, and extend to get the very close to the same performance as the builtin collections. I think the only thing missing there is a way to do "volatile" fields.
00:27tomoj(I am particularly interested in dalvik for obvious reasons)
00:27chouseronce the pieces are all in place, I think the plan is to rewrite all the .java code in clojure, including all the collections.
00:28tomojok, and deftype/reify/whatever are included in that rewrite?
00:28kanakchouser, what kind of pieces still remain?
00:28chouserI don't know if that will happen before or after the java interfaces are phased out in favor of protocols.
00:29chouserkanak: not sure exactly. I mentioned "volatile" -- dunno if there are others.
00:29tomojwell, good to know if it's in the works
00:29tomojI mean, that it might be in the works..
00:30kanakclojure in clojure would be very interesting. Porting of the STM, persistent data structures, agents etc would make for excellent idiomatic clojure code samples :)
00:30chousermmm, indeed!
02:22albinoanyone tried clojure on jrockit
02:57albino"Perhaps you're a season Java or Lisp veteran" <- should be 'seasoned'
04:15AWizzArdesj: is this a book title? :-)
04:16Raynes:D
04:16RaynesAWizzArd: It's chouser and fogus' book.
04:16RaynesAnd I don't have a MEAP of it because I'm broke. :<
04:16esjhttp://www.joyofclojure.com/
04:20Chousukethe shipping costs are iffy. Almost a third of the total price, with the coupon. :/
04:22AWizzArdWait a minute, is this a fake or are they serious?
04:22esjyeah, its a bit rich, but still 40 USD for a programming tract is a good deal.
04:23AWizzArdWhy not just ordering the "e version"?
04:23ChousukeI like real books :P
04:24AWizzArdtry the Bilo E-Reader
04:24AWizzArdBlio
04:24RaynesI'll be getting the EBook. I can't even afford it right now, much less the print version.
04:25esjI'm old. I like to read off paper.
04:25AWizzArdwell, just safe 8$ per month and in 3-4 months you can order it
04:25AWizzArd,(/ 8.0 30)
04:25clojurebot0.26666666666666666
04:25RaynesI'm going to try to pre-order the E version at the beginning of next month.
04:26RaynesI never get print versions of these types of books.
04:26esjbut your bookshelf ! Knuth must get lonely.
04:27RaynesMy bookshelf is a folder on a flash drive.
04:33AWizzArdI could imagine that in this decade books and e-readers will become outdated and replaced by Retina Displays. Though mostly geeks will have this by the end of the decade.
04:39eivinduwhat is the most idiomatic way to create a new sequence which is n items long with equal members: given the number 3 I want the following vector -> ["a" "a" "a"]
04:40esj,(repeat 3 "a")
04:40clojurebot("a" "a" "a")
04:40esj,(into [] (repeat 5 "a"))
04:40clojurebot["a" "a" "a" "a" "a"]
04:41eivinduesj: thanks! (I was using map and range...)
04:41esjnp
04:43unfo-esj, difference between (into [] (repeat 5 "a")) and (vec (repeat 5 "a")) ?
04:44esjunfo-: no idea :)
04:44esjchousuke ?
04:44hiredmanvec maybe faster
04:44hiredman~def vec
04:45hiredmanclojurebot: ?
04:45hiredmaninto does essential a reduce using conj over a transient vector
04:46hiredmanvec just drops the collection right into a vector
04:46unfo-ah and vec just basically is a call to the constructor
04:46esjcool
04:47lypanovomgz. joy of is on 37% discount
04:48sparievi noticed the discount too :) wonder if it's permament or there are some kind of time limitations
04:50lypanovspariev: not sure. usually they last a day. but this one on twitter say something about a "weekly offer" so dunno.
04:50lypanovthey didn't give a time limit other than something about the word week in the tweet.
04:55Raynesspariev: Buy one for me.
04:55Raynes:)
05:00sparievRaynes: well , I'd like to, but I saving money to donate to rhickey from now on :) maybe a bit later :)
05:00RaynesHeh heh heh. :>
05:07unfo-damnit. typoing (if case) constantly with C# now that i've grown used to parens on the outside ;D
05:11esjhaha : i keep going (help func) in R
05:21esjis there a way to get the docs for a namespace in the repl ?
05:22esjas in (doc clojure.test)
05:22esjbrings up the metadata defined in the (ns ...) form
06:01LauJensen~doc print-namespace-doc
06:01clojurebotPardon?
06:01LauJensen,doc print-namespace-doc
06:01clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/doc
06:01LauJensenesj: I think you should be able to call (print-namespace-doc 'clojure.xml)
06:02esjnegatory :(
06:02LauJensenw00t?
06:03RaynesIt gives nil.
06:03RaynesFor everything.
06:03RaynesSame as trying to use doc on it.
06:03LauJensenThere's a bug in core?!
06:03Rayneszomg
06:04RaynesI would fix it, but I don't have have a CA. :\
06:05LauJensenIs it problematic to obtain one?
06:05RaynesLauJensen: When you live in the middle of nowhere and don't have a printer, indeed.
06:05LauJensenSo you have to print it out, and snail mail it to Rich ?
06:06RaynesI'll print it out next time I go the library, but that doesn't help me right now.
06:06RaynesLauJensen: Apparently. :\
06:06esjRaynes: I like your style.
06:06Raynesesj: 8)
06:06LauJensenOk - If you dont have a printer, så handwrite it - I think Rich would be flattered that you'd go to all the trouble
06:06RaynesHehe.
06:06arbschtRaynes: hey, if I managed to send one in from the south end of the pacific, you can too!
06:06RaynesOh, I'll get one out, just not right now.
06:07LauJensenesj: I think you caused an Internet Anomaly somewhere by saying 'Raynes' and 'Style' in the same byte-seq
06:07Raynes:\
06:07RaynesWrite one.
06:07RaynesIn Clojure.
06:08tomojthat sounds like fun
06:08esji might suggest that I'm not the one with the itch
06:08tomojtrying to get printers at your office to print out submitted pdfs/word docs/etc?
06:08esjof course, you don't have the printer, to its turtles all the way down
06:09tomojyou use your own service designed to print stuff for people to print stuff for them?
06:10tomojthat sounds like lots of "fun"
06:10tomojget things to print in a distributed way across lots of little centers where people send them off
06:10tomojand where failures or overloads at one center can be rerouted to failovers
06:11tomojand the system tracks it all by using a mobile device app which scans something affixed to the envelope when packaged for sending
06:12tomojtoo bad that wouldn't make any money :(
06:12esjget cheap snail-mail by pulling a Skype, where instead of voice you have letters
06:12esjfor international stuff
06:12tomojoh, international would be cool
06:12tomojbut it would require lots of people out there
06:13tomojeven in international stuff is there enough demand for sending snail-mail?
06:13RaynesSkype is written in Delphi. *shudder*
06:13tomojmaybe people sending stuff home to their poor families? I dunno
06:13esjlaywers
06:13esjs/laywers/lawyers/
06:14tomojwhy do lawyers need to send snailmail?
06:14RaynesLaywers. Haha.
06:14RaynesThat's a good 'en.
06:14esjsignatures
06:14esji dunno, they do weird things
06:14tomojso, you sign it, scan it, then send it off to be snailmailed?
06:15tomojif you don't have a printer seems unlikely you'd have a scanner
06:15esjno: you skype it, they sign, and snail it back.
06:15tomojok, I see, so you send off the blank form
06:20LauJensenThere are public services in Denmark which send you a letter per snail mail with your code. I'm wondering if I sign up for one of those using Rich's adress and the username "Hey Rich, I agree to the CA" if that'll do the trick...
06:30lypanovLauJensen: love your screencasts. excellently done.
06:30LauJensenlypanov: Thanks a lot!
06:40lypanovLauJensen: which emacs do you run on your osx machine?
06:40Raynes,(conj '(:x) :y)
06:40clojurebot(:y :x)
06:40RaynesDamn it. I wish I had known that conj added to the front of lists.
06:41LauJensenI stay clear of OsX as far as humanly possible - But when I am there, and on a rare occasion edit something textual, I use Aquamacs
06:41LauJensen,(reduce conj '() [9 8 7 6 5 4 3 2 1])
06:41clojurebot(1 2 3 4 5 6 7 8 9)
06:42lypanovLauJensen: i'd have installed ubuntu already on the mac if not for the apparent overheating when using it.
06:42LauJensenoh
06:42LauJensenTried Arch ?
06:43lypanovyou have that on your mac?
06:43LauJensenHmm.. now that I think of it - I think I actually mangled the cstate kernel parameters when I first installed Ubuntu - You might need to look into that
06:43LauJensenyes
06:43lypanovah, not just vbox?
06:43lypanovbattery life is okay?
06:43LauJensenNo also on its own partition
06:43LauJensenlypanov: Haven't checked
06:44lypanovmaybe i'll give it a try in the coming months.
06:44LauJensenUbuntu gives you about 25% of the battery life that osx does
06:44lypanovyeah. thats what i've heard
06:44lypanovbut people managed to sort out the major issues so its getting saner now. around 50%
06:44LauJensenarch is simple to install, use the default and add sudo and wifi_tools, then install gamin instead of fam and DONT configure X at all - everything works
06:45LauJensenhmm, reading that its not actually that simple I see
06:45lypanovi'll give a arch install inside parallels a try first.
06:45lypanovthen when i'm comfortable i'll make the jump. i'd prefer to wipe my machine first.
06:46lypanovlast time i tried using the resize stuff i heavily regretted it.
06:46LauJensenoh - that worked great for me
06:46lypanovprobably just my previous machine. the damn thing halts if you try to run a check disk on it.
06:46LauJensenfirst I shrunk my osx partition to 40gb from within osx, then I handle the rest from gparted
06:46lypanovwhat boot loader are you using?
06:46LauJensenGRUB
06:47LauJensenI tried 2.0 but I'm really truely unhappy with it
06:47lypanovany magic needed for all the efi stuff? what tool did you use for that?
06:48lypanovLauJensen: background, ex gentoo using kde developer. but at some point i got simply sick of the terrible situation with hw compat on linux and ditched it for an ibook with insane battery life.
06:48LauJensenk
06:48LauJensenI used rEFIt
06:48lypanovi've been told arch is a good choice by many.
06:48LauJensenBut looking back I think thats unnecessary - Letting Grub handle all OS's is probably the best way to go
06:49LauJensen(but, refit 'just worked')
06:58tomojI had arch on an imac for a while
06:58tomojit was nice
06:58tomojwith refit
06:58tomojthen my hard drive died and I haven't bothered to try it again
07:17{newbie}Hi! I have a question about type hints
07:18{newbie}one of the arguments passed to my function is an abstract class
07:18{newbie}even if I add a type hints
07:18{newbie}the compiler complains it uses reflection
07:19rhickey{newbie}: can you paste an example?
07:19{newbie}I took the exemple from this article
07:20{newbie}http://pixel-shaker.fr/en/2010/01/plugin-imagej-minimal-en-clojure-inverser-une-image/#sec1
07:20{newbie}I was testing the straight foward clojure version with the type anotation
07:21{newbie}.putPixel is an abstract method of ImageProcessor
07:21{newbie}and that is where the compiler complains
07:22rhickeywhere re the online Javadocs for ImageProcessor?
07:23{newbie}http://rsb.info.nih.gov/ij/docs/source/ij/process/ImageProcessor.java.html
07:23{newbie}o
07:23{newbie}this method is overloaded
07:24{newbie}nvm
07:24{newbie}it's not overloaded
07:24rhickeyyes it is
07:25rhickeyin,int,int and int,int,int[]
07:25{newbie}putPixel with iArray
07:25{newbie}I see
07:26{newbie}can I annotae the result of an expresison
07:33rhickeyyou could just wrap the unchecked-subtract or the 255 in (int ...)
07:40{newbie}well apparently the problem was with the u v types
07:41Raynesbuild.clojure.org/snapshots desperately needs a clojure-contrib-1.2.0-master-SNAPSHOT.
07:42{newbie}http://paste.pocoo.org/show/165676/
07:44{newbie}aha
07:44{newbie}no rewrite into nested loop required
07:44RaynesWho does the snapshot builds anyways?
07:44{newbie}just the type ints made it very fast
07:46jcromartie{newbie}: just the one type hint?
07:47{newbie}no
07:47jcromartiefor ImageProcessor
07:47{newbie}acctualy it was the type int for the Processor the (int ..) for the indexes
07:47{newbie}and the unchecked subtract
07:50{newbie}the last let ins ugly though
07:51lypanovanyone think i should read the practical common lisp book before reading joy of closure
07:51lypanov?
07:55jcromartieI like how Maven had to download 13 files to run 'mvn clean'
07:55LauJensenlypanov: One is for learning Common Lisp, the other for Clojure
07:55lypanovLauJensen: *nod* just thought it might be a good idea to get some lisp backgrounding
07:56jcromartielypanov: PCL is very practical... hence the name. I'd avoid it unless you wanted to learn more about CL specifically.
07:56LauJensenlypanov: You can go through PCL in not too many hours - I say give it an evenings attention, then move on
07:56jcromartieIt does give some insight into idiomatic Lisp though.
07:56jcromartiethe naming of variables, etc.
07:56LauJensenThats just my oppinion. Lisp is very simple at its core and CL and Clojure are two different implementations of the main principles
07:58LauJensenI've never sat down to learn Scheme specifically, but when I see Scheme code I understand it intuitively
08:00jlr`chouser: typo in MEAP version of The Joy of Clojure: ebook page 17 (aka bottom of section 1.3.3 Functional Programming) - "While chapter 7 may again change your view of how to build software, the discussion of macros in chapter 8 ***whould*** make for a truly amazing experience indeed."
08:01lypanovLauJensen: i've done scheme in the past. so i guess i'll grok most.
08:02LauJensenlypanov: PCL is a fun read though, so I can recommend that
08:02LauJensenI think there's also a Clojure port of the code floating around
08:02LauJensen(but its ooold)
08:11jcromartieOK, Maven dependencies and repositories do, in fact, rock.
08:11jcromartieI assume that clojure.org has its own repo.
08:12Raynesjcromartie: build.clojure.org
08:12jcromartiealready there :)
08:13RaynesAlso, build.clojure.org/snapshots. For some reason, there is no clojure-contrib 1.2.0-master-SNAPSHOT yet, so if you're using Clojure from master you'll have to build clojure-contrib against it yourself.
08:23cemerickcgrand-rec: would you accept a patch to enlive that added a bindable var for the classloader to use in get-resource?
08:31jcromartiehah wow "My practical experience from two large projects is that we have spent 1000 - 1500 hours for each project on maven related problems"
08:31lypanovhehe
08:31lypanovsounds about right :P
08:31lypanovhow is the clojure one?
08:32jcromartie37.5 man-weeks managing maven? that's scary
08:32Raynesjcromartie: This is why we have Leiningen.
08:32cemerickThat's silly. Ask me about how many hours I've put into ant over the years.
08:33jcromartieOK. cemerick: How many hours have you put into ant over the years?
08:33cemerickheh
08:33cemericklots. and lots and lots :-)
08:33cemerickThat doesn't mean ant is a bad tool. That means that building software isn't easy.
08:34jcromartieI've only done a bit of Java dev. Actually I was always the one to introduce ant and CI tools and things on Java projects. It wasn't really a problem after we got it working
08:34{newbie}the problm I have with and is that it ends up using xml as a programing language
08:34jcromartieyeah
08:34jcromartiethat's never a good situation
08:35lypanovant is pretty okay. maven is nuts though.
08:35{newbie}does maven use xml too?
08:35lypanovi like rake the most up to now.
08:35lypanovnewbie, yes, but more declarative.
08:36cemericklypanov: maven has solved so many problems for us, it *is* nuts. ;-)
08:36jcromartieIn the discussion I am reading, people cite the standard directory structure as a *bad* thing.
08:36{newbie}'-.- they just dont learn from the mistakes of the past do they?
08:36jcromartieThey don't want to be told what to do.
08:36{newbie}rake is very nice though
08:36cemerickjcromartie: is this the canonical stackoverflow thread?
08:36jcromartieyeah
08:36jcromartiethat one
08:36lypanovcemerick: i have to be honest, i prefer ant + ivy to maven.
08:36cemerickright
08:36jcromartielotta bullshit in here
08:37jcromartieI haven't even built my first maven project and I already know about -o
08:37lypanovstd dirs are great.
08:37lypanovjcromartie: -o is such bullshit.
08:37jcromartieoh, it doesn't work?
08:37lypanovmavens speed is utter shit.
08:37lypanovjcromartie: half the time you need it something else goes wrong.
08:37jcromartiewell yeah
08:37jcromartiehah
08:37cemericklypanov: There's lots of solutions for a given situation, it's impossible to say that anything is better than anything else in all cases.
08:38LauJensenYou guys should mind your language a little bit
08:38RaynesNot many people around here like maven. Leiningen.
08:38lypanov(i never swear in dutch, swear all the time in english)
08:38RaynesLauJensen: Join the FCC.
08:38jcromartiesorry LauJensen
08:39RaynesI think you guys offended his honor.
08:39Raynes:<
08:39jcromartiethis is a family channel :)
08:39LauJensennp guys
08:39cemerickRaynes: I wouldn't say that. Lein is nice, but the cleanliness of its solution is due to the fact that it's narrowed the problem scope.
08:39jcromartieRaynes: Leiningen seems nice, but I am trying to follow the "sane web dev" from cemerick
08:40cemerickA *totally* sane thing to do, of course.
08:40jcromartiecemerick: do you have your whole pom.xml for a web project anywhere to see?
08:41RaynesScala's syntax is appalling. :<
08:41cemerickjcromartie: no. The jetty config is the biggest chunk of it by far, though. Everything else is very straightforward.
08:41jcromartieI'm just not clear on the "holistic" view of web dev with clojure, I gues.s
08:41jcromartieOr web dev with Java.
08:41cemerickWorth noting is that our webapp starts up an enclojure repl server at startup as well, so we've got multiple routes into it.
08:41lypanovRaynes: after 6 years of watching poor ruby devels mess up projects. i'd rather use a lang that idiots simply can't use tbh.
08:42RaynesI'm sure idiots can use Scala.
08:42jcromartieIs there a "one-sentence summary" of web development with Clojure and servlets?
08:42lypanovRaynes: and clojure?
08:42Rayneslypanov: Of course. Lisps are easy.
08:43lypanovahh, to suck. i think i should go learn haskell then.
08:43{newbie}jcromartie: I'll give you an one word summary
08:43lypanovs/to/teh/
08:43{newbie}"gen-class"
08:43Rayneslypanov: Haskell is great, but you'll have to get over the "Every language but Haskell sucks!" barrier.
08:43RaynesI was watching them bash Lisp in #haskell earlier.
08:43cemerickjcromartie: http://bitbucket.org/jimdowning/hello-mvn-clj/src/tip/src/main/clj/example/MyApp.clj
08:44RaynesIt's best for me to stay out of those discussions. They're smarter than me.
08:44lypanovRaynes: hehe.
08:44RaynesThat's another thing, those guys always seem smarter than you.
08:44RaynesYou think you've accomplished something and then see them doing something that you can't even comprehend.
08:44RaynesPart of the reason I love Clojure. I can actually help people here.
08:45RaynesMan... It's getting early.
08:45lypanovwhats the best deployment strategy for clojure web dev?
08:46jcromartielypanov: I am sitting here trying to get started with building web apps in Clojure, but I know that I am destined to get stuck in Rails anyway. We have an "offshore team" that does PHP and Rails, and they would be utterly hopeless trying to navigate Clojure (based on the voodoo code I've seen them write).
08:46tcrayfordcompojure is really quite nice
08:46lypanovjetty? anyone have experience with getting nginx talking to jetty?
08:46tcrayfordnot quite as pretty as sinatra
08:46LauJensenyea compojure is fantastic
08:46tcrayfordbut still very nice
08:46LauJensenlypanov: nginx speaks fluently jettish
08:47jcromartieI think that Enlive is probably the most appealing part to me.
08:47lypanovvia custom protocol or just the normal proxying situation?
08:47tcrayfordis that an html templating lib?
08:48jcromartieI feel that we'll see selector-based templates all over the place soon.
08:48jcromartieIt'll be the next big thing.
08:48lypanovenlive has me interested. i can't stand this move towards html generators.
08:48jcromartieit's the first time I've seen total separation of presentation and logic
08:49lypanov(i think having html structures in my source is about the only thing i can imagine thats worse than erb's ala rails)
08:49tcrayfordthat looks pretty nice
08:49jcromartiebecause even the template tools that claim total separation still use custom elements or syntax
08:49tcrayfordyeah
08:49tcrayfordmy current project has no seperation
08:49tcrayfordand its more like controller > view > model than proper MVC
08:49jcromartiehah
08:49somniumwhat about all html generated on the client and only json from the server?
08:50tcrayfordthat has its problems on clients that don't have JS
08:50lypanovfor my app thats fine. so its what we're doing.
08:50tcrayfordbut aye
08:50tcrayfordyeah
08:50somniumtcrayford: what client doesnt have js?
08:50tcrayfordmy app has to have js enabled as well
08:50tcrayfordsomnium: lots of mobile browsers (non iphone/droid)
08:50lypanovsomnium: people that like "security" and enable noscript.
08:51tcrayfordheh
08:51somniumah yeah, low end phones
08:51lypanovyay. "security".
08:51lypanovno one browses on those phones.
08:51tcrayfordquite the contrary
08:51somniumpeople savvy enough to turn off js can turn it back on
08:51lypanovits a corner case market thats not worth the extra effort.
08:51tcrayfordbut yeah tis true
08:51lypanovall depends *massively* on the app you're building.
08:51tcrayfordfor most products
08:51lypanovif you need complete coverage. then you need it to work on them.
08:51tcrayfordyep
08:51tcrayfordnot for me
08:52tcrayfordmy app's only for personal exploration of clojure/tdd/compojure anyway
08:52jcromartielypanov: the noscript people are a minority
08:52lypanovsomnium: we have people that refuse to do so for "security" reasons. but we ignore them ;)
08:52lypanovvocal though.
08:52jcromartiethey're d*ks
08:52jcromartie:) language filter
08:52somniumlypanov: thats my policy :)
08:53lypanovyup.
08:53lypanovlau left anyway :(
08:53lypanovanyone around using jetty + nginx + compojure in production?
08:53lypanovor just clojure in general.
08:54lypanovhows clojures speed vs scala btw?
08:54tcrayfordbriancarper.net
08:54tcrayfordblog, all in compojure
08:54tcrayfordsource code is available as well
08:54jcromartieI want to try to compose this "one-sentence summary" of web dev in clojure just for my edification.
08:55tcrayfordIts really really fast to get features developed
08:55tcrayfordlike crazy fast
08:55lypanov"doesn't suck as much as rails"?
08:56lypanov(I'm not bitter at all! no, really!)
08:56tcrayforddepends if you think rails sucks :P
08:56somniumIve found its faster than ruby, though thats not surprising
08:56tcrayfordagreed on that
08:56lypanovbut as fast as scala?
08:56somniumscala gives me a headache so no idea
08:56tcrayfordscala has lift, which is pretty nice (so I've heard)
08:57lypanovbit scared by the whole reflection thing
08:57tcrayfordeh
08:57lypanovah, sorry, two conversations.
08:57jcromartieSimple web development in clojure is achieved through using the gen-class feature of the ns function to create a single Java class that is used by an external Java component called a servlet container, which routes incoming HTTP requests to your generated class, calling certain methods on it (which are typically handled at a high level by a web framework like compojure) and returning the results as an HTTP response.
08:57tcrayfordtype hints and *warn-on-reflection* are your friend
08:57jcromartiehow is that
08:57jcromartiespeed != speed
08:57jcromartielypanov: Clojure is about as fast as Scala in performance terms.
08:58tcrayfordabout right, but compojure can do all of that without using gen-class
08:58jcromartieoh really
08:58tcrayfordc
08:58jcromartiebut there has to be a class somewhere, right?
08:58tcrayfordnop
08:58jcromartieor does compojure handle that gen-class too?
08:58lypanovjcromartie: k. that was the question i had. but then the fast as in devel speed conversation started and i got confused ;)
08:58tcrayfordyou never see anything to do with classes
08:58jcromartiehow does the servlet container route the requests?
08:58jcromartieit's gotta go to some servlet class somewhere
08:58tcrayfordyou make servlets using compojure's defroutes
08:59jcromartieso it configures the servlet container dynamically?
08:59tcrayfordwhich is like sinatra's blocks with http verbs
08:59tcrayfordyeah
08:59jcromartieor are they "compojure servlets"
08:59{newbie}jcromartie: compujure uses and embbed jetty instance
08:59somniumtcrayford: it uses proxy
08:59{newbie}you can pass a proxy to it I guess
08:59jcromartieOK so compojure dynamically sets up Jetty... but what if you wanted to roll it into an existing server?
09:00jcromartieYou'd need to be able to point the server to a class.
09:00tcrayfordyou can probably compile a jar with lein and run it
09:00tcrayfordand gen-class would be used then
09:00somniumjcromartie: then you need gen-class
09:00jcromartiek
09:00jcromartieI'm going off of this, by the way http://bitbucket.org/jimdowning/hello-mvn-clj/src/tip/src/main/clj/example/MyApp.clj
09:01tcrayfordfor example of how you might do it dynamically, see http://github.com/briancarper/cow-blog/blob/master/blog/server.clj
09:02tcrayfordhe runs that behind apache using swank and emacs
09:04jcromartiethat looks nice
09:04jcromartieI especially like how easy it is to "fake" static routes
09:10Raynes^bang.
09:10RaynesMission complete.
09:54rfgpfeifferis there a clojure jar with defprotocol available in a repo for leiningen?
10:01dabdunlike Common Lisp, Clojure doesn't support keyword params. However it occured to me that a Map can be used to achieve the same effect. Is this the reason why keyword params were left out?
10:03tcrayfordthere's a thing in contrib that lets you do keyword params
10:04tcrayford,(doc clojure.contrib.def/defnk)
10:04clojurebot"([fn-name & fn-tail]); Define a function accepting keyword arguments. Symbols up to the first keyword in the parameter list are taken as positional arguments. Then an alternating sequence of keywords and defaults values is expected. The values of the keyword arguments are available in the function body by virtue of the symbol corresponding to the keyword (cf. :keys destructuring). defnk accepts an optional docstring as w
10:05tcrayfordbut yeah, they were left out as destructuring kinda eliminates the need for them
10:12cemerickdabd: If I remember correctly, keyword params were left out before map destructuring became what it is today. The original reason is that keyword params would require an extra level of indirection for every function invocation, whereas Rich's objective was to make clojure fn invocation and the clojure stack be one and the same as java method invocation and the java stack, respectively.
10:13cemerickbut yeah, map destructuring being what it is makes providing "keyword args" trivial, straightforward, and more flexible, without the perf impact of a dedicated actual keyword args mechanism.
10:24stuartsierraAnd map destructuring doesn't need to create the intermediate hash-map at runtime like defnk.
10:39cemerickwhat are folks using as a sane alias for the compojure ns? #theperilsofnotusinguse
10:43dysingernobody sean the one and only stuart s. today ?
10:45cemerickdysinger: he's right over here: stuartsierra
10:45dysingerbah I didn't see him I guess :( oops
10:46dysingerstuartsierra: up for a phone call for 5 min ?
10:47lypanovum. clojure is cute.
10:49dysingerlooks like I can drop 'new' builds from build.clojure.org now
10:55stuartsierradysinger: yes
10:58fliebelInspired by Clojure I have started to think about my own language, not with the intention of writing it, but just for fun. Where can I learn more about language design? (rhickey?)
10:58dysingerstuartsierra: 339-225-4551 is my line here at the moment
10:59stuartsierradysinger: ok, dialing
10:59Raynesdysinger: You know this is logged right? >.>
10:59rhickeyfliebel: http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH
10:59dysingerRaynes: tis ok :)
10:59lypanovonly cool people would call anyway.
10:59lypanov:P
11:00RaynesI should totally write a book in Emacs with muse-mode.
11:01fliebelrhickey: thanks, which ones are particularly interesting for learning how to design a language?
11:07dysingerI have been in Guatemala for a couple weeks not paying attention
11:07dysingerbut it appears that I can kill the 'new' branches from build.clojure.org
11:07dysingersomebody say "whoa" if you disagree
11:08rhickeydysinger: kill away
11:09rhickeyfliebel: none of them are recipe books for how to design. I think you learn best from looking at other designs. But CTM and EOPL are more survey-like
11:09dysingerthe new is dead, long live the new new
11:09rhickeyCTM = http://www.amazon.com/Concepts-Techniques-Models-Computer-Programming/dp/0262220695/ref=pd_sim_b_5
11:09rhickeyEOPL = http://www.amazon.com/Essentials-Programming-Languages-Daniel-Friedman/dp/0262062178/ref=cm_lmf_tit_10
11:10fliebelThanks :)
11:10fliebelrhickey: How did you start designing Clojure?
11:14rhickeyfliebel: it wasn't like I ever sat down with that intention. Clojure is sort of the expression of biases and ideas accumulated over a long time
11:15cemerickrhickey: did anyone ever pick up the jfli, jfoil work you did years back?
11:16fliebelSo you just code and code and code until you collected loads ideas and dislikes for features and get started?
11:16rhickeycemerick: I'm not sure anyone ever used Foil, at least no one told me they did. Nick Levine made some enhancements to jFli and used it on some client work AFAIK
11:17cemerickI remember tinkering with (and liking) both of them back when I was seeing if working with CL was at all possible given an existing java codebase. Didn't get too far before thinking the combination was a little nutty. :-)
11:20rhickeyfliebel: 2003 - http://dotlisp.sourceforge.net/dotlisp.htm, 2004 - http://jfli.sourceforge.net/, 2005 - http://foil.sourceforge.net/, 5/2005... Clojure
11:20_fogus_rhickey: Is it true that Norvig's JScheme was the motivation for dotLisp?
11:20rhickeycemerick: I see, nutty
11:22rhickey_fogus_: yes, and acknowledged on that page
11:22cemerickrhickey: Not particularly rigorous, I know. That feels like a *long* time ago, and memory is faded.
11:22fliebelIt would be cool to see a history page on Clojure.org :)
11:22_fogus_fliebel: +1
11:23rhickeycemerick: there are definitely insurmountable problems with the approaches of jFli and Foil, and they were drivers in the (IMO, nuttier :) decision to write a new language
11:23_fogus_rhickey: Ahhh, I knew I had read that somewhere. :)
11:24cemerickrhickey: my biggest problems were with CL itself as a reasonable place to call home, rather than the bridges themselves. Given that, a new language makes all the sense in the world to me.
11:24rhickeybut it is not as if DotLisp is really a precursor or early version of Clojure. DotLisp was toying around, interpreter etc, just a rite of passage
11:25cemerick'course, I didn't put the years of work into it :-)
11:25_fogus_rhickey: Thanks for the comments on IRC yesterday about the book, I don't know what "doozy" means, but I'll just assume it's positive ;)
11:26rhickey_fogus_: I'll try to get you guys some more considered feedback than that :) But overall, yes, positive - I like the focus on the ideas in Clojure
11:26fliebel_fogus_: doozy: something outstanding or unique of its kind. (according to my dictionary)
11:27_fogus_rhickey: Any feedback that you have time for would be welcome indeed. Good or bad.
11:29_fogus_Well, all feedback is good.
11:30fliebel_fogus_: is this about the clojure book you and… can't remember... are writing?
11:32_fogus_fliebel: "Some guy" named chouser ;-)
11:32fliebelAh, of course!
11:35fliebelCan a mortal human like me already read some sort of preview of it? I see things about it popping up now and then, but I keep forgetting even the name and the authors…
11:39stuartsierraKeyword arguments done right: http://stuartsierra.com/2010/01/15/keyword-arguments-in-clojure
11:41ecyrbIn the methods list of a gen-class form, how do I specify a parameter of type array of String?
11:41ecyrb(Sorry if my terminology is awful)
11:42cemerickstuartsierra: nice. Do you always use commas in your code, or is that just for blog readability?
11:46stuartsierracemerick: thanks. I often use commas in maps.
11:49cemerickInteresting. I always separate pairs with linebreaks.
11:50stuartsierraI do one or the other. If the map is small enough to fit on 1 line, I use commas to separate pairs.
11:59_fogus_fliebel: http://www.manning.com/fogus/Fogus_MEAP_Ch1.pdf
12:00fliebel_fogus_ whoa! thanks :)
12:00fliebel_fogus_: no tigers :(
12:01_fogus_?
12:01dysingerstuartsierra: I managed to hose the box my fat fingering my authorized keys :( - will take me an hour or so to rebuild it.
12:01fliebel_fogus_: headfirst books contain a lot of jokes and images to keep your attention. I kind of like that...
12:02dysingerhose the box *by* fat fingering
12:02_fogus_Sorry, I can barely draw stick figures. :(
12:02fliebel_fogus_: that would be fun… :)
12:04fliebel_fogus_; I instantly imagine stick figure fights between languages and different ways of coding, etc.
12:05jasapp_fogus_: in fact, maybe you could make it into a flip book ;)
12:06_fogus_jasapp: oooooooo, good idea. Mutable-Bill vs. Immutable Bob.
12:06jasappgood for showing the difference between expansion time, and compile time too
12:07fliebel_fogus_: haha, maybe as an easter egg in the bottom right corner of every page :P
12:07_fogus_That is actually a really good idea!
12:09fliebel_fogus_: maybe you should skim a few pages of head first java for ideas… They also have a good introduction to the concept at the start.
12:10_fogus_I read it many moons ago, but maybe I will skim it like you say
12:10AlexS_I am starting out with slime/swank-clojure installed from ELPA. It seems no keybinding for slime commands are set up by default. Is that expected?
12:10fliebel_fogus_: Roses are red violets are blue, mutating collections you should not do :)
12:12fliebelhttp://www.headfirstlabs.com/about.php
12:13jkdufairooh. shakespeare, spinal tap, and clojure, FTW
12:41lypanovare there any paredit screencasts?
12:57jkdufairvery excited to read about datatypes and protocols. was just thinking this morning, trying to map my smalltalk-y brain into clojure via classes like sorted lists and the like
12:58jkdufairclojure kicks ass. i haven't been this excited about a PL since i learned smalltalk a decade ago
12:58jkdufairenjoying playing with coin flipper apps and such. thx stuartsierra
12:59stuartsierrajkdufair: you're welcome
13:06ohpauleezhey guys
13:17jlblypanov: not a screencast, but this helped me bunches - http://www.slideshare.net/mudphone/paredit-preso
13:19jlbmost things in paredit are straightforward, but getting out of the ((foo bar)) situation required digging up some help :)
13:31taotreeI'm new to clojure. I have a set of lisp files trying to run them from Java. I'm running RT.loadResourceScript, var, invoke and I get an error "Unable to resolve symbol: in-package in this context"
13:33arohnertaotree: that sounds like a "normal" error in your clojure file
13:34taotree"normal" error? the lisp file works when run from lisp. Do I need to include a library that defines "in-package"?
13:34stuartsierrataotree: Are you trying to run Common Lisp sources in Clojure?
13:34taotreeyes
13:34stuartsierraClojure is not Common Lisp.
13:34the-kennytaotree: Clojure isn't common Lisp
13:35fanaticotaotree: http://common-lisp.net/project/armedbear/
13:35taotreeyes, I understand... is there a straightforward porting process?
13:37arohnerthe same as porting from one programming language to any other
13:37taotreeok, thanks
13:41the-kennyMaybe it's a bit easier with a similar syntax, but the immutability could be a bit annoying while portin
13:41the-kenny*porting
13:54maaclDoes compojure support gzip?
13:55arohnermaacl: Jetty does
13:56maaclarohner: Is there an easy way to switch it on from Clojure?
13:56tolstoySo, if I want to throw a custom exception (with a payload) deep in my Clojure app so it's caught at the top layer and an error is reported, am I doing it wrong?
13:56tolstoyCan't create custom exceptions (except in Java).
13:56hiredmanyou can
13:57tolstoyCan you?
13:57hiredmanusing gen-class
13:57tolstoyDoes that work in the repl, too?
13:57hiredmanonly for AOT
13:57tolstoyI'm thinking a better pattern is some sort of macro at the top layer.
13:58hiredmanbut I don't think using exceptions "deeply" is a good idea
13:58hiredmanif you must use exceptions deal with them as close to the source of the exception as possible
13:58cemerickhrm, I wonder how many here use compojure but aren't in #compojure :-)
13:58arohnermaacl: you'd have to check your server docs
13:58chouser_tolstoy: you could bind a var at the top level and call it instead of throwing an error
13:58arohnerit might be possible
13:58chouser_it wouldn't unwind the stack, but could report any details you want without having to AOT compile
13:59tolstoyThe idea here is that it's a web request. Any number of things might go wrong, and so "handling" it is just offering a response with the error in it.
13:59tolstoychouser_: That sounds interesting. Hm.
14:00LuytFrom Hacker News, http://joyofclojure.com/
14:00mebaran151how do I reset the slime repl?
14:00hiredmantolstoy: why would a webrequest end up that "deep"?
14:00chousercontrib has error-kit which does a hybrid of that and exception-throwing, plus a little object model all thrown together in one big happy mess.
14:00the-kennyLuyt: chouser etc. are in here :)
14:00the-kennymebaran151: ,q
14:00the-kennyEw.. ,r or so
14:01the-kenny,q closes the repl
14:01clojurebotjava.lang.Exception: Unable to resolve symbol: q in this context
14:01hiredmanfnparse seems to have been leinized, but not pushed to clojars :(
14:01tolstoychouser: I'll check that out. Thanks!
14:01mebaran151hmmm?
14:01mebaran151,q
14:01clojurebotjava.lang.Exception: Unable to resolve symbol: q in this context
14:01chousertolstoy: I
14:01chousertolstoy: I'm not really recommending it, just mentioning its existence
14:01chouserthe mess may not be so happy
14:01the-kennymebaran151: clojurebot can eval clojure-code, starting with a ,
14:02the-kenny,(+ 1 2)
14:02clojurebot3
14:02jdercan anyone suggest how I might use print from non-main threads in the slime repl?
14:02mebaran151oh no I know
14:02tolstoychouser: It might jog my creativity, though. So it's all good.
14:02chousertolstoy: if calling a thread-bound var would be sufficient, by all means just do that.
14:02mebaran151jder: you could send all the results to an atom and print that
14:02the-kennyjder: There's a variable somewhere which is called something like "print-inferior-text-in-main"
14:02jderthanks, guys, I'll investigate
14:04hiredmanand fnparse's project.clj has an unmatched delimiter
14:05technomancyjder: also contrib's logging lib can do it
14:05konrCan I use the cross-reference slime functions with clojure?
14:06technomancykonr: no. =(
14:06technomancyit's somewhere on my backlog of things to implement though
14:07cemerickwow, I've forgotten how painfully complicated J2EE security is.
14:11hiredmantechnomancy: can you tell lein to use a custom groupId when generating a pom?
14:13mtmany handy set of clojure functions for dealing with date/time? or do I just need to fall back on joda or java.util.Date?
14:13technomancyhiredman: defproject mygroup/project-id should do the trick.
14:14hiredmanah
14:14technomancymtm: joda if you need to be able to compare times between different timezones or jump across DST boundaries
14:14hiredmanmakes sense
14:14technomancyhiredman: yeah, I was pleased to be able to use the symbol's ns as the groupId
14:15mtmtechnomancy: thanks, I'm looking at writing some code to play with iCal format (.ics files)
14:17technomancyI wrote a dumb wrapper around java.util.Date, but it has serious bugs wrt DST
14:17technomancyto be fair, DST itself is fundamentally incompatible with the idea of a linear timeline, so it's no surprise that it's nearly impossible to get right.
14:18mtmdate/time has always been a thorny rats-nest to deal with as far back as I can remember; so many edge cases
14:19technomancyyeah, if I get a time machine, going back to kill/kidnap william willet is in my top 5
14:19technomancyprobably right after convincing Brendan Eich not to make Javascript look like Java
14:20technomancyhttp://twitter.com/coda/status/4928323914
14:21mtm:D
14:21mtmwe just need... Metric Time!
14:22metrictime
14:22mtmha!
14:23the-kennyWe should just use the Swatch Internet Time :)
14:23technomancyI'd be happy with a time system that always progresses forwards and doesn't pretend that the same hour happens more than once
14:23mtmthere are roughly Pi seconds in a nano-century
14:23mtmtechnomancy: it's called GMT (or zulu time)
14:24mtmthe-kenny: and the beat goes on...
14:24jkdufairjunior, your birthday is coming up soon! it's only 5.1 megaseconds away!
14:25the-kennymtm: Yes :)
14:25the-kennyIt's @853.beats now
14:46bpsmI've (1) sent in my CA and (2) Applied to join clojure-dev, but thus far no joy.
14:46bpsmHave I overlooked something?
14:51ericthorsenIs there a "blessed" place for clojure.lib builds? (1.0, 1.1)
14:52technomancyericthorsen: http://build.clojure.org
14:52tolstoyericthorsen: If you're talking contrib, there's a google code project where they drop jar files
14:52technomancycontrib is still being figured out
14:53hiredmanis there a way to pass java options through lein?
14:53ericthorsentechnomancy: that appears to be just the latest...no 1.0 and 1.1
14:54technomancyhiredman: if it's not respecting $JAVA_OPTS that's a bug
14:54ericthorsentolstoy: that's a start...thanks
14:54hiredmantechnomancy: excellent
14:54tolstoyhttp://code.google.com/p/clojure-contrib/
14:55stuartsierraI am working with dysinger on getting numbered contrib releases in a maven repo at build.clojure.org
14:56stuartsierrapre-built ZIPs are already available on Google Code
14:57bpsmtolstoy: http://github.com/richhickey/clojure-contrib/downloads also. Which is "more official"? Are download sites kept up-to-date?
14:57ericthorsenstuartsierra: that's great. The google code zips will hold me over for now. It would be nice if the same were available for Clojure proper
14:58tolstoybpsm: I have no idea. I wish there were links on Clojure.org or what have you.
14:59stuartsierraericthorsen: there are ZIPS of Clojure proper on http://code.google.com/p/clojure/
14:59ericthorsenstuartsierra: perfect. Thanks!
15:00kotarakHow does clojars handle scp?
15:01stuartsierraThe "downloads" on http://github.com/richhickey/clojure-contrib/downloads are auto-generated by Github. They are source-code-only, not pre-built binaries.
15:02bpsmstuartsierra: ah! now more enlightened.
15:02hiredmankotarak: jsch I believe
15:03kotarakhiredman: I have trouble using the ant scp task. It works for my server but not for clojars. It's waiting for some ACK it seems.
15:03hiredmanhmmm
15:04hiredmandirect scp to clojars works
15:04kotarakyes. jsch (which is used by the ant scp task) to ssh works also. But jsch to clojars does not work. :(
15:04technomancyjsch is quirky. I could only get it to work with RSA SSH keys
15:04kotarakbleh
15:05tolstoysometimes you have to implement the UIKeyboardInteractive interface, or something like that.
15:05technomancywhich is why "lein push" is no longer supported
15:05kotarakWell. No. My key works for a normal ssh server. So it's not the key, I guess.
15:06kotaraktechnomancy: :( I wanted to provide something similar with clojuresque.
15:06hiredmananyway, clojurebot is leinized
15:06hiredmanhuzzah
15:06kotarakInvoking external commands is so clunky.
15:06tolstoyhttp://www.jcraft.com/jsch/examples/ScpTo.java
15:06hiredmanout of all the lein command I've used, lein repl is the only one that didn't work with /bin/sh
15:08technomancylein repl needs to get replaced anyway
15:08technomancyit's the only one that doesn't use a subclassloader
15:08technomancydue to funkiness with IO and clojure.main
15:08technomancyhiredman: but thanks for checking that
15:09hiredmansure, "checking that" was what I was doing...
15:28cburroughsmta you may be interested in http://liebke.github.com/incanter/chrono-api.html
15:33lypanov omdog. incanter has mongodb stuff.
15:35technomancythat's ... weird.
15:37the-kennyAgreed
15:38chouservectors, lists, and java lists can be = to each other, but can never be = to a set or a map.
15:39chouser"set" and "map" nicely describe those two groups, so what's the word for the group that includes vectors, lists, and java lists?
15:39stuartsierrajava.util.List?
15:40cburroughslypanov, More formally incanter has a incanter-mongodb submodule.
15:40qbgordered?
15:40hiredman ,(ancestors (class ()))
15:40hiredman,(ancestors (class ()))
15:40clojurebot#{clojure.lang.Sequential clojure.lang.IPersistentCollection java.lang.Iterable clojure.lang.IPersistentList clojure.lang.IObj clojure.lang.ISeq clojure.lang.Seqable java.util.List clojure.lang.Obj clojure.lang.IMeta java.lang.Object clojure.lang.Counted clojure.lang.IPersistentStack java.util.Collection :clojure.contrib.generic/any}
15:40lypanovcburroughs: its like clojure was designed precisely for the project i was originally planning to do with ruby this week.
15:41lypanov(and a good first project)
15:42somniumclojure is good at becoming precisely designed for whatever it is youre doing =)
15:43lypanovsomnium: especially when neat guys write mongodb wrappers.
15:43lypanovthe day after there is a 37% MEAP discount on joy of.
15:44chouserlypanov: did that code stop working?
15:45lypanovno idea. should it work for more than 24 hours?
15:45lypanovi was going to retweet it but didn't want to bum someone out if its already ended.
15:45chouseroh, I thought you tried it ... I wasn't sure what "day after" was relative to
15:46chouserI think the code is good all week. not sure when that ends precisely.
15:46lypanovchouser: i used it this morning. my wife entered the house just as i was about to buy it last night - had not seen the offer..
15:49lypanovum. leiningen is just great. pragmatic but idealist.
15:53lypanovtechnomancy: to a newbie. would be nice if lein repl loaded the newly added deps. i can't easily see what i'm meant to run to get them.
15:55the-kennylypanov: close the repl, run "lein deps" and restart the repl
15:55lypanovaye. got it already.
15:55lypanovmaybe the docs should be less "explicit" about what lein deps does.
15:56lypanovits not obvious that "installing into lib" is the same as "downloading deps"
15:59stuartsierra~def merge-with
16:07lypanovis there a shortcut for (ns blah (:use foo)) in the repl?
16:07lypanovso i can just type the :use somehow?
16:07qbg,(doc refer)
16:07clojurebot"([ns-sym & filters]); refers to all public vars of ns, subject to filters. filters can include at most one each of: :exclude list-of-symbols :only list-of-symbols :rename map-of-fromsymbol-tosymbol For each public interned var in the namespace named by the symbol, adds a mapping from the name of the var to the var to the current namespace. Throws an exception if name is already mapped to something else in the current nam
16:08hiredmanlypanov: use
16:09hiredman,(doc use)
16:09clojurebot"([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer."
16:09lypanov"in pref to calling ..." is for neatness in real code?
16:09lypanovor it might be deprecated?
16:10stuartsierranot deprecated
16:10stuartsierraBut recommended for interactive use only.
16:12lypanov(ns boo (:use somnium.congomongo)) -> nil
16:12lypanov(use somnium.congomongo) -> classnotfound
16:13lypanovdirectly calling :use gives the same
16:13the-kennylypanov: Try to quote somnium.congomongo.
16:13the-kenny(use 'comnium.congomongo)
16:13lypanovah. that works. awesome. thx the-kenny!
16:19ordnungswidrighi. When defining a dsl by using macros, what is the recommented way to signal an error at macro runtime?
16:20hiredmanyou can throw exceptions if you want
16:20hiredmanor just have the macro expand into something that would signal an error
16:20ordnungswidrighiredman: I want it to fail early. So a custom exception would be fine?
16:21hiredman*shrug*
16:22ordnungswidrighiredman: I want to fail it at "compile time"
16:23kotarakordnungswidrig: you can throw excpetions from a macro.
16:23somnium,(throw (Exception. "the world ended"))
16:23clojurebotjava.lang.Exception: the world ended
16:25ordnungswidrigI know, thanks. But is this considered good style? Or is it better to have the macro to always expand and as hiredman said, signal at runtime?
16:26qbgIf you want it to fail early, throwing an exception is probably better
16:34stuartsierraThrowing exceptions at compile-time is acceptable. The core libraries do.
16:54lypanovum
16:54lypanovanyone any clue why my slime might start up and then instantly die?
16:54qbgDoes it say anything?
16:54lypanovit was working, (doc blah) worked. then the logo faded in and boom, it won't react anymore.
16:55lypanovmaybe i just got a bad version? is there a good way to get a stable one?
16:55qbgIs emacs still responsive?
16:55qbgSLIME is a crazy project
16:55lypanovyes
16:56qbgWhich version do you have?
16:56lypanovtodays snapshot.
16:57qbgSnapshots aren't always stable
16:57qbgYou could try an older version
16:58technomancylypanov: slime trunk has known issues with clojure
16:58lypanovah, :D that would explain
16:58technomancysee the swank-clojure readme for stable install instructions
17:00lypanovtechnomancy: i used the magical mac pkg that comes with aquamacs thinking that would Just Work.
17:01technomancylypanov: aquamacs is ... "lightly supported"
17:01lypanovtechnomancy: ah.. bummer.
17:01lypanovwhats best to run on mac?
17:01technomancyaquamacs is often broken in strange and unpredictable ways, and it's not portable, so I can't test it myself
17:02lypanovk. grabbing. thank you!
17:06stuartsierraWhat's the deai with overlapping interfaces that implement the same method signature?
17:06lypanovapparently my mac has once again gone insane. newly installed apps lack icons in the dock now.
17:11alexyksomnium: pingy-wingy
17:11somniumalexyk: heyy
17:12alexyksomnium: is there a faster mass-fetch, similar to mass-insert?
17:12alexykfor oodles of data
17:12somniumalexyk: not sure I follow, fetch always returns one cursor
17:13somniumwhich gets seqed
17:13alexyksomnium: I mean, is there a way to tell fetch to work in blocks of say 10000?
17:13alexykis it chunkable inside mongo-java?
17:15somniumhmm, you can get the cursor with .find and do imperative stuff to it
17:16alexyksomnium: I didn't look if java's fetch is chunkable... but I want clojure's to be fast! :)
17:16alexykand it's damn slow now :(
17:18lypanovalexyk: /me == an alex k playing with mongo.
17:18somniumalexyk: your datasets are a few orders of magnitude beyond the 'normal' use case :)
17:19lypanov"File error: Cannot open load file, swank-clojure-autoload"
17:19lypanoveep :(
17:19somniumalexyk: dropping into an imperative-style loop-recur on the cursor is probably going to give a performance boosn
17:20alexyksomnium: ok, will look
17:21lypanovtechnomancy: on trying the instructions in the module. i get File error: Cannot open load file, swank-clojure-autoload
17:21lypanovtechnomancy: running M-x slime i get "Symbol's value as variable is void: package-activated-list"
17:23somniumalexyk: are you still using old-new?
17:24alexyksomnium: nope, old old :)
17:24alexykplain 1.1.0-snapshot
17:24alexykshould I recompile stuff? I was wary of changing everything right away
17:24alexykas am in the middle of a deadline
17:26Rayneslypanov: Did you get Swank from ELPA?
17:26lypanovw.t.f.
17:26lypanov [java] Compiling clojure.contrib.pprint.PrettyWriter to /Users/lypanov/src/clojure-contrib/classes
17:26lypanov [java] java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V
17:26lypanovi'm assuming i timed all of this realllly badly.
17:26Rayneslypanov: That means you need to build Clojure contrib master against your clojure.
17:26qbgDo `ant clean`
17:26RaynesYou're using a verion of c.c that was built against an older version of Clojure.
17:27lypanovman. in the deep end today :D
17:27lypanovgotta install vi mode first else can't use emacs.
17:27lisppaste8stuartsierra pasted "2-element Tuple deftype" at http://paste.lisp.org/display/93468
17:28stuartsierrarhickey: that was harder than I expected
17:29hiredmanRaynes: he is compiling contrib
17:29Rayneshiredman: The only thing I know to cause that is not having c.c compiled against whatever Clojure you're using.
17:30lypanover, thats majorly broken.
17:30RaynesMaybe his jars are screwed up.
17:30technomancylypanov: you probably have some manual slime config left over from your old installation
17:30technomancyon the elisp side
17:30hiredmanlypanov: where did you get your clojure.jar?
17:30lypanovtechnomancy: nope.
17:31rhickeystuartsierra: how so?
17:31lypanovtechnomancy: but,after install. i did a clojure-update.
17:31lypanovtechnomancy: and got java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V
17:31stuartsierrarhickey: just finding all the methods to implement
17:31rhickeyrhickey: or, welcome to my world :)
17:31hiredmanlypanov: where did you get your clojure.jar?
17:31lypanovtechnomancy: but: BUILD SUCCESSFUL
17:31lypanovTotal time: 5 seconds
17:31lypanovhiredman: checking sorry.
17:32stuartsierrarhickey: I was confused by the fact that the same methods appear in multiple interfaces.
17:32stuartsierraDoes it matter which one I implement?
17:32lypanovhiredman: afaiu, that came via clojure mode el
17:34lypanovit seems to grab 1.0
17:34hiredmanlypanov: I am pretty sure contrib came with clojure-mode
17:35lisppaste8stuartsierra annotated #93468 "Microbenchmark Tuple vs Vector" at http://paste.lisp.org/display/93468#1
17:35rhickeystuartsierra: yeah, that interface inheritance will go away with protocols. No, it doesn't make a difference, as long as same sig
17:35hiredmantechnomancy: ?
17:35stuartsierraIt's faster than 2-element vectors, though:
17:35lypanovi'll scrap everything and start from scratch
17:36stuartsierraTuple2 speed comparison with Vector: http://paste.lisp.org/+204C/1
17:36rhickeystuartsierra: those conds look like candidates for case
17:37stuartsierrarhickey: you're right, didn't know case was in core yet
17:37lypanovoh... crap...
17:37lypanovi git cloned the first hit on google...
17:37lypanov*shame*
17:37lypanovk... gonna come back to this.
17:37lypanovhiredman / technomancy: exactly which version of this do i want? technomancy or jochu?
17:37lypanov(github)
17:37lypanovor the contrib version?
17:38ninjuddwhat is the most efficient way nowadays to serialize clojure structs?
17:39stuartsierraninjudd: structs are largely obseleted by deftype
17:42ninjuddstuartsierra: oh, are types more efficient to serialize?
17:43ninjuddstuartsierra: is deftype in the stable branch, or is it still is development?
17:43stuartsierraThey're easier to serialize and recover the type information when reading back
17:43stuartsierraefficiency is probably about the same
17:43stuartsierraIt's on the master branch now, not yet in a numbered release.
17:44ninjuddok, so what is the most efficient way nowadays to serialze types?
17:44stuartsierrarhickey: Tuple2 with case is slower than with cond!
17:44stuartsierraninjudd: define efficiency. Time to serialize? Space occupied by serialized form?
17:48stuartsierrapr/read and Java serialization are built-in. Anything else you'll have to implement yourself.
17:48ninjuddtime
17:48ninjuddstr-pr/read-string are not fast enough
17:48ninjuddwould Java Serialization be faster?
17:48hiredmanare they serializable at all?
17:49hiredmanclojurebot: ping?
17:52hiredmanhmmm
17:56ninjuddso Java Serializable support is available in clojure now? is that is master?
17:59hiredmanclojurebot: ping
17:59clojurebotPONG!
19:12eivinduanyone running tests from vimclojure? with \rt it just gives me {:type :summary, :test 1, :pass 5, :fail 1, :error 0} and not the detailed descriptions as I get with `lein test` (which is too slow to spin up)
19:15hiredmanclojurebot: ping
19:15clojurebotPONG!
19:19the-kennyclojurebot: pong
19:34defnclojurebot: pong is <reply>PONG YANG!
19:34clojurebotIn Ordnung
19:38the-kennyclojurebot: pong
19:38clojurebotPONG YANG!
19:38defnI think it's actually Pyongyang
19:38defnclojurebot: forget pong
19:38clojurebotI forgot pong
19:39defnclojurebot: pong is <reply> Qinfengxiang!
19:39clojurebot'Sea, mhuise.
19:42alexykI have a largish map painfully built from disk. Now if I mess up and cojure repl starts printing large piece of data into rlwrap, it all gets effed up and I have to Ctrl-C, wasting the previous hours loading the darn map. I've heard there're things like Terracotta allowing to share memory between JVMs. Ca I shove the map into it and then get it back really quickly?
19:45the-kennyalexyk: The first thing you could do is set a print-limit
19:45the-kennySo the repl won't start printin large pieces of data :)
19:45alexykthe-kenny: how?
19:45the-kenny*print-limit* etc.
19:46the-kennySome global vars
19:46alexykok, still I wonder about persisting things into RAM
20:31redalastorI'm having a mysterious clojure related JNI problem, can someone help with that?
20:45redalastorI'm having a C++/clojure app with a single Java Class (everything is static in it) to bridge everything via JNI. If I call a particular method, it crashes the JVM, unless I comment out a single clojure function call. Calling that method from java works fine. I own nothing more than the class and method id on the C++ side. I can call other clojure functions in that method with no problem. I don't know where to look to solve the
20:45redalastor problem.
20:54the-kennyredalastor: You should tell a bit more about this particular function
20:54redalastorthe-kenny: There's nothing very strange about it... where's the pastebin?
20:54the-kennylisppaste8: url
20:54lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
20:55lisppaste8redalastor pasted "JNI trouble" at http://paste.lisp.org/display/93473
20:56redalastorBoth remove-column and remove-row when called from java called by C++ fail.
20:56redalastorBut they work as expected when called from clojure or java.
20:57redalastorWell... They don't fail, the JVM crash.
20:59the-kennyhmmm strange
21:11redalastorI also tried having another method call that method and it still crashes the JVM.
21:29rikthevikhey, can someone link me to a example of well set up clojure project? i'm having trouble laying things out and setting up my build
21:31ltyphair rikthevik: have you tried lein? http://zef.me/2470/building-clojure-projects-with-leiningen
21:32riktheviki have. the first time i started using it it downloaded a metric shitload of stuff. is lein turning out to be the clojure standard?
21:33the-kennyrikthevik: I think so. It's a great tool
21:33ltyphairrikthevik: it takes the best parts of maven and clojure-fies them
21:33rikthevikcool. this article is really good. thanks for the advice
21:39defnhmmmmm weird
21:39defnapparently using slime's fuzzy completion screws up the way i used to be able to do clojure.contrib.str-utils/[TAB]
21:39defnand get a list of possible forms
21:41the-kennydefn: Yeah, that's broken for me too
21:41the-kennyMaybe I'll try to fix this.. but not today
21:41defnis there any way to get the standard completion to work?
21:41defnwhat's the name of the basic completion fn
21:42the-kennyslime-complete-symbol*?
21:42the-kennyAh, no
21:42defndoesnt work
21:42defn:(
21:42the-kennydefn: slime-simple-complete-symbol
21:43the-kennysetq slime-complete-symbol-function to 'slime-simple-complete-symbol
21:43defnif only i had that function
21:43the-kennyhuh
21:43defnM-x slime-simple-complete-symbol
21:43defndoesnt exist
21:43the-kennyIt isn't an interactive function
21:43the-kennyYou can't call it with M-x
21:43defnoh i see
21:43defnmy bad
21:43the-kennyTry C-h f slime-simple...
21:44the-kennyC-h v slime-complete-symbol-function RET is interesting too
21:44defnhmmmm, i should try to fix this
21:45the-kennydefn: I'm almost sure the c.c.str-utils/TAB stuff is a problem in fuzzy-completion in the contrib of swank-clojure. You should start there
21:45the-kennyI'll take a look at this tomorrow too
21:49defnthe-kenny: hmmm
21:49defnapparently there's a swank-fuzzy and a slime-fuzzy
21:49defni didnt know that...
21:49the-kennythe fuzzy completion need a backend too
21:52the-kennyWhoa, slime_fuzzy.clj is really... let's say funny to work on
21:54defnthe-kenny: lol yes
21:54defnthe-kenny: it should be redone
21:55defnthe-kenny: i have no idea what im doing in there so im going to leave it alone
21:55defnif you figure out a fix please let me know
21:56the-kennydefn: Of course, I will contact you
21:56the-kennyI'm pretty sure a fix like this would be merged into swank-clojure too
21:56defni dont understand how the heck all of the plumbing works i guess
21:57defnwhat does swank do that slime doesnt?
21:57the-kennyswank is the backend for slime
21:57the-kennyslime runs in emacs, swank in the lisp process
21:58the-kennyLooks like slime-fuzzy needs some special work on the backend side
22:04qbgI'm writing a macro that is installing an :arglists entry in the meta data for a var by setting the meta data for symbol when I def it. But the compiler seems to be doing magic here
22:05defnThe Joy of Clojure is going to be a massive book
22:05qbgIf I put a symbol that hasn't been def'ed yet in :arglists, I get an exception saying that the symbol can't be resolved
22:05ltyphair defn: reading it now. liking it so far.
22:06qbgIf the symbol has been def'ed, I get a wrong number of args passed to PersistentVector error
22:06qbgWhat is going on?!?
22:06defnltyphair: a lot of spelling errors :X
22:08defnltyphair: 100+ pages for 1-4, image how many there will be when they add another 250
22:08defnimagine
22:09ltyphairdefn: right. the editor will clean it.
22:09the-kennyI don't have the money to buy it right now :(
22:09ltyphairthe-kenny: i had a code and only got the pdf so it was affordable.
22:10the-kennyuh the code is good
22:10defnthe-kenny: does it have to do with the / after the 'ns
22:10defnmaybe?
22:11qbgThis is strange: If I def without the meta data, then alter the meta data of the var later, it works
22:11qbgVery strange
22:11the-kennydefn: I think it just completes the namespace-declaration and - when it's completed - it treads it as a complete declaration and doesn't recognize it as a namespace with functions in it
22:11qbgI wonder if it is intended behaviour...
22:12defnthe-kenny: hmmm
22:12defnso it's not recognizing it as a namespace
22:12the-kennydefn: That's just an idea
22:20the-kennyNo :( Can't buy the book without a credit card
23:03qbg,(do (defmacro foo [] (let [new-meta {:doc '(throw (Exception. "D'oh!"))} name (with-meta 'bar new-meta)] `(def ~name nil))) (foo))
23:03clojurebotDENIED
23:04qbg:(
23:07qbgI can set the metadata using the read syntax, but if I do it from a macro, the exception is thrown
23:13qbgAh, it needs to be double quoted (that's strange...)
23:57Apage43man
23:57Apage43clojure makes me feel like a god sometimes, you know