#clojure log - Feb 25 2010

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

0:09 arohner: here'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?

0:11 cemerick: arohner: reduce isn't lazy...

0:11 arohner: there are a bunch of intermediate steps, and the final step is a reduce, into an object that does fit in ram

0:12 cemerick: well, you can reduce a vector of [count, your-other-object] through the seq

0:12 arohner: true

0:13 cemerick: other approaches would be to swap! inc an atom defined outside the reduce fn *shrug*

0:13 another approach, that is

0:47 lancepantz: anyone know how i can read in a file from the WEB-INF directory of a war?

0:47 i'm trying this: (.getResourceAsStream (clojure.lang.RT/baseLoader) "WEB-INF/db/database.yml")

0:47 no dice though

1:02 cemerick: lancepantz: 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

1:05 lancepantz: i've tried with it in classes as well, how would i qualify the path? the file is in WEB-INF/classes/db/database.yml

1:05 i tried (.getResourceAsStream (clojure.lang.RT/baseLoader) "/db/database.yml")

1:06 ah, just got it :)

1:06 thanks cemerick

1:07 cemerick: yeah, you don't want the leading /

3:20 LauJensen: Morning team! :)

3:20 vu3rdd: LauJensen: good morning!

3:43 ordnungswidrig: hi hall

3:46 esj: Moaning.

3:51 spariev: morning

4:03 Crowbar7: Morning sir

4:03 or mam

4:08 avarus: hi

4:43 caljunior: (filter nil? [1 2 3 nil])

4:43 ,(filter nil? [1 2 3 nil])

4:43 clojurebot: (nil)

4:43 LauJensen: ,(filter identity [1 2 nil 4 5])

4:43 clojurebot: (1 2 4 5)

4:43 caljunior: thanks lau

4:44 LauJensen: np

4:46 AWizzArd: the nice thing about filter identity is that it can also eliminate false from the coll

4:47 But if you definitly only want to remove nils then (remove nil? [1 2 nil 3 nil nil]) documents this probably a bit better.

4:48 caljunior: ,(remove nil? [1 2 3 nil])

4:48 clojurebot: (1 2 3)

4:48 caljunior: thanks

4:49 more intuitive than filter identity, I only need to remove nils.

4:55 piccolino: Is there any way to import a Java class that is in the default package? I can't figure out how.

5:01 tomoj: I think that's impossible

5:38 konr: What's the closest we have to a CL->Clojure translator?

5:39 Raynes: konr: Rich.

5:43 AWizzArd: konr: 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?

5:46 konr: AWizzArd: the first option, but my question doesn't make much sense as clojure handles a lot of things differently

5:47 AWizzArd: Depends on how far you want to take it.

5:47 Humans can do such a translation, so an algorithm exists :)

5:49 Chousuke: A very dynamic, complicated, and imprecise algorithm, yes :P

5:49 AWizzArd: Not the most trivial thing to write it down

5:50 Chousuke: I wonder how people write swank backends. I can't really find any documentation for the protocol :P

5:51 there's the source code for other backends as reference I suppose. meh.

5:52 AWizzArd: You want to improve swank-clojure?

5:55 Chousuke: well, it breaks with newer slime versions

5:55 it needs fixing

5:58 wait, what. it doesn't break anymore. :P

5:59 paredit doesn't quite work in it though :(

6:01 it's weird. I can type [ and get [], but then deleting the opening bracket doesn't delete ]

6:01 and this problem only exists in the slime buffer :/

6:01 AWizzArd: Chousuke: yes, I am still using slime from October 2009

6:01 Chousuke: I just tried with git slime. it started the repl with no problems

6:02 * esj is too scarred after the last time to move off elpa's swank

6:09 AWizzArd: Chousuke: last year it was so easy. Just getting a fresh version of slime, downloading jochu-swank and that's it

6:09 But suddenly newer versions of slime didn't work anymore

6:09 and unfortunately Jochu stopped his efforts on swank-clojure

6:10 And now there is only some strange Elpa thing, and one can not just download swank-clojure anymore

6:10 all is deeply hidden in some paths and requires manual copying out of those files, or one needs elpa

6:11 Chousuke: I'm not sure what you mean :P

6:11 my swank-clojure and slime are both straight git clones

6:11 clojure-mode too

6:11 AWizzArd: what is your swank-clojure url from which you clone?

6:12 git://github.com/jochu/swank-clojure.git

6:13 but that one for example is already in a different format

6:14 Chousuke: it should have only swank-clojure.el and swank-clojure-autoload.el in the toplevel dir, and then a folder swank.

6:14 but instead there now is a src/ dir

6:19 Chousuke: AWizzArd: I clone from technomancy

6:19 but gah, why don't square brackets work in slime :(

6:21 AWizzArd: yes, but the technomancy swank also requires manual moving of files and dirs

6:21 anyway, I could also try if it will work with the newest version of slime

6:22 Chousuke: it just needs a classpath update, not manual moving of things :P

6:23 just add the src dir to your swank-clojure-classpath

6:23 AWizzArd: (add-to-list 'load-path "/hg/lib/clj/swank-clojure/")

6:23 in there I expect the swank-clojure.el and swank-clojure-autoload.el and a swank dir

6:23 but since some months it was not working with fresh slimes anymore. But it seems it does work again, as you said.

6:24 Chousuke: swank-clojure-autoloads.el no longer exist

6:24 you're supposed to generate them yourself, I suppose

6:24 I don't bother, I just require 'swank-clojure

6:27 djpowell: someone was asking about acumulating a count whilst reducing over a big sequence earlier - has anyone considered something like juxt, but that works with reduce?

6:29 eg: http://paste.lisp.org/display/95583

6:34 hoeck: Chousuke: the swank-clojure-slime-repl-modify-syntax function will add necessary entries so that ] and } are deleted properly in the slime repl

6:34 Chousuke: hoeck: yes, except ot doesn't work. :(

6:34 hoeck: it works fine in clojure-mode buffers, but not slime

6:34 hoeck: Chousuke: unfortunately, no one calls it

6:35 you have to add this function as a hook to slime-repl-mode-hooks

6:35 of course, this should be the duty of swank-clojure

6:37 like: (add-hook 'slime-repl-mode-hook 'swank-clojure-slime-repl-modify-syntax) in .emacs, somewhere after (require 'slime)

6:39 Chousuke: adding the hook in swank-clojure.el seems to work

6:39 except for curly brackets

6:40 I guess the define-key thingies aren't getting called :/

6:41 hoeck: deleting curly braces does work for me, but not inserting, inserting { won't give me the closing }

6:41 Chousuke: I think maybe paredit isn't yet enabled for the repl buffer when it executes that hook

6:43 hoeck: for curly braces they are only called for paredit above v21

6:44 Chousuke: I have the latest beta

6:44 hoeck: below v21, the command is called paredit-open-brace, for v21 and higher clojure-mode tries to call paredit-open-curly

6:45 I have v20 and only the *-brace commands

6:45 Chousuke: I have 22, so it should work

6:45 but it doesn't.

6:45 and I don't see why

6:46 paredit is enabled prior to swank as far as I can tell

6:47 oh wait

6:47 no, the hooks are in the wrong order :|

6:47 hoeck: it checks for paredit-mode variable

6:47 Chousuke: I suppose I can't add the hook in the swank-clojure.el file :/

6:47 hoeck: so if paredit-mode is not active when running this hook ..

6:48 or just enable paredit-mode in this hook?

6:50 btw, I don't see why paredit shouldn't take on [ and { by default

6:52 Chousuke: gah

6:52 it seems the paredit hook gets run last because it's added first...

6:55 AWizzArd: Chousuke: so, slime and swank-clojure seem to run fine, but only paredit still has some problems?

6:56 Chousuke: yes

6:56 gah, this is silly

7:00 aha, I just needed to add the optional append parameter :P

7:41 jcromartie: http://clojars.org/org.clojure/clojure-http-client seems to not work for me

7:43 org.apache.maven:super-pom:jar:2.0 can't be found

7:51 powr-toc: Does anyone know if derby db is a maven repository anywhere?? It doesn't seem to be in central

8:09 eevar2: org.apache.derby?

8:10 http://www.ibiblio.org/maven/org.apache.derby/ that is

8:14 powr-toc: eevar2: cheers bud... I have it working now

8:14 I was using derby-project not derby

8:16 jcromartie: OK what's up with "This is evil. Don't ever use it." in c.c.apply-macro

8:23 (defmacro barely-try [& forms] `(try ~@forms (catch Exception _)))

8:23 or maybe "meh" would be a good name for that macro :P

8:27 AWizzArd: jcromartie: what about (without-exception ...)

8:27 jcromartie: AWizzArd: It's more of a joke :)

8:32 are there any libs to report on test coverage for namespaces?

8:32 like if I wanted to know what functions in namespace x were covered by tests (optionally in namespace y)

8:35 AWizzArd: Would be a nice feature.

8:50 esj: When 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 ?

8:50 i thought (in-ns 'blahblahblah) in the execution buffer would do it, but that was too easy :)

8:54 jcromartie: http://gist.github.com/314551

8:55 oops, was missing ns-fns

9:00 powr-toc: Do anonymous clojure functions not support destructuring?

9:01 ordnungswidrig: hi, how do I skip the first n elements of a seq?

9:03 ohpauleez: ordnungswidrig: nthnext

9:03 hoeck: drop

9:03 ordnungswidrig: drop, thanks

9:04 jcromartie: powr-toc: they do

9:05 powr-toc: hmmm... then this must be wrong: (map (fn [[k v] pair] (str "k is " k " v is " v)) { 0 :a 1 :b 2 :c })

9:05 jcromartie: yeah, that is wrong :)

9:06 you're missing :As

9:06 :as

9:06 powr-toc: ahh

9:06 jcromartie: if you want pair

9:06 if not, just leave it off

9:06 (everything after the [k v] that is)

9:06 ohpauleez: ordnungswidrig: drop will give you back a lazy seq, nthnext a collection (seq coll)

9:07 powr-toc: jcromartie: cheers, it works fine

9:08 AWizzArd: Guys, am I blind? I can’t find duck-streams in here: http://github.com/richhickey/clojure-contrib/tree/master/src/main/clojure/clojure/contrib/

9:13 ordnungswidrig: ohpauleez: oh, thanks. lazy-seq is fine in my case.

9:13 ohpauleez: awesome

9:13 jcromartie: how can I get a symbol from a var?

9:13 ohpauleez: AWizzArd: I don't see it, unless it got rolled in somewhere, or moved into core

9:15 Drakeson: how would you dump a binary data to a file?

9:16 AWizzArd: Drakeson: use the JVM classes/methods.

9:17 http://java.sun.com/javase/6/docs/api/java/io/package-summary.html

9:18 Drakeson: AWizzArd: thanks

9:20 dsop: how can I get the data in a post request in compojure?

9:24 atrerus: jcromartie: can you quote it? like 'foo or (quote foo)

9:32 dsop: :form-params is what you're looking for: http://compojure.org/docs/requests

9:33 jcromartie: atrerus: I mean from an actual var object

9:33 this testing-testing business is trickier than I thought

9:34 cemerick: huh, I've always just used :params. Never had any need to distinguish between query params and entity params

9:34 atrerus: what's in your var object?

9:34 dsop: atrerus: thank you

9:34 atrerus: sure :)

9:35 jcromartie: so you have a var with a symbol inside?

9:35 jcromartie: cemerick: I use form-params for RESTful routes

9:36 atrerus: no, I have a var and I wanted the symbol that would resolve to it

9:36 but I worked around it

9:36 atrerus: hmm... it's possible you could get what you're looking for from the meta data

9:37 cemerick: jcromartie: there's nothing more or less RESTful about query vs. entity parameters...?

9:37 atrerus: I think though that you could find out what the symbol for the var is, but not the original symbol for the data itself

9:38 jcromartie: cemerick: I merge the form-params with the resource to be updated, or as the data to be posted

9:38 after some validation

9:38 cemerick: I use query params for something like metadata on the request

9:39 like for searches of a resource

9:39 of course they rarely ever exist side-by-side and my validation strips out invalid keys.... so I guess it doesn't really matter

9:39 cemerick: jcromartie: well, that's fine, but whether the parameters go in the url or entity isn't what determines "restfulness"

9:43 jcromartie: nope

9:44 I am kind of tired of the word anyway... :P

9:44 just like "API"

9:52 _fogus_: rhickey: Do you have planned what you're going to speak on at this event? http://www.eventbrite.com/event/586299638

9:53 rhickey: _fogus_: nope

9:53 _fogus_: rhickey: Well... looking forward to it anyway. :)

9:54 rhickey: I'll need to coordinate with Stu so we do something different

9:55 AWizzArd: Will there be someone recording it?

9:55 _fogus_: I would love to see a talk on cells, but I'm not trying to dictate that

9:56 The mind/minds-blown ratio would likely be high

9:56 AWizzArd: The question is if they are mature enough already to be concrete enough.

9:56 I am using them tho

9:58 mattrepl: types, protocols, and cells would be nice. to hear the thinking behind new/wip features from the source

9:58 esj: +1 somebody recording these

9:58 _fogus_: sounds like you'll be there... :P

9:59 _fogus_: esj: It's in my neighborhood, so yes

10:00 AWizzArd: Do 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 I do have a DVD video camera... the problem is it only records 25 minutes at a time

10:01 AWizzArd: yeah, because he would explain it in ways we mortals never thought about :)

10:01 rhickey: Mangalam this morning

10:02 Raynes: _fogus_: Make him stop every 25 minutes.

10:02 mattrepl: for tea

10:04 LauJensen: tea is nice.. for woman

10:04 cemerick: wha?

10:04 clojurebot: the world <reply>what the world needs is more higher order functions

10:05 rhickey: ah LauJensen, always provoking

10:05 LauJensen: hehe - hit a soft spot did it ? :)

10:05 * _fogus_ looks askance at his Earl Grey

10:06 Raynes: I love tea. :(

10:06 cemerick: LauJensen: no, that veered into stupid territory :-(

10:06 rhickey: Clojure 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:06 * cemerick is a little riled after having to beat down a couple of outlandishly sexist guys at a meetup yesterday

10:06 Raynes: rhickey: o/

10:06 LauJensen: hehe

10:07 _fogus_: cemerick: You literally beat them?

10:07 Raynes: Sounds like fun.

10:07 LauJensen: cemerick: Whats sexist about it? I thought it was very innocent to be honest

10:07 danlei: +1 for tea, darjeelings preferably

10:08 cemerick: _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:08 rhickey: Darjeelings in the afternoon

10:08 Assams/ china blacks for breakfast

10:09 Raynes: cemerick: You should have actually beat them. Would have made for better entertainment.

10:09 LauJensen: please...

10:09 _fogus_: rhickey: Green tea in-between

10:09 AWizzArd: White tea here.

10:09 Raynes: Black tea here.

10:10 rhickey: AWizzArd: oh yes, Silver Needle often in the evenings

10:10 danlei: yes, Assams are nice too, don't know much about chinese teas though (but tried a few Oolongs)

10:10 rhickey: Oolongs rock

10:11 _fogus_: I'm partial to hojicha

10:11 cemerick: LauJensen: 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:11 AWizzArd: yes

10:12 LauJensen: cemerick: Been sippin 'Testorone tea' again ? :)

10:12 rhickey: _fogus_: interesting, never tried that

10:13 konr: Here 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:13 rhickey: _fogus_: cool!

10:13 danlei: _fogus_: never tried, but I kinda liked genmaicha

10:14 rhickey: danlei: yes, that I've had

10:14 _fogus_: danlei: My second favorite

10:14 cemerick: LauJensen: nope, just Snapple Diet Raspberry baby! :-D

10:14 * cemerick counts down to rhickey making fun of him

10:15 rhickey: Snapple Diet Raspberry is OT in a discussion about tea

10:15 LauJensen: Ok - I give up, I made a cup of Silvery Perl tea, whatever that is :)

10:16 rhickey: _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:16 cemerick: rhickey: 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:17 rhickey: cemerick: that settles it then :)

10:17 danlei: oh ... I didn't know about "monkey picked" tea :)

10:18 cemerick: I love it when truth in labeling wins out. :-D

10:18 _fogus_: There is nothing better than monkey-stomped wines

10:19 rhickey: danlei: that competition grade Ti Kuan Yin is awesome, but really expensive. Every infusion has a different character

10:19 see LauJensen, you are seriously outnumbered by tea drinkers here :)

10:19 and some serious tea drinkers

10:20 LauJensen: rhickey: 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:20 cemerick: wow, $100/pound

10:21 _fogus_: Also a favorite of mine, Pu Erh. I can't drink enough

10:21 danlei: gotta do something about ERC ... always crashes my emacs on cygwin :|

10:21 rhickey: cemerick: 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:21 powr-toc: Definitely green\white tea... with occaisional Earl grey

10:21 LauJensen: danlei: couldn't help but notice that you said "cygwin" and "crash" on the same line :)

10:21 danlei: :)

10:22 rhickey: _fogus_: I couldn't find the charm in Pu Erh

10:22 danlei: the hard thing about tea is that you have to /make/ it right

10:22 _fogus_: rhickey: I like its earthiness

10:22 rhickey: danlei: definitely

10:23 _fogus_: makes sense from your other preferences

10:23 cemerick: rhickey: I don't have any kind of palette for wine, either.

10:23 rhickey: does this second/third infusion mean you use the same leaves for multiple brews?

10:23 konr: haha, I gave up pu-erh when it came with vermin, but the vendor insisted that they were _good_ vermin

10:23 chouser: ah man, roll out of bed a couple hours late one day and miss all the fun...

10:23 rhickey: cemerick: yes, greens, whites, oolongs all support multiple infusions of the same leaves

10:24 cemerick: I had no idea.

10:24 danlei: the chinese generally (as far as I know) do multiple infusions (even having different names, like "... of friendship" ...)

10:24 cemerick: I'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:24 rhickey: as long as you didn't scorch them the first time - very sensitive to water temp and brewing times

10:24 powr-toc: Oh, and I can highly recommend Morrocan mint tea served in the souqs of Fez with fresh orange blossom infused

10:25 danlei: marrocan mint really is hard stuff :)

10:26 * rhickey just got a Moroccan tea set as a gift

10:26 danlei: I remember when I tried it the first time, coming from europe and being accustomed to our local mint ...

10:26 powr-toc: served with the characteristic 12 spoons of sugar!

10:26 LauJensen: I think you guys would love "8 spoons, 8 parts water, click" and then a nice cup of coffee results :)

10:26 rhickey: have to practice my aerating pour

10:27 powr-toc: rhickey: hahahaha... yes I got shouted at in a cafe for not aerating mine enough!!

10:27 * _fogus_ recently acquired a distaste for coffee

10:28 avarus: bye

10:28 cemerick: I've been trying to like coffee for years, unsuccessfully.

10:28 finally came around to beer a few years ago

10:28 I guess beverages are a problem for me. :-)

10:28 eevar2: cemerick: decaf then?

10:29 just gotta build up some addiction, through regular exposure, and both coffee & beer go down very smoothly ;)

10:29 cemerick: eevar2: no, any kind of coffee just tastes like burnt bread smells.

10:29 eevar2: - 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:29 cemerick: I don't know how people drink most of the beer that gets swilled.

10:30 * danlei doesn't like beer either.

10:30 powr-toc: We have some awesome Ale in Scotland :-)

10:30 danlei: I'd prefer the scotch :)

10:31 cemerick: _fogus_: I've been really enjoying doublebocks lately.

10:31 _fogus_: don't drink anything you can see through :-)

10:31 powr-toc: danlei: Ale with Whisky on the side :-)

10:31 chouser: I drink tea, but after this conversation I've realized how very far I am from being a "tea drinker"

10:31 danlei: powr-toc: :)

10:32 chouser: ah, as long as you don't think the stuff in the bags is tea, all is fine :)

10:32 rys: Or both, if it's Innes and Gunn. They finish it in whisky barrels, iirc, and it's very very tasty

10:32 chouser: danlei: ok. but what should I call it? "muck"? A muck drinker ...I could go with that.

10:33 rys: You get some very good teas in bags (and some bags are better than others, too)

10:33 danlei: chouser: hm ... "muck" yes, sounds reasonable :)

10:33 clojurebot: Why are you asking *him*

10:33 rys: As an Englishman, I feel qualified to comment :P

10:35 danlei: rys: 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:35 powr-toc: I 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:35 chouser: rhickey: 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:35 rys: danlei: agreed, it's harder to find

10:35 chouser: and I'm curious why you thought they might not ...am I failing to test something that would make them all blow up?

10:39 I'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:39 LauJensen: rhickey: do you happen to have some interesting reading on immutable datastructures and their place in life ?

10:39 rys: powr-toc: v.nice! I'm running a distiller's edition Caol Ila atm

10:40 chouser: But if called using a keyword as a fn, can do the same number in 126 msecs -- over 2.5 times faster.

10:40 tjg: Hi! 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:41 powr-toc: rys: nice... I don't remember trying it... but I do like the Islay malts

10:42 rys: It's Lagavulin-y in that there's a load of sub flavours, but it's less hardcore smokey

10:42 powr-toc: hmmm... 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:42 odd

10:46 rhickey: chouser: yeah, I think I scared you off of that unnecessarily the other day

10:46 chouser: ok. well, I didn't stay scared long. :-)

10:47 rhickey: good

10:47 chouser: actually, saying things like "that'll never work" has been used by people who know me as intentional motivation, so ... good job.

10:48 rhickey: I looked again and most of the other stuff is related to the sites, not the targets

10:48 chouser: ok

10:48 I'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:48 rhickey: cool

10:49 has anyone here tried Jetlang?

10:49 chouser: if IKeywordLookup were a protocol, it'd be even better.

10:50 rhickey: sometime when I get a few straight days to think I need to work on the bootstrapping issues of more things being protocols

10:50 chouser: as it is, in order to "extend" IKeywordLookup to these final classes I have to wrap them.

10:51 in case you're curious, here's the bare bones of what I'm doing: http://gist.github.com/313728

10:52 rhickey: eval, eh?

10:52 chouser: that 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:52 rhickey: heh. yeah. to get at the reify code-gen machinery.

10:52 only happens the first time though. :-)

10:53 (per call site)

10:54 if you have a better idea than (eval `(reify ...)) I'd be happy to hear it.

10:55 rhickey: chouser: 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:56 chouser: one 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:57 rhickey: of course the only existing derivees of IKeywordLookup are deftypes (and your new code), so it could easily be a protocol

10:58 chouser: rhickey: 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:58 rhickey: but 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:58 chouser: yes

10:58 chouser: hm, interesting.

10:59 I 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:59 but I've got plenty of other angles to work on here, so ... either way.

11:00 rhickey: chouser: I think you should try :on first, given the bootstrap issues above

11:00 chouser: ok

11:00 wait, I should try?

11:00 is it there but undocumented?

11:00 rhickey: :on is likely working or barely broken

11:00 chouser: ok

11:02 thanks for the pointers. gotta go.

11:10 jcromartie: hey what's up with Compojure and println?

11:10 when using println I get that output in the response, but only sometimes

11:11 like, depending on what kind of handler and middleware I'm using

11:12 cemerick: jcromartie: something's rebinding *out* to the response's outputstream.

11:12 jcromartie: definitely, and I have a feeling it's something in compojure

11:13 nothing I wrote

11:13 cemerick: jcromartie: there's no reference to *out* in the compojure sources I have *shrug*

11:14 jcromartie: weird

12:33 Drakeson: how do you change the default content-type in compojure?

12:34 is there a better way than putting (content-type "application/xhtml+xml") in every entry in defroutes?

12:36 jcromartie: maybe middleware?

12:36 if it's just a header

12:37 write middleware to set the content type

12:39 cemerick: Drakeson: yup, middleware is the way to go

12:44 arohner: there's a with-mimetype middleware included now

12:49 Drakeson: jcromartie, cemerick, arohner: thanks :)

12:50 jcromartie: So I've got this going on now.

12:50 http://gist.github.com/314809

12:50 It's working nicely.

12:50 It should hopefully be fairly apparent how it works.

12:50 If not, I'm open to suggestions :)

12:51 arohner: what is a model? a map? a struct? a deftype? a DB row?

12:51 jcromartie: struct

12:51 clojurebot: destructuring is http://clojure.org/special_forms#let

12:51 jcromartie: with metadata on the var

12:51 arohner: interesting

12:51 jcromartie: collection and validator metadata

12:52 optionally on-delete

12:52 you can run (model-validate #'user {some user map ...})

12:53 or maybe this should be its own namespace so that the functions are just like "validate"

12:54 Raynes: technomancy: ping

12:56 cemerick: jcromartie: if I were you, I'd make either required or optional the default, and provide a way to change that.

12:56 jcromartie: yeah, not a bad idea

12:57 cemerick: the field name is the primary slot, not its optionality IMO

12:57 jcromartie: the validator fn that gets built threads the new value through those forms though

12:57 cemerick: I'd also make the fields defined in vectors (at least by convention). I generally assume functions are being applied if I see parens.

12:58 oh, well, I was assuming this was a macro.

12:58 jcromartie: it is

12:58 cemerick: well, then you can build those (required/optional .......) forms up and thread away. :-)

12:58 * cemerick loves suggesting work for other people ;-)

12:59 jcromartie: notice the last form: (hash-password)

12:59 that's just a step in the validation that's not related to a field

12:59 I would lose the ability to do that

13:01 cemerick: well, having everything lobbed together implies that each form is a peer of the rest. You could do (defmodel user :fields [....] :validators [....])

13:02 jcromartie: maybe

13:02 hiredman: {:field-name [validators]}

13:03 cemerick: +1 hiredman

13:03 jcromartie: hmm

13:03 yeah, now you're talking

13:06 hmm, now how about defaults

13:07 I think I have to stick with this right now. I'm trying to get this system doe.

13:07 done.

13:07 I can rework validators later :(

13:08 I don't have a good solution for things like (hash-password) there

13:08 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:10 jcromartie: maybe just pass the extra validators as additional args to defmodel

13:10 cemerick: jcromartie: what does hash-password do?

13:10 jcromartie: it sets :hash if :password is set

13:11 so you'd set :password, then validate and save and :hash is now the hash of the :password

13:11 cemerick: huh

13:11 our hashing and salting are just baked in and automatic -- shouldn't be possible to set a password without those happening.

13:12 jcromartie: do you manage that in the database or what?

13:13 i.e. what does "baked in" mean?

13:13 cemerick: I mean, when a account record is updated, the password gets salted and hashed, period.

13:16 technomancy: Raynes: hi

13:16 jcromartie: cemerick: right, but where does that happen? at some point you are calling a function, right?

13:16 validation would always happen when creating or updating a record

13:17 cemerick: what I'm getting at is that salting and hashing passwords is orthogonal to form validation.

13:18 technomancy: anyone want to translate this for me? leiningen → 雷人間 → 稲妻回路 → キカイダー01

13:18 jcromartie: cemerick: this isn't form validation

13:18 this is validating the actual data

13:19 I'm splitting out form validation

13:19 cemerick: ah

13:25 jcromartie: great suggestion on the maps hiredman

13:25 maps and vectors

13:25 :)

13:25 less pain than a macro that parses the forms

13:28 how would I split a vector on a value?

13:29 Raynes: technomancy: <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:29 jcromartie: nevermind

13:29 * Raynes is sorry for being slow. Kinda multitasking.

13:30 jcromartie: hmm, no, split-with is not what I wanted

13:31 I want to have vectors like [foo bar :default x]

13:31 technomancy: Raynes: 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:33 Raynes: technomancy: Oh, I see. Thank you. :)

13:41 fanatico: technomancy: any reason `lein repl` ignores the previous value of $CLASSPATH?

13:42 technomancy: fanatico: lein repl is a mess; it's on a quick path towards a rewrite

13:42 right now it's implemented entirely in the shell script

13:46 drewr: am I misunderstanding :exclude here? http://gist.github.com/314886

13:48 fanatico: right. 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:50 technomancy: fanatico: 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:57 drewr: ah, I need (ns ... (:refer-clojure :exclude...))

13:58 fanatico: technomancy: http://dl.dropbox.com/u/2680118/classpath_env.patch

13:58 technomancy: fanatico: could you send that to the mailing list?

13:59 otherwise I'll forget it

13:59 fanatico: sure

14:07 avarus: hi

14:15 Licenser: aloaeh!

14:16 jcromartie: is that like aloha?

14:17 Licenser: I think so

14:24 jcromartie: is there anything like (reduce %(%1 %2) x list-of-fns)

14:28 eyeris: jcromartie: What are you trying to do?

14:28 That reduce invocation is invalid, so it's hard to see what your goal is.

14:28 jcromartie: invalid?

14:28 er, I mean #()

14:29 I want to apply each function in a vector to a value

14:29 (reduce #(%2 %1) x list-of-fns)

14:29 there we go

14:29 eyeris: Okay

14:30 jcromartie: ,(reduce #(%2 %1) 10 [str seq])

14:30 clojurebot: (\1 \0)

14:30 jcromartie: oh, comp would work

14:30 eyeris: I think you want ((apply comp list-of-fns) value)

14:30 jcromartie: yeah

14:30 eyeris: Or, if that list of fns is a literal, just take them out of the list and drop apply

14:31 :)

14:31 jcromartie: not a literal

14:32 ,((apply comp [str seq]) 10)

14:32 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

14:32 jcromartie: oh, that's backwards now

14:32 ,((apply comp (reverse [str seq])) 10)

14:32 clojurebot: (\1 \0)

14:33 cemerick: don't worry, hardly anyone can remember that comp applies right to left :-)

14:35 eyeris: cemerick: why not? It makes total sense to me in clojure, because I just imaging the parens

14:36 In Haskell I always get it backward because the arrows screw with my mind :)

14:36 imagine*

15:16 fanatico: Is there a dynamic way to add methods to a proxy object that haven't been specified in the interface?

15:16 kotarak: fanatico: no

15:17 fanatico: didn't look like it. thanks.

15:17 kotarak: fanatico: you need gen-class for that

15:17 or gen-interface

15:18 hiredman: gen-interface is best

15:24 arohner: is there a certain amount of overhead on transient / persistent!, or is it always faster to use transients, even when making a single modification?

15:25 AWizzArd: not always faster, but it takes only some microseconds to do transient/persistent!

15:26 for "single modifications" they are not faster I would say

15:29 dnolen: arohner: 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:30 hopefully not way off base I mean

15:30 arohner: dnolen: all of the work I'm doing is in a single fn

15:33 AWizzArd: ,(/ 17500 75.0)

15:33 clojurebot: 233.33333333333334

15:33 AWizzArd: ,(/ 7500 175.0)

15:33 clojurebot: 42.857142857142854

15:46 jcromartie: OK so here's my model definition now http://gist.github.com/314809

15:46 dabd: was str-utils2 removed from clojure-contrib?

15:47 hiredman: renamed to string

15:52 jcromartie: hiredman: i followed your advice

15:52 it seems to be good advice :)

15:52 I was thinking of collection any exceptions encountered during validation, but I'm not sure what to do with them after that

15:52 I can stuff them into ::errors

15:52 in the validated object

15:53 maybe use a callback?

15:53 on-error?

15:53 clojurebot: http://haacked.com/images/haacked_com/WindowsLiveWriter/IConfigMapPathIsInaccessibleDueToItsProt_1446B/works-on-my-machine-starburst.png

15:53 jcromartie: I love that image... so maddening.

15:54 hiredman: jcromartie: are you sure you want to handle exceptions in the data?

15:54 I mean wouldn't your verifier function do that?

15:54 jcromartie: potentially

15:55 this is for an API that should probably return a list of errors

15:55 not just one exception or something like that

15:56 hiredman: you might consider stuffing it into an ::errors slot in the metadata

15:56 jcromartie: ah, metadata makes more sense

15:56 I forgot about that :P

15:57 (excellent idea)

16:00 so is the general Clojure philosophy to avoid throwing Exceptions or what?

16:00 I guess invalid data is not really that exceptional

16:01 hiredman: looser about exceptions because they are not checked

16:05 jcromartie: right

16:06 I could generate documentation from all of these vectors of validator functions

16:06 that would be awesome

16:28 dakrone: if 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:28 right now I get Wrong number of args passed to: user$bar

16:28 when I do (foo 1 2)

16:29 hah, nevermind, I should have used apply

16:38 maxhodak: i'm working on translating the facebook api client lib to idiomatic clojure

16:38 and wanted to double check my interpretation of "idiomatic clojure": http://gist.github.com/315064 <-- does this look right?

16:38 crowbar7: Anyone played with Compojure at all?

16:39 arohner: crowbar7: sure

16:39 crowbar7: I was thinking nof deploying some websites with it actually anyone know good way to get it hosted?

16:39 maxhodak: crowbar7: VPS?

16:40 crowbar7: www.linode.com

16:40 crowbar7: I'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:41 I've used / use linode for a business.

16:41 maxhodak: crowbar7: a VPS will give you direct shell access with the ability to install anything you want

16:41 crowbar7: yeah

16:41 maxhodak: so don't worry about "java" support or anything

16:41 just apt-get install sun-java6-jre jetty

16:41 etc

16:42 crowbar7: I was thinking of using the 1and1 dedicated servers if I gets some monthy cash rolling in from the pretty basic websites.

16:42 a vps is nice as well.

16:42 except 1and1 is a mixed experience.

16:43 hiredman: you could use appengine

16:43 maxhodak: hiredman: http://gist.github.com/315064 does this look right to you?

16:43 crowbar7: Tip about linode btw they don't let ou run your own DNS. :( made DNS tunneling impossible for me.

16:44 app engine won't let you point a domain anymore. just forward.

16:44 hiredman: maxhodak: in what sense?

16:44 maxhodak: hiredman: is that idiomatic clojure?

16:44 crowbar7: I will look into it though

16:44 tomoj: somnium: does congomongo not support sorting?

16:44 maxhodak: like, in an imperative language you'd create an object with your account params

16:44 crowbar7: for running some de it would be great come to think of it. Thanks guys

16:44 maxhodak: and then make calls on it

16:44 hiredman: maxhodak: sure, I think I'd use format instead of str there

16:45 crowbar7: s/de/dev

16:45 maxhodak: but in clojure i feel like you should do something similar to with-open to manage the context?

16:45 and then use some kind of global binding to pass in the connection to the actual call (fql-query)

16:45 hiredman: maxhodak: using something like with-open is a common pattern, but I would recomend against it

16:45 maxhodak: rather than having each call's first param be conn

16:46 hiredman: it maybe less of an issue because you will most likely only ever use one connection to facebook

16:46 maxhodak: and it's not a stream in the same sense; you aren't holding a resource open

16:47 it's just for convenience, but each call is stateless

16:47 stuartsierra: one of my motivations for rewriting the test lib from scratch was to eliminate all dynamic binding.

16:47 maxhodak: (re: http)

16:47 hiredman: but juggling implicit args via binding with multiple resources and laziness is just bleh

16:49 maxhodak: hmm

16:49 hiredman: maxhodak: 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:50 maxhodak: so you set half of that structure when you set up your connection (api key, secret, version number, etc)

16:50 and half of it in the method (method, args, call_id)

16:50 hiredman: you could, but why bother?

16:50 hold on

16:50 maxhodak: to avoid needing an additional argument on each method?

16:50 hiredman: gah

16:50 maxhodak: ok

16:51 hiredman: why does gist not let me link to lines numbers?

16:51 http://gist.github.com/297803#L288

16:52 line 288 is an example call

16:52 when I said "I would ..." I meant "I did ..."

16:52 somnium: tomoj: 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:54 maxhodak: hiredman: ok, so you're basically using bb in the way i was thinking of doing with dynamic bindings

16:54 so it comes out about the same

16:55 (right? you're just manually setting bb)

16:55 somnium: tomoj: I guess I always used sort-by, never noticed it wasnt there before

16:56 hiredman: maxhodak: right, all the parameters for the call are int he map, except the secrect for some reason that I don't exactly rememeber

16:56 tomoj: somnium: is all the mongo sorting done outside of mongo by the driver?

16:56 I thought there was some sorting that mongo could do

16:57 e.g. I have 30000 results and want them in reverse order :D

16:58 somnium: tomoj: I think its internal, theres an example with the js shell on their website

16:59 tomoj: ok

16:59 trying to poke my way around to a patch

16:59 somnium: cool

17:00 hiredman: maxhodak: 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:17 dsop: what'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:18 Chousuke: dsop: you can use line-seq to get a seq of lines from a BufferedReader

17:18 dsop: thanks so much, is there a good ressource to learn things like that?

17:18 coming from let's say..java without prior lisp knowledge

17:19 Chousuke: Well... browse the API docs, or read other people's code.

17:20 dsop: yes that's the obvious thing, but I thought more like a java -> lisp blog or so :)

17:20 arohner: why can't you seq a transient?

17:21 Chousuke: dsop: 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:21 dsop: Chousuke: okay thanks.

17:23 Chousuke: seqs based on IO are still a bit tricky. rhickey is still thinking of a solution :P

17:32 slyphon: hey, does the vimclojure guy ever hang out in here

17:32 ?

17:33 AWizzArd: yes

17:33 kotarak

17:33 He is here.

17:33 slyphon: oh, nice

17:33 kotarak: hai!

17:33 AWizzArd: he will see you in 1-5 minutes :)

17:33 slyphon: :D

17:33 * slyphon takes a number and waits patiently

17:34 kotarak: and suddenly ... *CLABANGO*

17:34 * slyphon coughs and waves away the smoke

17:34 kotarak: hehe

17:34 slyphon: kotarak: first off

17:35 kotarak: THANK YOU!

17:35 kotarak: slyphon: you are welcome :)

17:35 * AWizzArd nods

17:35 slyphon: it is such a pleasure to be hacking a lisp w/ vim

17:35 i really *really* didn't want to have to dust off my emacs

17:36 kotarak: I tried, but coudn't warm up with emacs. So I had to go with vim...

17:36 slyphon: so, i've been having a problem where sometimes the iabbrs get set up and sometimes they don't

17:36 kotarak: hmmm... can you define "sometimes"?

17:36 Raynes: I had either had unresolved issues with VimClojure, or just never figured out what was expected behavior. :p

17:37 slyphon: well, 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:38 kotarak: at 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:38 slyphon: i was wondering if there was any kind of debug logging i could turn on

17:38 kotarak: (if you did your classpath homework that is)

17:38 * slyphon nods

17:38 kotarak: slyphon: there should be huge stacktraces in ":messages" if something goes wrong.

17:39 slyphon: which version are you using.

17:39 ?

17:39 slyphon: yeah, 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:40 lemme look for the version

17:41 * Raynes thinks he will try VimClojure again just for shits and giggles.

17:41 Raynes: It's been a long time.

17:41 And I'm bored.

17:42 kotarak: Raynes: I have to get 2.2 out. It has some improvements with respect of robustness. But the time, the time....

17:42 Raynes: I'm cloning the repo anyways.

17:43 kotarak: Raynes: 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:43 nDuff: What happened to clj-gradle?

17:43 Raynes: Alright. Cool.

17:45 kotarak: nDuff: now named clojuresque

17:45 slyphon: thanks X11!

17:45 * slyphon grumbles

17:46 kotarak: nDuff: http://bitbucket.org/kotarak/clojuresque

17:47 slyphon: kotarak: 2.1.2

17:48 kotarak: it's like vimclojure#InitBuffer() never gets called

17:48 kotarak: Ok. 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:49 What does :messages say?

17:49 slyphon: the server is running, the classpath I *believe* is correct, the sourcefile is on the classpath

17:49 the source is com.motionbox.hornetq.jms at path com/motionbox/hornetq/jms.clj

17:50 in src/ and src/ is in the classpath

17:50 kotarak: should be ok

17:50 slyphon: kotarak: when i run the jline REPL with same classpath and everything, i'm able to "get to" the stuff in that file

17:51 nDuff: kotarak, thanks

17:51 kotarak: slyphon: and there is no error message whatsoever?

17:52 * kotarak posted a short ClojureQL teaser: http://tr.im/POBU

17:52 slyphon: yep, no error message

17:52 kotarak: grml

17:52 * slyphon hrms

17:54 slyphon: kotarak: 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:55 kotarak: slyphon: what happens of you call the nails manually? "ng vimclojure.Nail < source.clj" from the console?

17:55 I mean shell

17:56 slyphon: oh, hadn't tried that, lemme check

17:56 kotarak: oerk

17:57 slyphon: I meant: ng vimclojure.Nail NamespaceOfFile < source.clj

17:57 slyphon: ah, ClassNotFoundException

17:57 uh

17:57 kotarak: hmm... this should show up in ":messages"

17:57 slyphon: so for user.clj

17:58 kotarak: user.clj?

17:58 clojurebot: namespaces 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:58 slyphon: er

17:58 nDuff: ...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:58 slyphon: what is NamespaceOfFile?

17:58 like com.foo.bar ?

17:59 kotarak: nDuff: you specify them in your build.gradle. gradle will fetch them automatically: "dependencies { compile 'org.clojure:clojure:1.1.0' }"

17:59 slyphon: lemme try this test out on the one that's working

18:00 chouser: java.lang.IllegalArgumentException: No single method: getLookupThunk of interface: user.PKeywordLookup found for function: glf of protocol: PKeywordLookup

18:00 kotarak: nDuff: 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:00 * chouser stares, uncomprehendingly

18:00 kotarak: slyphon: no, the name of the command. It's verbatim.

18:00 slyphon: ohhh

18:00 kotarak: slyphon: ng vimclojure.Nail NamespaceOfFile < src/clojureql/query.clj

18:00 slyphon: duh

18:00 kotarak: clojureql.query

18:00 slyphon: ok 2 sec

18:01 rhickey_: chouser: what are you trying to do?

18:02 :on IKeywordLookup ?

18:02 chouser: yes

18:02 (defprotocol PKeywordLookup :on-interface clojure.lang.IKeywordLookup (glf [o k] :on getLookupThunk))

18:02 nDuff: kotarak, 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:03 chouser: :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:03 rhickey_: 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:03 maxhodak: hiredman: do you mind if i use your sig calculating method and name|str?

18:03 rhickey_: i.e. user.PKeywordLookup

18:04 nDuff: kotarak, fixing up GRADLE_HOME resolved things; apologies for the noise.

18:04 maxhodak: hiredman: i don't now what kind of license gists are released under :p

18:04 hiredman: maxhodak: please enjoy

18:04 maxhodak: know*

18:04 slyphon: kotarak: ok, i'm confused, i do ng vimclojure.Nail NamespaceOfFile < blah.clj and it throws ClassNotFoundException: vimclojure.Nail

18:04 maxhodak: hiredman: thanks

18:04 slyphon: but (in the project where i got this to work) i can fire up vim and start the repl

18:04 kotarak: nDuff: np

18:05 slyphon: vimclojure jar is missing from the classpath

18:05 slyphon: on which side?

18:05 chouser: I 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:06 rhickey_: the protocol itself includes: :on-interface clojure.lang.IKeywordLookup, :on user.PKeywordLookup

18:06 slyphon: kotarak: i'm pretty sure the ng daemon has it on its classpath, vim is able to talk to ng and start the repl

18:06 chouser: you're saying that second one shouldn't be there?

18:07 kotarak: slyphon: argh. try ng vimclojure.NamespaceOfFile < source.clj

18:08 chouser: hm -- specifying IKeywordLookup as both :on and :on-interface does seem to get me further.

18:08 No implementation of method: :glf of protocol: #'user/PKeywordLookup found for class: <the class of "o">

18:08 suggesting my "extend" is wrong

18:09 kotarak: slyphon: argh2.0. try ng de.kotka.vimclojure.nails.NamespaceOfFile < source.clj

18:09 slyphon: ok :)

18:09 ok, that worked for the working project

18:09 * slyphon goes to check for the non-working project

18:09 chouser: that error is when I do (glf o :my-key)

18:11 oh!

18:11 got it.

18:11 so now (glf o :my-key) works.

18:11 rhickey_: ooh

18:12 slyphon: and now it works

18:12 wtf

18:12 * slyphon is confused

18:12 chouser: rhickey_: so to make this work, I need to do that defprotocol in clojure itself, and change calls from (.getLookupThunk ...) to (get-lookup-thunk ...)?

18:13 slyphon: kotarak: well, thanks! the NamespaceOfFile thing is a good way to test to see if the classpath is correct

18:13 rhickey_: chouser: ?

18:13 which defprotocol?

18:13 slyphon: kotarak: does vimclojure actually shell-out to the ng file?

18:13 chouser: (defprotocol PKeywordLookup :on-interface clojure.lang.IKeywordLookup (glf [o k] :on getLookupThunk))

18:14 rhickey_: where were you doing it?

18:14 chouser: rhickey_: just at the repl

18:14 rhickey_: oh, still in Clojure the language

18:14 chouser: heh

18:14 yes

18:14 slyphon: Clojure the Flamethrower! (the kids love it)

18:15 and, of course, Clojure 2: The Search for More Money

18:15 rhickey_: yeah, could be a patch to core-deftype

18:15 kotarak: slyphon: yes

18:15 slyphon: kotarak: would it put an error in :messages if it couldn't find the ng binary?

18:16 kotarak: slyphon: shell out is the only thing vim does in a half way portable and stable way

18:16 chouser: presumably 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:16 slyphon: kotarak: yeah, sometimes i wish vim was implemented in elisp

18:16 vimscript is a horror

18:16 kotarak: slyphon: not sure. You either need ng on your path or defined in your .vimrc: "let vimclojure#NailgunClient = 'path/to/your/ng'"

18:16 slyphon: ah, right

18:17 ok, well, it's working now, thanks for taking the time to help

18:17 and for writing the thing in the first place :D

18:17 kotarak: slyphon: but more powerful than you would think http://tr.im/PORA

18:18 slyphon: you are welcome. Glad it worked in the end.

18:34 maxhodak: hiredman: thanks for the input earlier; this is the result: https://github.com/myfit/clj-facebook

18:35 the-kenny: Isn't the use of single-element namespaces discouraged?

18:36 Raynes: the-kenny: Strongly.

18:37 the-kenny: maxhodak: 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:38 maxhodak: the-kenny: and the filetree would become src/facebook/client.clj?

18:38 the-kenny: maxhodak: Yes

18:38 Raynes: Yes.

18:39 maxhodak: ok

18:40 i'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:40 rather than having all of those methods hanging like that

18:55 how do you pull the latest clojure.contrib?

18:55 im trying to use stuff in the github master that isn't in 1.1.0

18:55 (like clojure.contrib.string)

18:56 er, nevermind, it's in 1.1.0 just reorganized

19:31 kwertii: Is there a way to un-memoize a function that's been (memoize)d?

19:32 (or rather, to dump the memo state so that it'll be rerun and re-memoized)

19:33 more 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 _ato: there's no builtin way

19:33 technomancy: kwertii: no, it's hidden in a closure

19:33 _ato: best option is probably to write your own momoize function

19:33 technomancy: you could reimplement a reversible memoize

19:33 _ato: jinx?

19:34 jcromartie: Is there any progress towards better errors in slime?

19:35 kwertii: is 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:35 jcromartie: i.e. *e is much more useful than any stacktrace that slime has every showed me.

19:35 * the-kenny judt got the idea of using C-c I RET *e RET for debugging

19:36 a_strange_guy: kwertii: if the old (memoized) function is bound in a closure (in a lazy-seq maybe) then it wont get collected

19:37 kwertii: a_strange_guy: hm, interesting.

19:38 technomancy: jcromartie: vague plans, nothing much

19:38 the latest version dims irrelevant lines for you

19:38 jcromartie: but at least I know about *e :)

19:38 so that gets me further

19:38 also I found clojure.stacktrace today

19:39 but that still has some of the same issues as the regular slime stack trace

19:43 a_strange_guy: kwertii: you could use the new metadata on fns to make the atom visible and reset!-able from outside

19:43 i'll sketch that up

19:44 kwertii: a_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:44 a_strange_guy: your version is much simpler :)

19:45 a_strange_guy: clojurebot: paste

19:45 clojurebot: lisppaste8, url

19:46 a_strange_guy: forgot that it's broken

19:46 kwertii: here: http://gist.github.com/315254

19:46 kwertii: a_strange_guy: awesome, thanks

19:47 a_strange_guy: metadata on fns got really useful :)

19:49 kwertii: functions can actually access their own metadata

19:50 ,((with-meta (fn self [] (meta self)) {:meta 1}))

19:50 clojurebot: java.lang.UnsupportedOperationException

19:50 a_strange_guy: ... in 1.2

19:50 xD

19:51 kwertii: ah yes, just got that too

19:51 a_strange_guy: metadata to fns got added in master a month ago

19:52 ,(clojure-version)

19:52 clojurebot: "1.1.0-master-SNAPSHOT"

19:52 kwertii: O

19:52 I'm on plain "1.1.0"

19:53 same thing

20:01 a_strange_guy: http://gist.github.com/315268 <- hack with magic :reset! flag to work on versions of Clojure without metadata on fns

20:17 jcromartie: So does this count as "declarative" validation? http://gist.github.com/314809

22:36 defn: http://www.youtube.com/watch?v=5J0t-Fgn6AE

23:09 crowbar7: Awesome video

23:19 brandonw: lein 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:20 for 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:20 s/is/are

23:21 was going to say is there any documentation

23:21 then my brain turned off for a word :)

23:32 dnolen: brandonw: 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:40 konr: my godness, haskell is complicated

23:48 brandonw: is 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:49 konr: I think it already does that, checking for updates once in a while

23:49 brandonw: i 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:49 but that is only if i specify the snapshot

23:50 i 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:52 konr: Hmm, I don't think so, at least if they are in the right directory. Is it happening to you?

23:53 jcromartie: hey, what do I need to do to get this working http://clojars.org/org.clojure/clojure-http-client

23:53 (lein-wise)

23:53 brandonw: konr: what is the "right" directory?

23:53 jcromartie: lein deps gives me a load of maven errors when I add http-agent

23:53 org.apache.maven:super-pom:jar:2.0

23:54 brandonw: i have a dir containing clojure checkout, and a synlink from a bin directory to the launcher in clojure.contrib checkout

23:54 s/syn/sym

23:55 should i not even be using the git checkout, and just using the lein ~/.m2 clojure & clojure.contrib snapshots?

23:55 konr: jcromartie: did you add it to your :dependencies vector on project.clj?

23:55 jcromartie: yes

23:55 just like every other dep

23:55 except this one bombs

23:55 brandonw: jcromartie: i actually am having a problem with that too

23:55 except for lein-nailgun

23:56 konr: brandonw: hmm, project/lib/ - the jars should all be there

23:56 jcromartie: clojure, c.c, congomongo, compojure, enlive all work

23:56 but http-agent does not

23:56 brandonw: same thing: it gives an error: Path to dependency: 1) org.apache.maven:super-pom 2) org.clojure:clojure

23:56 JonSmith: there's also clj-apache-http

23:56 if you don't have luck with the other one

23:56 jcromartie: the error dump: http://pastie.org/843684

23:57 JonSmith: can also go low tech and go to the git repo and do it manually

23:58 jcromartie: I'm surprised it's not in clojars http://clojars.org/search?q=clj-apache-http

23:58 konr: brandonw: personally, I always use lein to keep a current version of clojure and clojure.contrib

23:59 jcromartie: lein makes me happy

23:59 konr: brandonw: if you plan to use git to mantain the versions updated, perhaps it would be better to remove them from :dependencies

23:59 JonSmith: http://github.com/rnewman/clj-apache-http

23:59 jcromartie: yah

23:59 brandonw: konr: 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:59 JonSmith: http://github.com/technomancy/clojure-http-client

Logging service provided by n01se.net