#clojure logs

2010-02-25

00:09arohnerhere's a fun one: I have a (lazy) resultset-seq that comes out of the DB, and I lazily reduce it. The seq is too big to hold in ram. Is there any way to get the count of the seq?
00:11cemerickarohner: reduce isn't lazy...
00:11arohnerthere are a bunch of intermediate steps, and the final step is a reduce, into an object that does fit in ram
00:12cemerickwell, you can reduce a vector of [count, your-other-object] through the seq
00:12arohnertrue
00:13cemerickother approaches would be to swap! inc an atom defined outside the reduce fn *shrug*
00:13cemerickanother approach, that is
00:47lancepantzanyone know how i can read in a file from the WEB-INF directory of a war?
00:47lancepantzi'm trying this: (.getResourceAsStream (clojure.lang.RT/baseLoader) "WEB-INF/db/database.yml")
00:47lancepantzno dice though
01:02cemericklancepantz: nope, not possible. If you need a resource under web-inf, you'd need to have it in WEB-INF/classes, or in a jar in WEB-INF/lib
01:05lancepantzi've tried with it in classes as well, how would i qualify the path? the file is in WEB-INF/classes/db/database.yml
01:05lancepantzi tried (.getResourceAsStream (clojure.lang.RT/baseLoader) "/db/database.yml")
01:06lancepantzah, just got it :)
01:06lancepantzthanks cemerick
01:07cemerickyeah, you don't want the leading /
03:20LauJensenMorning team! :)
03:20vu3rddLauJensen: good morning!
03:43ordnungswidrighi hall
03:46esjMoaning.
03:51sparievmorning
04:03Crowbar7Morning sir
04:03Crowbar7or mam
04:08avarushi
04:43caljunior(filter nil? [1 2 3 nil])
04:43caljunior,(filter nil? [1 2 3 nil])
04:43clojurebot(nil)
04:43LauJensen,(filter identity [1 2 nil 4 5])
04:43clojurebot(1 2 4 5)
04:43caljuniorthanks lau
04:44LauJensennp
04:46AWizzArdthe nice thing about filter identity is that it can also eliminate false from the coll
04:47AWizzArdBut if you definitly only want to remove nils then (remove nil? [1 2 nil 3 nil nil]) documents this probably a bit better.
04:48caljunior,(remove nil? [1 2 3 nil])
04:48clojurebot(1 2 3)
04:48caljuniorthanks
04:49caljuniormore intuitive than filter identity, I only need to remove nils.
04:55piccolinoIs there any way to import a Java class that is in the default package? I can't figure out how.
05:01tomojI think that's impossible
05:38konrWhat's the closest we have to a CL->Clojure translator?
05:39Rayneskonr: Rich.
05:43AWizzArdkonr: do you want to have a program taking a CL file as input and outputting a .clj file? Or do you want to just run the CL file?
05:46konrAWizzArd: the first option, but my question doesn't make much sense as clojure handles a lot of things differently
05:47AWizzArdDepends on how far you want to take it.
05:47AWizzArdHumans can do such a translation, so an algorithm exists :)
05:49ChousukeA very dynamic, complicated, and imprecise algorithm, yes :P
05:49AWizzArdNot the most trivial thing to write it down
05:50ChousukeI wonder how people write swank backends. I can't really find any documentation for the protocol :P
05:51Chousukethere's the source code for other backends as reference I suppose. meh.
05:52AWizzArdYou want to improve swank-clojure?
05:55Chousukewell, it breaks with newer slime versions
05:55Chousukeit needs fixing
05:58Chousukewait, what. it doesn't break anymore. :P
05:59Chousukeparedit doesn't quite work in it though :(
06:01Chousukeit's weird. I can type [ and get [], but then deleting the opening bracket doesn't delete ]
06:01Chousukeand this problem only exists in the slime buffer :/
06:01AWizzArdChousuke: yes, I am still using slime from October 2009
06:01ChousukeI just tried with git slime. it started the repl with no problems
06:09AWizzArdChousuke: last year it was so easy. Just getting a fresh version of slime, downloading jochu-swank and that's it
06:09AWizzArdBut suddenly newer versions of slime didn't work anymore
06:09AWizzArdand unfortunately Jochu stopped his efforts on swank-clojure
06:10AWizzArdAnd now there is only some strange Elpa thing, and one can not just download swank-clojure anymore
06:10AWizzArdall is deeply hidden in some paths and requires manual copying out of those files, or one needs elpa
06:11ChousukeI'm not sure what you mean :P
06:11Chousukemy swank-clojure and slime are both straight git clones
06:11Chousukeclojure-mode too
06:11AWizzArdwhat is your swank-clojure url from which you clone?
06:12AWizzArdgit://github.com/jochu/swank-clojure.git
06:13AWizzArdbut that one for example is already in a different format
06:14AWizzArdChousuke: it should have only swank-clojure.el and swank-clojure-autoload.el in the toplevel dir, and then a folder swank.
06:14AWizzArdbut instead there now is a src/ dir
06:19ChousukeAWizzArd: I clone from technomancy
06:19Chousukebut gah, why don't square brackets work in slime :(
06:21AWizzArdyes, but the technomancy swank also requires manual moving of files and dirs
06:21AWizzArdanyway, I could also try if it will work with the newest version of slime
06:22Chousukeit just needs a classpath update, not manual moving of things :P
06:23Chousukejust add the src dir to your swank-clojure-classpath
06:23AWizzArd(add-to-list 'load-path "/hg/lib/clj/swank-clojure/")
06:23AWizzArdin there I expect the swank-clojure.el and swank-clojure-autoload.el and a swank dir
06:23AWizzArdbut since some months it was not working with fresh slimes anymore. But it seems it does work again, as you said.
06:24Chousukeswank-clojure-autoloads.el no longer exist
06:24Chousukeyou're supposed to generate them yourself, I suppose
06:24ChousukeI don't bother, I just require 'swank-clojure
06:27djpowellsomeone was asking about acumulating a count whilst reducing over a big sequence earlier - has anyone considered something like juxt, but that works with reduce?
06:29djpowelleg: http://paste.lisp.org/display/95583
06:34hoeckChousuke: the swank-clojure-slime-repl-modify-syntax function will add necessary entries so that ] and } are deleted properly in the slime repl
06:34Chousukehoeck: yes, except ot doesn't work. :(
06:34Chousukehoeck: it works fine in clojure-mode buffers, but not slime
06:34hoeckChousuke: unfortunately, no one calls it
06:35hoeckyou have to add this function as a hook to slime-repl-mode-hooks
06:35hoeckof course, this should be the duty of swank-clojure
06:37hoecklike: (add-hook 'slime-repl-mode-hook 'swank-clojure-slime-repl-modify-syntax) in .emacs, somewhere after (require 'slime)
06:39Chousukeadding the hook in swank-clojure.el seems to work
06:39Chousukeexcept for curly brackets
06:40ChousukeI guess the define-key thingies aren't getting called :/
06:41hoeckdeleting curly braces does work for me, but not inserting, inserting { won't give me the closing }
06:41ChousukeI think maybe paredit isn't yet enabled for the repl buffer when it executes that hook
06:43hoeckfor curly braces they are only called for paredit above v21
06:44ChousukeI have the latest beta
06:44hoeckbelow v21, the command is called paredit-open-brace, for v21 and higher clojure-mode tries to call paredit-open-curly
06:45hoeckI have v20 and only the *-brace commands
06:45ChousukeI have 22, so it should work
06:45Chousukebut it doesn't.
06:45Chousukeand I don't see why
06:46Chousukeparedit is enabled prior to swank as far as I can tell
06:47Chousukeoh wait
06:47Chousukeno, the hooks are in the wrong order :|
06:47hoeckit checks for paredit-mode variable
06:47ChousukeI suppose I can't add the hook in the swank-clojure.el file :/
06:47hoeckso if paredit-mode is not active when running this hook ..
06:48hoeckor just enable paredit-mode in this hook?
06:50hoeckbtw, I don't see why paredit shouldn't take on [ and { by default
06:52Chousukegah
06:52Chousukeit seems the paredit hook gets run last because it's added first...
06:55AWizzArdChousuke: so, slime and swank-clojure seem to run fine, but only paredit still has some problems?
06:56Chousukeyes
06:56Chousukegah, this is silly
07:00Chousukeaha, I just needed to add the optional append parameter :P
07:41jcromartiehttp://clojars.org/org.clojure/clojure-http-client seems to not work for me
07:43jcromartie org.apache.maven:super-pom:jar:2.0 can't be found
07:51powr-tocDoes anyone know if derby db is a maven repository anywhere?? It doesn't seem to be in central
08:09eevar2org.apache.derby?
08:10eevar2http://www.ibiblio.org/maven/org.apache.derby/ that is
08:14powr-toceevar2: cheers bud... I have it working now
08:14powr-tocI was using derby-project not derby
08:16jcromartieOK what's up with "This is evil. Don't ever use it." in c.c.apply-macro
08:23jcromartie(defmacro barely-try [& forms] `(try ~@forms (catch Exception _)))
08:23jcromartieor maybe "meh" would be a good name for that macro :P
08:27AWizzArdjcromartie: what about (without-exception ...)
08:27jcromartieAWizzArd: It's more of a joke :)
08:32jcromartieare there any libs to report on test coverage for namespaces?
08:32jcromartielike if I wanted to know what functions in namespace x were covered by tests (optionally in namespace y)
08:35AWizzArdWould be a nice feature.
08:50esjWhen doing executing blocks using swank C-x C-e, is there a way to specify which namespace they get executed within ? Specifically things like defn ?
08:50esji thought (in-ns 'blahblahblah) in the execution buffer would do it, but that was too easy :)
08:54jcromartiehttp://gist.github.com/314551
08:55jcromartieoops, was missing ns-fns
09:00powr-tocDo anonymous clojure functions not support destructuring?
09:01ordnungswidrighi, how do I skip the first n elements of a seq?
09:03ohpauleezordnungswidrig: nthnext
09:03hoeckdrop
09:03ordnungswidrigdrop, thanks
09:04jcromartiepowr-toc: they do
09:05powr-tochmmm... then this must be wrong: (map (fn [[k v] pair] (str "k is " k " v is " v)) { 0 :a 1 :b 2 :c })
09:05jcromartieyeah, that is wrong :)
09:06jcromartieyou're missing :As
09:06jcromartie:as
09:06powr-tocahh
09:06jcromartieif you want pair
09:06jcromartieif not, just leave it off
09:06jcromartie(everything after the [k v] that is)
09:06ohpauleezordnungswidrig: drop will give you back a lazy seq, nthnext a collection (seq coll)
09:07powr-tocjcromartie: cheers, it works fine
09:08AWizzArdGuys, am I blind? I can’t find duck-streams in here: http://github.com/richhickey/clojure-contrib/tree/master/src/main/clojure/clojure/contrib/
09:13ordnungswidrigohpauleez: oh, thanks. lazy-seq is fine in my case.
09:13ohpauleezawesome
09:13jcromartiehow can I get a symbol from a var?
09:13ohpauleezAWizzArd: I don't see it, unless it got rolled in somewhere, or moved into core
09:15Drakesonhow would you dump a binary data to a file?
09:16AWizzArdDrakeson: use the JVM classes/methods.
09:17AWizzArdhttp://java.sun.com/javase/6/docs/api/java/io/package-summary.html
09:18DrakesonAWizzArd: thanks
09:20dsophow can I get the data in a post request in compojure?
09:24atrerusjcromartie: can you quote it? like 'foo or (quote foo)
09:32atrerusdsop: :form-params is what you're looking for: http://compojure.org/docs/requests
09:33jcromartieatrerus: I mean from an actual var object
09:33jcromartiethis testing-testing business is trickier than I thought
09:34cemerickhuh, I've always just used :params. Never had any need to distinguish between query params and entity params
09:34atreruswhat's in your var object?
09:34dsopatrerus: thank you
09:34atrerussure :)
09:35atrerusjcromartie: so you have a var with a symbol inside?
09:35jcromartiecemerick: I use form-params for RESTful routes
09:36jcromartieatrerus: no, I have a var and I wanted the symbol that would resolve to it
09:36jcromartiebut I worked around it
09:36atrerushmm... it's possible you could get what you're looking for from the meta data
09:37cemerickjcromartie: there's nothing more or less RESTful about query vs. entity parameters...?
09:37atrerusI think though that you could find out what the symbol for the var is, but not the original symbol for the data itself
09:38jcromartiecemerick: I merge the form-params with the resource to be updated, or as the data to be posted
09:38jcromartieafter some validation
09:38jcromartiecemerick: I use query params for something like metadata on the request
09:39jcromartielike for searches of a resource
09:39jcromartieof course they rarely ever exist side-by-side and my validation strips out invalid keys.... so I guess it doesn't really matter
09:39cemerickjcromartie: well, that's fine, but whether the parameters go in the url or entity isn't what determines "restfulness"
09:43jcromartienope
09:44jcromartieI am kind of tired of the word anyway... :P
09:44jcromartiejust like "API"
09:52_fogus_rhickey: Do you have planned what you're going to speak on at this event? http://www.eventbrite.com/event/586299638
09:53rhickey_fogus_: nope
09:53_fogus_rhickey: Well... looking forward to it anyway. :)
09:54rhickeyI'll need to coordinate with Stu so we do something different
09:55AWizzArdWill there be someone recording it?
09:55_fogus_I would love to see a talk on cells, but I'm not trying to dictate that
09:56_fogus_The mind/minds-blown ratio would likely be high
09:56AWizzArdThe question is if they are mature enough already to be concrete enough.
09:56AWizzArdI am using them tho
09:58mattrepltypes, protocols, and cells would be nice. to hear the thinking behind new/wip features from the source
09:58esj+1 somebody recording these
09:58esj_fogus_: sounds like you'll be there... :P
09:59_fogus_esj: It's in my neighborhood, so yes
10:00AWizzArdDo you happen to have a nice camera? *g*
10:00_fogus_rhickey could stand up there and discuss his choices in tea and it would likely fill the seats ;-)
10:01_fogus_I do have a DVD video camera... the problem is it only records 25 minutes at a time
10:01AWizzArdyeah, because he would explain it in ways we mortals never thought about :)
10:01rhickeyMangalam this morning
10:02Raynes_fogus_: Make him stop every 25 minutes.
10:02mattreplfor tea
10:04LauJensentea is nice.. for woman
10:04cemerickwha?
10:04clojurebotthe world <reply>what the world needs is more higher order functions
10:05rhickeyah LauJensen, always provoking
10:05LauJensenhehe - hit a soft spot did it ? :)
10:06RaynesI love tea. :(
10:06cemerickLauJensen: no, that veered into stupid territory :-(
10:06rhickeyClojure is for tea drinkers, all others tolerated
10:06_fogus_Raynes: Good call. I'll scream out, "stop the show!!" before I change discs
10:06Raynesrhickey: o/
10:06LauJensenhehe
10:07_fogus_cemerick: You literally beat them?
10:07RaynesSounds like fun.
10:07LauJensencemerick: Whats sexist about it? I thought it was very innocent to be honest
10:07danlei+1 for tea, darjeelings preferably
10:08cemerick_fogus_: No, that was figurative. There was one woman in a group of ~25 guys, four of which were making very unfortunate comments they thought were funny. No one told them to shut up, so I did.
10:08rhickeyDarjeelings in the afternoon
10:08rhickeyAssams/ china blacks for breakfast
10:09Raynescemerick: You should have actually beat them. Would have made for better entertainment.
10:09LauJensenplease...
10:09_fogus_rhickey: Green tea in-between
10:09AWizzArdWhite tea here.
10:09RaynesBlack tea here.
10:10rhickeyAWizzArd: oh yes, Silver Needle often in the evenings
10:10danleiyes, Assams are nice too, don't know much about chinese teas though (but tried a few Oolongs)
10:10rhickeyOolongs rock
10:11_fogus_I'm partial to hojicha
10:11cemerickLauJensen: your comment wasn't offensive or anything. But stuff like "X is only for women" etc can degenerate quickly. And, I'm on edge this morning. :-)
10:11AWizzArdyes
10:12LauJensencemerick: Been sippin 'Testorone tea' again ? :)
10:12rhickey_fogus_: interesting, never tried that
10:13konrHere I take yerba mate all day long
10:13_fogus_rhickey: My wife's family is from Japan, so we have packages of it stacked to the ceiling. I'll hook you up on the 17th.
10:13rhickey_fogus_: cool!
10:13danlei_fogus_: never tried, but I kinda liked genmaicha
10:14rhickeydanlei: yes, that I've had
10:14_fogus_danlei: My second favorite
10:14cemerickLauJensen: nope, just Snapple Diet Raspberry baby! :-D
10:15rhickeySnapple Diet Raspberry is OT in a discussion about tea
10:15LauJensenOk - I give up, I made a cup of Silvery Perl tea, whatever that is :)
10:16rhickey_fogus_: so you might also like the amber oolongs? http://www.specialteas.com/PPC-Oolong/617-Formosa-Oolong-Fanciest-Grade.html is a favorite of mine
10:16cemerickrhickey: it says right here that it's made with the "finest tea leaves". So there! ;-)
10:17_fogus_rhickey: Oh yeah, I love that stuff. I don't have it very often though, but my wife and I went through a phase a couple years ago
10:17rhickeycemerick: that settles it then :)
10:17danleioh ... I didn't know about "monkey picked" tea :)
10:18cemerickI love it when truth in labeling wins out. :-D
10:18_fogus_There is nothing better than monkey-stomped wines
10:19rhickeydanlei: that competition grade Ti Kuan Yin is awesome, but really expensive. Every infusion has a different character
10:19rhickeysee LauJensen, you are seriously outnumbered by tea drinkers here :)
10:19rhickeyand some serious tea drinkers
10:20LauJensenrhickey: Yes, its amazing to see the example you set - but as you saw me state above, I'm also sitting with a cup of tea atm
10:20cemerickwow, $100/pound
10:21_fogus_Also a favorite of mine, Pu Erh. I can't drink enough
10:21danleigotta do something about ERC ... always crashes my emacs on cygwin :|
10:21rhickeycemerick: tea is very light. One of the awesome things about fine tea is that, unlike wine, you can drink some of the very finest for $0.25 cup
10:21powr-tocDefinitely green\white tea... with occaisional Earl grey
10:21LauJensendanlei: couldn't help but notice that you said "cygwin" and "crash" on the same line :)
10:21danlei:)
10:22rhickey_fogus_: I couldn't find the charm in Pu Erh
10:22danleithe hard thing about tea is that you have to /make/ it right
10:22_fogus_rhickey: I like its earthiness
10:22rhickeydanlei: definitely
10:23rhickey_fogus_: makes sense from your other preferences
10:23cemerickrhickey: I don't have any kind of palette for wine, either.
10:23cemerickrhickey: does this second/third infusion mean you use the same leaves for multiple brews?
10:23konrhaha, I gave up pu-erh when it came with vermin, but the vendor insisted that they were _good_ vermin
10:23chouserah man, roll out of bed a couple hours late one day and miss all the fun...
10:23rhickeycemerick: yes, greens, whites, oolongs all support multiple infusions of the same leaves
10:24cemerickI had no idea.
10:24danleithe chinese generally (as far as I know) do multiple infusions (even having different names, like "... of friendship" ...)
10:24cemerickI've tried hot tea a bunch of times, but the flavor has always been so weak that I just didn't see the point.
10:24rhickeyas long as you didn't scorch them the first time - very sensitive to water temp and brewing times
10:24powr-tocOh, and I can highly recommend Morrocan mint tea served in the souqs of Fez with fresh orange blossom infused
10:25danleimarrocan mint really is hard stuff :)
10:26danleiI remember when I tried it the first time, coming from europe and being accustomed to our local mint ...
10:26powr-tocserved with the characteristic 12 spoons of sugar!
10:26LauJensenI think you guys would love "8 spoons, 8 parts water, click" and then a nice cup of coffee results :)
10:26rhickeyhave to practice my aerating pour
10:27powr-tocrhickey: hahahaha... yes I got shouted at in a cafe for not aerating mine enough!!
10:28avarusbye
10:28cemerickI've been trying to like coffee for years, unsuccessfully.
10:28cemerickfinally came around to beer a few years ago
10:28cemerickI guess beverages are a problem for me. :-)
10:28eevar2cemerick: decaf then?
10:29eevar2just gotta build up some addiction, through regular exposure, and both coffee & beer go down very smoothly ;)
10:29cemerickeevar2: no, any kind of coffee just tastes like burnt bread smells.
10:29eevar2- the first comma
10:29_fogus_cemerick: I've been trying for years to like beer, but the problem is that they all taste like beer
10:29cemerickI don't know how people drink most of the beer that gets swilled.
10:30powr-tocWe have some awesome Ale in Scotland :-)
10:30danleiI'd prefer the scotch :)
10:31cemerick_fogus_: I've been really enjoying doublebocks lately.
10:31cemerick_fogus_: don't drink anything you can see through :-)
10:31powr-tocdanlei: Ale with Whisky on the side :-)
10:31chouserI drink tea, but after this conversation I've realized how very far I am from being a "tea drinker"
10:31danleipowr-toc: :)
10:32danleichouser: ah, as long as you don't think the stuff in the bags is tea, all is fine :)
10:32rysOr both, if it's Innes and Gunn. They finish it in whisky barrels, iirc, and it's very very tasty
10:32chouserdanlei: ok. but what should I call it? "muck"? A muck drinker ...I could go with that.
10:33rysYou get some very good teas in bags (and some bags are better than others, too)
10:33danleichouser: hm ... "muck" yes, sounds reasonable :)
10:33clojurebotWhy are you asking *him*
10:33rysAs an Englishman, I feel qualified to comment :P
10:35danleirys: it's possible, but I really never had good tea in bags ... (one should not assume all swanes are white, just one hasn't seen a black one)
10:35powr-tocI was lucky enough to try get some Loch Dhu once... At £200 a bottle it's a treat! Though Talisker, Lagavulin and Laphroaig are more affordable! :-)
10:35chouserrhickey: if it's not too OT, I'd like to mention that my objects implementing IKeywordLookup and ILookupThunk seem to be working very well.
10:35rysdanlei: agreed, it's harder to find
10:35chouserand I'm curious why you thought they might not ...am I failing to test something that would make them all blow up?
10:39chouserI've got an object here that implements ILookup usine a case statement on a list of keyword fields. It can do 10 million lookups in 335 msecs
10:39LauJensenrhickey: do you happen to have some interesting reading on immutable datastructures and their place in life ?
10:39ryspowr-toc: v.nice! I'm running a distiller's edition Caol Ila atm
10:40chouserBut if called using a keyword as a fn, can do the same number in 126 msecs -- over 2.5 times faster.
10:40tjgHi! Does anyone know how to make clojure.contrib.pprint use my print-method? I've tried setting *print-readably* to false, yet pprint doesn't work. (Though cl-format works fine.)
10:41powr-tocrys: nice... I don't remember trying it... but I do like the Islay malts
10:42rysIt's Lagavulin-y in that there's a load of sub flavours, but it's less hardcore smokey
10:42powr-tochmmm... I seem to get an exception thrown from swank whenever I run some code of mine... The stack traces don't seem to cross my code
10:42powr-tocodd
10:46rhickeychouser: yeah, I think I scared you off of that unnecessarily the other day
10:46chouserok. well, I didn't stay scared long. :-)
10:47rhickeygood
10:47chouseractually, saying things like "that'll never work" has been used by people who know me as intentional motivation, so ... good job.
10:48rhickeyI looked again and most of the other stuff is related to the sites, not the targets
10:48chouserok
10:48chouserI'm inordinately excited about this. It's all for work and will be used, but there's a good chance I'll be able to get it open-sourced later.
10:48rhickeycool
10:49rhickeyhas anyone here tried Jetlang?
10:49chouserif IKeywordLookup were a protocol, it'd be even better.
10:50rhickeysometime when I get a few straight days to think I need to work on the bootstrapping issues of more things being protocols
10:50chouseras it is, in order to "extend" IKeywordLookup to these final classes I have to wrap them.
10:51chouserin case you're curious, here's the bare bones of what I'm doing: http://gist.github.com/313728
10:52rhickeyeval, eh?
10:52chouserthat fn now has an :inline part so I can take the best advantage of four different calling scenarios: message-map in literal fn position or not * keyword in literal fn position or not
10:52chouserrhickey: heh. yeah. to get at the reify code-gen machinery.
10:52chouseronly happens the first time though. :-)
10:53chouser(per call site)
10:54chouserif you have a better idea than (eval `(reify ...)) I'd be happy to hear it.
10:55rhickeychouser: so this begs the question - originally I had protocols that could be :on an existing interface. Now they define their own, but could also support a supplied :on interface. In fact, I think all the plumbing is still there for that, just not promised as I wanted people to get the 'pure' experience
10:56chouserone possibility is to build up a map of msg-type+keyword to thunk, and populate it either at compile time or at runtime but allow multiple callsites of the same keyword to share a thunk. ...dunno if that buys me much though. fewer classes I guess.
10:57rhickeyof course the only existing derivees of IKeywordLookup are deftypes (and your new code), so it could easily be a protocol
10:58chouserrhickey: So I (or you) could have a PKeywordLookup proto :on IKeywordLookup, and each derivee could choose what makes sense for them. ...legacy code and Java using the interface?
10:58rhickeybut then the client side needs to be aware ofthe protocol-defined interface, which means some AOT of some part of the runtime. I think that is going to be inevitable, but we need to deal with the build issues
10:58rhickeychouser: yes
10:58chouserhm, interesting.
10:59chouserI gotta run soon. Would you be open to a patch to make IKeywordLookup a protocol? I haven't looked at that at all, but I'd be curious about the performance of my code if it didn't require wrapping.
10:59chouserbut I've got plenty of other angles to work on here, so ... either way.
11:00rhickeychouser: I think you should try :on first, given the bootstrap issues above
11:00chouserok
11:00chouserwait, I should try?
11:00chouseris it there but undocumented?
11:00rhickey:on is likely working or barely broken
11:00chouserok
11:02chouserthanks for the pointers. gotta go.
11:10jcromartiehey what's up with Compojure and println?
11:10jcromartiewhen using println I get that output in the response, but only sometimes
11:11jcromartielike, depending on what kind of handler and middleware I'm using
11:12cemerickjcromartie: something's rebinding *out* to the response's outputstream.
11:12jcromartiedefinitely, and I have a feeling it's something in compojure
11:13jcromartienothing I wrote
11:13cemerickjcromartie: there's no reference to *out* in the compojure sources I have *shrug*
11:14jcromartieweird
12:33Drakesonhow do you change the default content-type in compojure?
12:34Drakesonis there a better way than putting (content-type "application/xhtml+xml") in every entry in defroutes?
12:36jcromartiemaybe middleware?
12:36jcromartieif it's just a header
12:37jcromartiewrite middleware to set the content type
12:39cemerickDrakeson: yup, middleware is the way to go
12:44arohnerthere's a with-mimetype middleware included now
12:49Drakesonjcromartie, cemerick, arohner: thanks :)
12:50jcromartieSo I've got this going on now.
12:50jcromartiehttp://gist.github.com/314809
12:50jcromartieIt's working nicely.
12:50jcromartieIt should hopefully be fairly apparent how it works.
12:50jcromartieIf not, I'm open to suggestions :)
12:51arohnerwhat is a model? a map? a struct? a deftype? a DB row?
12:51jcromartiestruct
12:51clojurebotdestructuring is http://clojure.org/special_forms#let
12:51jcromartiewith metadata on the var
12:51arohnerinteresting
12:51jcromartiecollection and validator metadata
12:52jcromartieoptionally on-delete
12:52jcromartieyou can run (model-validate #'user {some user map ...})
12:53jcromartieor maybe this should be its own namespace so that the functions are just like "validate"
12:54Raynestechnomancy: ping
12:56cemerickjcromartie: if I were you, I'd make either required or optional the default, and provide a way to change that.
12:56jcromartieyeah, not a bad idea
12:57cemerickthe field name is the primary slot, not its optionality IMO
12:57jcromartiethe validator fn that gets built threads the new value through those forms though
12:57cemerickI'd also make the fields defined in vectors (at least by convention). I generally assume functions are being applied if I see parens.
12:58cemerickoh, well, I was assuming this was a macro.
12:58jcromartieit is
12:58cemerickwell, then you can build those (required/optional .......) forms up and thread away. :-)
12:59jcromartienotice the last form: (hash-password)
12:59jcromartiethat's just a step in the validation that's not related to a field
12:59jcromartieI would lose the ability to do that
13:01cemerickwell, having everything lobbed together implies that each form is a peer of the rest. You could do (defmodel user :fields [....] :validators [....])
13:02jcromartiemaybe
13:02hiredman{:field-name [validators]}
13:03cemerick+1 hiredman
13:03jcromartiehmm
13:03jcromartieyeah, now you're talking
13:06jcromartiehmm, now how about defaults
13:07jcromartieI think I have to stick with this right now. I'm trying to get this system doe.
13:07jcromartiedone.
13:07jcromartieI can rework validators later :(
13:08jcromartieI don't have a good solution for things like (hash-password) there
13:08RaynesIf something is included, such as autodoc, in your :dev-dependencies, lein uberjar shouldn't include those jars and their dependencies in the jar created, should it?
13:10jcromartiemaybe just pass the extra validators as additional args to defmodel
13:10cemerickjcromartie: what does hash-password do?
13:10jcromartieit sets :hash if :password is set
13:11jcromartieso you'd set :password, then validate and save and :hash is now the hash of the :password
13:11cemerickhuh
13:11cemerickour hashing and salting are just baked in and automatic -- shouldn't be possible to set a password without those happening.
13:12jcromartiedo you manage that in the database or what?
13:13jcromartiei.e. what does "baked in" mean?
13:13cemerickI mean, when a account record is updated, the password gets salted and hashed, period.
13:16technomancyRaynes: hi
13:16jcromartiecemerick: right, but where does that happen? at some point you are calling a function, right?
13:16jcromartievalidation would always happen when creating or updating a record
13:17cemerickwhat I'm getting at is that salting and hashing passwords is orthogonal to form validation.
13:18technomancyanyone want to translate this for me? leiningen → 雷人間 → 稲妻回路 → キカイダー01
13:18jcromartiecemerick: this isn't form validation
13:18jcromartiethis is validating the actual data
13:19jcromartieI'm splitting out form validation
13:19cemerickah
13:25jcromartiegreat suggestion on the maps hiredman
13:25jcromartiemaps and vectors
13:25jcromartie:)
13:25jcromartieless pain than a macro that parses the forms
13:28jcromartiehow would I split a vector on a value?
13:29Raynestechnomancy: <Raynes> If something is included, such as autodoc, in your :dev-dependencies, lein uberjar shouldn't include those jars and their dependencies in the jar created, should it?
13:29jcromartienevermind
13:30jcromartiehmm, no, split-with is not what I wanted
13:31jcromartieI want to have vectors like [foo bar :default x]
13:31technomancyRaynes: yeah, that's currently an annoying quirk; if you clean before you uberjar it will avoid the problem, but it's unfortunate that you have to think about it.
13:33Raynestechnomancy: Oh, I see. Thank you. :)
13:41fanaticotechnomancy: any reason `lein repl` ignores the previous value of $CLASSPATH?
13:42technomancyfanatico: lein repl is a mess; it's on a quick path towards a rewrite
13:42technomancyright now it's implemented entirely in the shell script
13:46drewram I misunderstanding :exclude here? http://gist.github.com/314886
13:48fanaticoright. I'm in the middle of a compiler for a class project, and the nonstandard source path completely breaks `lein repl`. Bit of hassle to start slime every time. If the rewrite isn't planned for the next release, recognizing the previous value of $CLASSPATH lets us pass the src path to lein.
13:50technomancyfanatico: I'd take a patch for a short-term fix. you could also use the nailgun server if you don't want to restart swank.
13:57drewrah, I need (ns ... (:refer-clojure :exclude...))
13:58fanaticotechnomancy: http://dl.dropbox.com/u/2680118/classpath_env.patch
13:58technomancyfanatico: could you send that to the mailing list?
13:59technomancyotherwise I'll forget it
13:59fanaticosure
14:07avarushi
14:15Licenseraloaeh!
14:16jcromartieis that like aloha?
14:17LicenserI think so
14:24jcromartieis there anything like (reduce %(%1 %2) x list-of-fns)
14:28eyerisjcromartie: What are you trying to do?
14:28eyerisThat reduce invocation is invalid, so it's hard to see what your goal is.
14:28jcromartieinvalid?
14:28jcromartieer, I mean #()
14:29jcromartieI want to apply each function in a vector to a value
14:29jcromartie(reduce #(%2 %1) x list-of-fns)
14:29jcromartiethere we go
14:29eyerisOkay
14:30jcromartie,(reduce #(%2 %1) 10 [str seq])
14:30clojurebot(\1 \0)
14:30jcromartieoh, comp would work
14:30eyerisI think you want ((apply comp list-of-fns) value)
14:30jcromartieyeah
14:30eyerisOr, if that list of fns is a literal, just take them out of the list and drop apply
14:31eyeris:)
14:31jcromartienot a literal
14:32jcromartie,((apply comp [str seq]) 10)
14:32clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
14:32jcromartieoh, that's backwards now
14:32jcromartie,((apply comp (reverse [str seq])) 10)
14:32clojurebot(\1 \0)
14:33cemerickdon't worry, hardly anyone can remember that comp applies right to left :-)
14:35eyeriscemerick: why not? It makes total sense to me in clojure, because I just imaging the parens
14:36eyerisIn Haskell I always get it backward because the arrows screw with my mind :)
14:36eyerisimagine*
15:16fanaticoIs there a dynamic way to add methods to a proxy object that haven't been specified in the interface?
15:16kotarakfanatico: no
15:17fanaticodidn't look like it. thanks.
15:17kotarakfanatico: you need gen-class for that
15:17kotarakor gen-interface
15:18hiredmangen-interface is best
15:24arohneris there a certain amount of overhead on transient / persistent!, or is it always faster to use transients, even when making a single modification?
15:25AWizzArdnot always faster, but it takes only some microseconds to do transient/persistent!
15:26AWizzArdfor "single modifications" they are not faster I would say
15:29dnolenarohner: also they aren't really intended for single modifications. that is they don't really fit well into the concurrency story (hopefully way not off base here). The cells work is way to bring them into the concurrency story.
15:30dnolenhopefully not way off base I mean
15:30arohnerdnolen: all of the work I'm doing is in a single fn
15:33AWizzArd,(/ 17500 75.0)
15:33clojurebot233.33333333333334
15:33AWizzArd,(/ 7500 175.0)
15:33clojurebot42.857142857142854
15:46jcromartieOK so here's my model definition now http://gist.github.com/314809
15:46dabdwas str-utils2 removed from clojure-contrib?
15:47hiredmanrenamed to string
15:52jcromartiehiredman: i followed your advice
15:52jcromartieit seems to be good advice :)
15:52jcromartieI was thinking of collection any exceptions encountered during validation, but I'm not sure what to do with them after that
15:52jcromartieI can stuff them into ::errors
15:52jcromartiein the validated object
15:53jcromartiemaybe use a callback?
15:53jcromartieon-error?
15:53clojurebothttp://haacked.com/images/haacked_com/WindowsLiveWriter/IConfigMapPathIsInaccessibleDueToItsProt_1446B/works-on-my-machine-starburst.png
15:53jcromartieI love that image... so maddening.
15:54hiredmanjcromartie: are you sure you want to handle exceptions in the data?
15:54hiredmanI mean wouldn't your verifier function do that?
15:54jcromartiepotentially
15:55jcromartiethis is for an API that should probably return a list of errors
15:55jcromartienot just one exception or something like that
15:56hiredmanyou might consider stuffing it into an ::errors slot in the metadata
15:56jcromartieah, metadata makes more sense
15:56jcromartieI forgot about that :P
15:57jcromartie(excellent idea)
16:00jcromartieso is the general Clojure philosophy to avoid throwing Exceptions or what?
16:00jcromartieI guess invalid data is not really that exceptional
16:01hiredmanlooser about exceptions because they are not checked
16:05jcromartieright
16:06jcromartieI could generate documentation from all of these vectors of validator functions
16:06jcromartiethat would be awesome
16:28dakroneif I have: (defn bar [a b] (+ a b)) and (defn foo [& c] (bar c)), how can I get foo to expand the arguments for the bar function?
16:28dakroneright now I get Wrong number of args passed to: user$bar
16:28dakronewhen I do (foo 1 2)
16:29dakronehah, nevermind, I should have used apply
16:38maxhodaki'm working on translating the facebook api client lib to idiomatic clojure
16:38maxhodakand wanted to double check my interpretation of "idiomatic clojure": http://gist.github.com/315064 <-- does this look right?
16:38crowbar7Anyone played with Compojure at all?
16:39arohnercrowbar7: sure
16:39crowbar7I was thinking nof deploying some websites with it actually anyone know good way to get it hosted?
16:39maxhodakcrowbar7: VPS?
16:40maxhodakcrowbar7: www.linode.com
16:40crowbar7I'm not really experienced with the java servlets, so I did not know the scope of when java is offered in a webhosting play what that means.
16:41crowbar7I've used / use linode for a business.
16:41maxhodakcrowbar7: a VPS will give you direct shell access with the ability to install anything you want
16:41crowbar7yeah
16:41maxhodakso don't worry about "java" support or anything
16:41maxhodakjust apt-get install sun-java6-jre jetty
16:41maxhodaketc
16:42crowbar7I was thinking of using the 1and1 dedicated servers if I gets some monthy cash rolling in from the pretty basic websites.
16:42crowbar7a vps is nice as well.
16:42crowbar7except 1and1 is a mixed experience.
16:43hiredmanyou could use appengine
16:43maxhodakhiredman: http://gist.github.com/315064 does this look right to you?
16:43crowbar7Tip about linode btw they don't let ou run your own DNS. :( made DNS tunneling impossible for me.
16:44crowbar7app engine won't let you point a domain anymore. just forward.
16:44hiredmanmaxhodak: in what sense?
16:44maxhodakhiredman: is that idiomatic clojure?
16:44crowbar7I will look into it though
16:44tomojsomnium: does congomongo not support sorting?
16:44maxhodaklike, in an imperative language you'd create an object with your account params
16:44crowbar7for running some de it would be great come to think of it. Thanks guys
16:44maxhodakand then make calls on it
16:44hiredmanmaxhodak: sure, I think I'd use format instead of str there
16:45crowbar7s/de/dev
16:45maxhodakbut in clojure i feel like you should do something similar to with-open to manage the context?
16:45maxhodakand then use some kind of global binding to pass in the connection to the actual call (fql-query)
16:45hiredmanmaxhodak: using something like with-open is a common pattern, but I would recomend against it
16:45maxhodakrather than having each call's first param be conn
16:46hiredmanit maybe less of an issue because you will most likely only ever use one connection to facebook
16:46maxhodakand it's not a stream in the same sense; you aren't holding a resource open
16:47maxhodakit's just for convenience, but each call is stateless
16:47stuartsierraone of my motivations for rewriting the test lib from scratch was to eliminate all dynamic binding.
16:47maxhodak(re: http)
16:47hiredmanbut juggling implicit args via binding with multiple resources and laziness is just bleh
16:49maxhodakhmm
16:49hiredmanmaxhodak: I would make a datastructure that describes the query or api call, and then a function called "call" or "exec" that executes the call or query
16:50maxhodakso you set half of that structure when you set up your connection (api key, secret, version number, etc)
16:50maxhodakand half of it in the method (method, args, call_id)
16:50hiredmanyou could, but why bother?
16:50hiredmanhold on
16:50maxhodakto avoid needing an additional argument on each method?
16:50hiredmangah
16:50maxhodakok
16:51hiredmanwhy does gist not let me link to lines numbers?
16:51hiredmanhttp://gist.github.com/297803#L288
16:52hiredmanline 288 is an example call
16:52hiredmanwhen I said "I would ..." I meant "I did ..."
16:52somniumtomoj: hmm, I guess not, but it will be quick to add. just need to make a sort object and call .sort on the cursor. I can add it this evening, but patches welcome of course.
16:54maxhodakhiredman: ok, so you're basically using bb in the way i was thinking of doing with dynamic bindings
16:54maxhodakso it comes out about the same
16:55maxhodak(right? you're just manually setting bb)
16:55somniumtomoj: I guess I always used sort-by, never noticed it wasnt there before
16:56hiredmanmaxhodak: right, all the parameters for the call are int he map, except the secrect for some reason that I don't exactly rememeber
16:56tomojsomnium: is all the mongo sorting done outside of mongo by the driver?
16:56tomojI thought there was some sorting that mongo could do
16:57tomoje.g. I have 30000 results and want them in reverse order :D
16:58somniumtomoj: I think its internal, theres an example with the js shell on their website
16:59tomojok
16:59tomojtrying to poke my way around to a patch
16:59somniumcool
17:00hiredmanmaxhodak: since maps are immutable you do stuff like (def proto {:api-key 3423 :other-stuff 23434}) and then (call (assoc proto :method "Stream.somthing"))
17:17dsopwhat's the best way to do read from a Buffer object, so something like while ((f = in.read(buf, offset, 1024)) > -1) { } in clojure?
17:18Chousukedsop: you can use line-seq to get a seq of lines from a BufferedReader
17:18dsopthanks so much, is there a good ressource to learn things like that?
17:18dsopcoming from let's say..java without prior lisp knowledge
17:19ChousukeWell... browse the API docs, or read other people's code.
17:20dsopyes that's the obvious thing, but I thought more like a java -> lisp blog or so :)
17:20arohnerwhy can't you seq a transient?
17:21Chousukedsop: note that you need to consume (or realise, using doall) the whole seq for the Reader to be closed though. Or you need to close it manually, and take care not to use the seq afterwards
17:21dsopChousuke: okay thanks.
17:23Chousukeseqs based on IO are still a bit tricky. rhickey is still thinking of a solution :P
17:32slyphonhey, does the vimclojure guy ever hang out in here
17:32slyphon?
17:33AWizzArdyes
17:33AWizzArdkotarak
17:33AWizzArdHe is here.
17:33slyphonoh, nice
17:33slyphonkotarak: hai!
17:33AWizzArdhe will see you in 1-5 minutes :)
17:33slyphon:D
17:34kotarakand suddenly ... *CLABANGO*
17:34kotarakhehe
17:34slyphonkotarak: first off
17:35slyphonkotarak: THANK YOU!
17:35kotarakslyphon: you are welcome :)
17:35slyphonit is such a pleasure to be hacking a lisp w/ vim
17:35slyphoni really *really* didn't want to have to dust off my emacs
17:36kotarakI tried, but coudn't warm up with emacs. So I had to go with vim...
17:36slyphonso, i've been having a problem where sometimes the iabbrs get set up and sometimes they don't
17:36kotarakhmmm... can you define "sometimes"?
17:36RaynesI had either had unresolved issues with VimClojure, or just never figured out what was expected behavior. :p
17:37slyphonwell, when i was first getting everything working, that was the main problem, and i *think* it was the version of clojure-contrib i was using
17:38kotarakat the moment it doesn't really work with clojure 1.0 and the compatible contrib. But with never versions there shouldn't be a problem.
17:38slyphoni was wondering if there was any kind of debug logging i could turn on
17:38kotarak(if you did your classpath homework that is)
17:38kotarakslyphon: there should be huge stacktraces in ":messages" if something goes wrong.
17:39kotarakslyphon: which version are you using.
17:39kotarak?
17:39slyphonyeah, that's what's odd i know it's working if i see those, but there are situations where i *don't* see the stacktrace, but the <LocalLeader>sr abbr doesn't get set up
17:40slyphonlemme look for the version
17:41RaynesIt's been a long time.
17:41RaynesAnd I'm bored.
17:42kotarakRaynes: I have to get 2.2 out. It has some improvements with respect of robustness. But the time, the time....
17:42RaynesI'm cloning the repo anyways.
17:43kotarakRaynes: k, you can use kickoff.sh to get it up and running, but note that it should be called with bash. The #! /bin/sh is wrong. Will be fixed soon.
17:43nDuffWhat happened to clj-gradle?
17:43RaynesAlright. Cool.
17:45kotaraknDuff: now named clojuresque
17:45slyphonthanks X11!
17:46kotaraknDuff: http://bitbucket.org/kotarak/clojuresque
17:47slyphonkotarak: 2.1.2
17:48slyphonkotarak: it's like vimclojure#InitBuffer() never gets called
17:48kotarakOk. Usual questions. Is the server running? Is the classpath correct? Is the source file on the classpath? Is the source file w/o syntax errors?
17:49kotarakWhat does :messages say?
17:49slyphonthe server is running, the classpath I *believe* is correct, the sourcefile is on the classpath
17:49slyphonthe source is com.motionbox.hornetq.jms at path com/motionbox/hornetq/jms.clj
17:50slyphonin src/ and src/ is in the classpath
17:50kotarakshould be ok
17:50slyphonkotarak: when i run the jline REPL with same classpath and everything, i'm able to "get to" the stuff in that file
17:51nDuffkotarak, thanks
17:51kotarakslyphon: and there is no error message whatsoever?
17:52slyphonyep, no error message
17:52kotarakgrml
17:54slyphonkotarak: i was hoping there might be a key spot where it's going to call into nailgun that i could put a debugging 'echo' or something
17:55kotarakslyphon: what happens of you call the nails manually? "ng vimclojure.Nail < source.clj" from the console?
17:55kotarakI mean shell
17:56slyphonoh, hadn't tried that, lemme check
17:56kotarakoerk
17:57kotarakslyphon: I meant: ng vimclojure.Nail NamespaceOfFile < source.clj
17:57slyphonah, ClassNotFoundException
17:57slyphonuh
17:57kotarakhmm... this should show up in ":messages"
17:57slyphonso for user.clj
17:58kotarakuser.clj?
17:58clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
17:58slyphoner
17:58nDuff...re clojuresque, is there any automated way (a la Maven) to pull down dependencies, or do I need to hunt them down on my own?
17:58slyphonwhat is NamespaceOfFile?
17:58slyphonlike com.foo.bar ?
17:59kotaraknDuff: you specify them in your build.gradle. gradle will fetch them automatically: "dependencies { compile 'org.clojure:clojure:1.1.0' }"
17:59slyphonlemme try this test out on the one that's working
18:00chouserjava.lang.IllegalArgumentException: No single method: getLookupThunk of interface: user.PKeywordLookup found for function: glf of protocol: PKeywordLookup
18:00kotaraknDuff: that is if you specify a suitable repository: "repositories { mavenCentral() }". clojuresque has convenience methods for eg. the Hudson CI server of clojure and clojars.
18:00kotarakslyphon: no, the name of the command. It's verbatim.
18:00slyphonohhh
18:00kotarakslyphon: ng vimclojure.Nail NamespaceOfFile < src/clojureql/query.clj
18:00slyphonduh
18:00kotarakclojureql.query
18:00slyphonok 2 sec
18:01rhickey_chouser: what are you trying to do?
18:02rhickey_ :on IKeywordLookup ?
18:02chouseryes
18:02chouser(defprotocol PKeywordLookup :on-interface clojure.lang.IKeywordLookup (glf [o k] :on getLookupThunk))
18:02nDuffkotarak, this is actually clojuresque's build.gradle; it does appear to include mavenCentral(), but nonetheless dependencies aren't getting fetched. http://gist.github.com/315149
18:03chouser:on-interface appeared to be supported already. Had to hack in :on for the method, so quite likely I did that wrong or missed some other detail.
18:03rhickey_so, it's not seeing that :on everywhere it needs to if it's looking for the protocol-generated interface. There shouldn't be a protocol-generated interface with :on
18:03maxhodakhiredman: do you mind if i use your sig calculating method and name|str?
18:03rhickey_i.e. user.PKeywordLookup
18:04nDuffkotarak, fixing up GRADLE_HOME resolved things; apologies for the noise.
18:04maxhodakhiredman: i don't now what kind of license gists are released under :p
18:04hiredmanmaxhodak: please enjoy
18:04maxhodakknow*
18:04slyphonkotarak: ok, i'm confused, i do ng vimclojure.Nail NamespaceOfFile < blah.clj and it throws ClassNotFoundException: vimclojure.Nail
18:04maxhodakhiredman: thanks
18:04slyphonbut (in the project where i got this to work) i can fire up vim and start the repl
18:04kotaraknDuff: np
18:05kotarakslyphon: vimclojure jar is missing from the classpath
18:05slyphonon which side?
18:05chouserI only barely comprehend what I'm trying to do. Surely the compiler code calls (.getLookupThunk o k) -- seems like that will fail for my instance of a final class o, regardless of protocols on interfaces.
18:06chouserrhickey_: the protocol itself includes: :on-interface clojure.lang.IKeywordLookup, :on user.PKeywordLookup
18:06slyphonkotarak: i'm pretty sure the ng daemon has it on its classpath, vim is able to talk to ng and start the repl
18:06chouseryou're saying that second one shouldn't be there?
18:07kotarakslyphon: argh. try ng vimclojure.NamespaceOfFile < source.clj
18:08chouserhm -- specifying IKeywordLookup as both :on and :on-interface does seem to get me further.
18:08chouserNo implementation of method: :glf of protocol: #'user/PKeywordLookup found for class: <the class of "o">
18:08chousersuggesting my "extend" is wrong
18:09kotarakslyphon: argh2.0. try ng de.kotka.vimclojure.nails.NamespaceOfFile < source.clj
18:09slyphonok :)
18:09slyphonok, that worked for the working project
18:09chouserthat error is when I do (glf o :my-key)
18:11chouseroh!
18:11chousergot it.
18:11chouserso now (glf o :my-key) works.
18:11rhickey_ooh
18:12slyphonand now it works
18:12slyphonwtf
18:12chouserrhickey_: so to make this work, I need to do that defprotocol in clojure itself, and change calls from (.getLookupThunk ...) to (get-lookup-thunk ...)?
18:13slyphonkotarak: well, thanks! the NamespaceOfFile thing is a good way to test to see if the classpath is correct
18:13rhickey_chouser: ?
18:13rhickey_which defprotocol?
18:13slyphonkotarak: does vimclojure actually shell-out to the ng file?
18:13chouser(defprotocol PKeywordLookup :on-interface clojure.lang.IKeywordLookup (glf [o k] :on getLookupThunk))
18:14rhickey_where were you doing it?
18:14chouserrhickey_: just at the repl
18:14rhickey_oh, still in Clojure the language
18:14chouserheh
18:14chouseryes
18:14slyphonClojure the Flamethrower! (the kids love it)
18:15slyphonand, of course, Clojure 2: The Search for More Money
18:15rhickey_yeah, could be a patch to core-deftype
18:15kotarakslyphon: yes
18:15slyphonkotarak: would it put an error in :messages if it couldn't find the ng binary?
18:16kotarakslyphon: shell out is the only thing vim does in a half way portable and stable way
18:16chouserpresumably clojure currently generates code like (.getLookupThunk ...) for callsite stuff, but that won't help me, right? I need it to be calling the protocol method instead, like (get-lookup-thunk ...)
18:16slyphonkotarak: yeah, sometimes i wish vim was implemented in elisp
18:16slyphonvimscript is a horror
18:16kotarakslyphon: not sure. You either need ng on your path or defined in your .vimrc: "let vimclojure#NailgunClient = 'path/to/your/ng'"
18:16slyphonah, right
18:17slyphonok, well, it's working now, thanks for taking the time to help
18:17slyphonand for writing the thing in the first place :D
18:17kotarakslyphon: but more powerful than you would think http://tr.im/PORA
18:18kotarakslyphon: you are welcome. Glad it worked in the end.
18:34maxhodakhiredman: thanks for the input earlier; this is the result: https://github.com/myfit/clj-facebook
18:35the-kennyIsn't the use of single-element namespaces discouraged?
18:36Raynesthe-kenny: Strongly.
18:37the-kennymaxhodak: You shoud change the namespace "facebook" to something like "facebook.client", as namespaces without a . in it shouldn't be used as they easily cause problems
18:38maxhodakthe-kenny: and the filetree would become src/facebook/client.clj?
18:38the-kennymaxhodak: Yes
18:38RaynesYes.
18:39maxhodakok
18:40maxhodaki'm also looking at writing a macro to define methods resourcefully-style (http://github.com/technomancy/clojure-http-client/blob/master/src/clojure/http/resourcefully.clj)
18:40maxhodakrather than having all of those methods hanging like that
18:55maxhodakhow do you pull the latest clojure.contrib?
18:55maxhodakim trying to use stuff in the github master that isn't in 1.1.0
18:55maxhodak(like clojure.contrib.string)
18:56maxhodaker, nevermind, it's in 1.1.0 just reorganized
19:31kwertiiIs there a way to un-memoize a function that's been (memoize)d?
19:32kwertii(or rather, to dump the memo state so that it'll be rerun and re-memoized)
19:33kwertiimore specifically.. is it just a matter of re-binding the symbol to a new (memoize)d version, or is there some built-in way to do this?
19:33_atothere's no builtin way
19:33technomancykwertii: no, it's hidden in a closure
19:33_atobest option is probably to write your own momoize function
19:33technomancyyou could reimplement a reversible memoize
19:33technomancy_ato: jinx?
19:34jcromartieIs there any progress towards better errors in slime?
19:35kwertiiis there something bad about just re-def'ing my old (memoize)d symbol to a new (memoize)d version? will the old closure not be garbage collected or something?
19:35jcromartiei.e. *e is much more useful than any stacktrace that slime has every showed me.
19:36a_strange_guykwertii: if the old (memoized) function is bound in a closure (in a lazy-seq maybe) then it wont get collected
19:37kwertiia_strange_guy: hm, interesting.
19:38technomancyjcromartie: vague plans, nothing much
19:38technomancythe latest version dims irrelevant lines for you
19:38jcromartiebut at least I know about *e :)
19:38jcromartieso that gets me further
19:38jcromartiealso I found clojure.stacktrace today
19:39jcromartiebut that still has some of the same issues as the regular slime stack trace
19:43a_strange_guykwertii: you could use the new metadata on fns to make the atom visible and reset!-able from outside
19:43a_strange_guyi'll sketch that up
19:44kwertiia_strange_guy: I was just thinking something along those lines... I was thinking of adding some kind of "tainted" metadata tag that would cause it to reset itself, but that seems to require a wrapper, unless entities can somehow access their own metadata?
19:44kwertiia_strange_guy: your version is much simpler :)
19:45a_strange_guyclojurebot: paste
19:45clojurebotlisppaste8, url
19:46a_strange_guyforgot that it's broken
19:46a_strange_guykwertii: here: http://gist.github.com/315254
19:46kwertiia_strange_guy: awesome, thanks
19:47a_strange_guymetadata on fns got really useful :)
19:49a_strange_guykwertii: functions can actually access their own metadata
19:50a_strange_guy,((with-meta (fn self [] (meta self)) {:meta 1}))
19:50clojurebotjava.lang.UnsupportedOperationException
19:50a_strange_guy... in 1.2
19:50a_strange_guyxD
19:51kwertiiah yes, just got that too
19:51a_strange_guymetadata to fns got added in master a month ago
19:52a_strange_guy,(clojure-version)
19:52clojurebot"1.1.0-master-SNAPSHOT"
19:52kwertiiO
19:52kwertiiI'm on plain "1.1.0"
19:53kwertiisame thing
20:01kwertiia_strange_guy: http://gist.github.com/315268 <- hack with magic :reset! flag to work on versions of Clojure without metadata on fns
20:17jcromartieSo does this count as "declarative" validation? http://gist.github.com/314809
22:36defnhttp://www.youtube.com/watch?v=5J0t-Fgn6AE
23:09crowbar7Awesome video
23:19brandonwlein newbie here... is there any docs i can read on how to generally do stuff in lein? i haven't used java build management tools, so i'm not sure if it would be helpful to just read ant or maven documentation, or if i should only look at ant/maven when i need certain tasks they provide
23:20brandonwfor example, i'm trying to set up my first project.clj, how can i set the dependencies of clojure to be anything above a certain version? and does anyone have any experience setting up lein with a nailgun server?
23:20brandonws/is/are
23:21brandonwwas going to say is there any documentation
23:21brandonwthen my brain turned off for a word :)
23:32dnolenbrandonw: just specify the version that you want. Supporting Clojure versions higher than 1.1.0 is not well supported from what I can tell.
23:40konrmy godness, haskell is complicated
23:48brandonwis there any way to have lein skip downloading basic deps like clojure/clojure.contrib and just use what i have set up already? or is that just not the way build management works?
23:49konrI think it already does that, checking for updates once in a while
23:49brandonwi guess the snapshot it downloads will probably be more up to date than the version i'm running anyway, so it doesn't matter
23:49brandonwbut that is only if i specify the snapshot
23:50brandonwi think i am missing something, it just seems weird if someone has your project.clj and goes through the deps, and they already have an up to date version of clojure installed, but lein will re-download another one from clojars anyways, right?
23:52konrHmm, I don't think so, at least if they are in the right directory. Is it happening to you?
23:53jcromartiehey, what do I need to do to get this working http://clojars.org/org.clojure/clojure-http-client
23:53jcromartie(lein-wise)
23:53brandonwkonr: what is the "right" directory?
23:53jcromartielein deps gives me a load of maven errors when I add http-agent
23:53jcromartieorg.apache.maven:super-pom:jar:2.0
23:54brandonwi have a dir containing clojure checkout, and a synlink from a bin directory to the launcher in clojure.contrib checkout
23:54brandonws/syn/sym
23:55brandonwshould i not even be using the git checkout, and just using the lein ~/.m2 clojure & clojure.contrib snapshots?
23:55konrjcromartie: did you add it to your :dependencies vector on project.clj?
23:55jcromartieyes
23:55jcromartiejust like every other dep
23:55jcromartieexcept this one bombs
23:55brandonwjcromartie: i actually am having a problem with that too
23:55brandonwexcept for lein-nailgun
23:56konrbrandonw: hmm, project/lib/ - the jars should all be there
23:56jcromartieclojure, c.c, congomongo, compojure, enlive all work
23:56jcromartiebut http-agent does not
23:56brandonwsame thing: it gives an error: Path to dependency: 1) org.apache.maven:super-pom 2) org.clojure:clojure
23:56JonSmiththere's also clj-apache-http
23:56JonSmithif you don't have luck with the other one
23:56jcromartiethe error dump: http://pastie.org/843684
23:57JonSmithcan also go low tech and go to the git repo and do it manually
23:58jcromartieI'm surprised it's not in clojars http://clojars.org/search?q=clj-apache-http
23:58konrbrandonw: personally, I always use lein to keep a current version of clojure and clojure.contrib
23:59jcromartielein makes me happy
23:59konrbrandonw: if you plan to use git to mantain the versions updated, perhaps it would be better to remove them from :dependencies
23:59JonSmithhttp://github.com/rnewman/clj-apache-http
23:59jcromartieyah
23:59brandonwkonr: i guess what i'm asking is what is the standard way to develop with the up-to-date version of clojure & lein? do you just use lein's repo in ~/.m2 to have all the latest jars from clojars.org and use those in your project's lib as needed?
23:59JonSmithhttp://github.com/technomancy/clojure-http-client