#clojure log - Sep 20 2010

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

0:03 sproust: I've learned to clean up namespaces when things go wrong, using (remove-ns) and (ns-unmap).

0:03 Now... is there a way to remove or replace dispatching defined with (defmulti) ?

0:03 cemerick: sproust: remove-method?

0:04 Raynes: cais2002: It makes no difference.

0:05 sproust: cemerick: no, I want to redefine the dispatch function itself.

0:05 cemerick: ah

0:05 sproust: cemerick: sproust = blais from the meetup.

0:05 cemerick: heh, yeah, I remembered this time :-)

0:05 I think defmulti is the only way to swap out the dispatch fn

0:05 Raynes: sproust: You'd need to unmap the defmulti or something equally destructive and then redefine it.

0:06 sproust: Raynes: if I (def <methodname> nil), and then redefine, it appears to work.

0:06 cais2002: Raynes: suppose defmulti is in nsA, implementation 1 is in nsB, implementation 2 is in nsC, and the caller is in nsD, how does the caller specify the imports when it might use both impl 1 or 2

0:07 Raynes: You'd want to require nsB and nsC.

0:07 cemerick: sproust: That's also blowing away your methods.

0:07 sproust: I like it.

0:07 cemerick: Yeah, if it works, it's good.

0:07 sproust: cemerick: defmulti eval'ed multiple times won't clear it

0:08 cemerick: Oh, I see what you mean.

0:08 sproust: cemerick: does it do it in your environment?

0:08 cemerick: Yeah, that's an optimization issue.

0:08 or, a side effect of an optimization, I should say

0:09 Note that if it's a multimethod that you'd like to swap the dispatch fn out of while retaining methods (potentially contributed from various namespaces in different libraries), those contributed methods are gone when you unmap and re-defmulti.

0:11 sproust: Oh macroexpand shows why; I see what you mean by the optimization.

0:12 cemerick: is there a way to swap out the dispatch function without destroying the MultiFn object? That would be a nice function to provide in the core.

0:12 cemerick: sproust: Nope, the dispatchFn field is final in MultiFn.

0:13 sproust: Man I like how the source for the VM code itself is so simple.

0:13 cemerick: I'll bet that will never be changed.

0:14 sproust: Actually, the reason I got started on this multimethod stuff tonight is related to your book.

0:14 cemerick: sproust: you can easily work around that limitation by routing dispatch through a fn in an atom.

0:14 It's such an edge case, that that's a reasonable fallback -- I'll bet the final designation for the multifn field is important.

0:14 sproust: oh?

0:15 sproust: I was reading PC and saw the example using creatures, and I thought rock-papers-scissors might be a good example too so I set out to hack something to make the reading stick, and I thought I'd send it over as a suggestion.

0:15 Raynes: sproust: http://gist.github.com/587417 Hackery.

0:15 Er, I gisted too much.

0:15 Curse you, gist-buffer rather than gist-region!

0:15 sproust: Midway I realized I was being silly and I don't know anything about anything, and now I'm here asking questions haha :-)

0:15 Raynes: Look at the bottom of the gist.

0:16 cemerick: sproust: :-)

0:16 Raynes: http://gist.github.com/587419 for those too lazy for scrolling.

0:16 cemerick: sproust: BTW, check out the emacs UX discoverability in action over there with Raynes' memory failing him... ;-) :-D

0:16 (that timing was simply too perfect)

0:16 sproust: It's quite a gistful indeed.

0:17 Raynes: :>

0:17 cemerick: Raynes: no worries, I'm just poking sproust re: a discussion we were having last week about emacs vs. eclipse (for example) UI issues.

0:18 sproust: cemerick: he probably did it in a key combination, whiile you were still reaching above the penalty zone for the mouse.

0:18 prrrrtt ;-P

0:18 Raynes: M-x gist-buffer

0:18 cemerick: lol

0:18 Raynes: Should have been gist-region.

0:18 Or, I should have just deleted that buffer after I gisted the former part of it hours ago.

0:19 sproust: gist-buffer is dangerous... imagine if you'

0:19 tomoj: what's discoverability?

0:20 sproust: d had all your credit card numbers above, from doing all your banking within Emacs?

0:20 Raynes: sproust: That's why I always go to a special buffer that I usually create on the fly when I need to gist something.

0:20 cemerick: tomoj: I think it was supposed to make it into emacs 16, but has been put on the back burner since then.

0:20 Raynes: I'd never 'just happen' to try to gist something in a buffer that contained information like that, thanks to habits.

0:20 sproust: tomoj: I think cemerick means that Emacs can't be figured out by examining menus and buttons. But... there _is_ the mighty C-h...

0:21 tomoj: yes, C-h seems like great discoverability to me

0:21 I just habitually use -privately

0:21 er, -private

0:23 cemerick: sproust: It's like a piece the Onion would write about emacs. "Now for those that aren't familiar with odd keystrokes and command strings, there's C-h...!"

0:23 sproust: Raynes: that #' trick i mesmerizing me. What's this var-quote business? [digging in the books]

0:23 Hahah that's true :-)

0:23 Raynes: By the end of this month, I'll be so impatiently waiting for October 21st that I'll be sleeping on my packed luggage.

0:24 tomoj: the tutorial explains how to get help

0:24 Raynes: ->(#'identity "blah")

0:24 sexpbot: ⟹ "blah"

0:24 cemerick: tomoj: Don't mind me, I was just picking the scab on a fun discussion sproust and I had last week. :-)

0:24 Raynes: When you call a var, it calls the function that is stored in it. Assuming a function is stored in it.

0:25 Er, returns the value that is stored in it.

0:25 cemerick: That's an impl detail, but it's so useful and so widely-used that I'm sure it'll never change.

0:25 Raynes: That makes more sense.

0:25 tomoj: I'm just wondering what 'discoverability' means.. sit down at the app for the first time and start using it easily?

0:25 Raynes: I think, anyway. Vars confuse me. :)

0:26 sproust: cemerick: I type C-h and then I wait 2 seconds, and it says "Type ? for further options". I type "?" and I get a buffer that looks like this: http://pastebin.org/973369

0:26 cemerick: tomoj: lots of material on this; http://rickosborne.org/blog/index.php/2007/04/19/usability-vs-discoverability/ is a good start?

0:26 sproust: yeah, that's *not* discoverability. That's a command reference.

0:27 tomoj: aha

0:27 sproust: Hehehe :-) Maybe you're right. I just know have all this weird automation in my fingers, I don't even know what I type half the time.

0:27 tomoj: yes emacs sucks at discoverability

0:28 Raynes: sproust: Also, #'name -> (var name)

0:28 cemerick: Jacob Nielson had a great writeup on the concept, though I'm not finding it instantly right now.

0:28 tomoj: oh, and he even says so: "Emacs is a paragon of usable, but just about as un-discoverable as you can get."

0:28 cemerick: Tufte talks about it frequently.

0:29 tomoj: heh, so he does -- I didn't read that far down :-)

0:29 Raynes: cemerick: Maybe I can dazzle you with my subpar Emacs skills and convince you to convert.

0:29 sproust: tomoj: the fantastic book The Humane Interface screams emacs the whole time too, about usability.

0:30 cemerick: Raynes: I'm an immovable body in that regard. :-)

0:30 sproust: Raynes: you don't have to-- it's just like LISP, he's inedubitably headed that direction anyway.

0:30 Raynes: sproust: He's pretty stubborn.

0:30 cemerick: ha!

0:30 Raynes: If he wasn't I'd be sitting at home twiddling my thumbs during the Conj next month. :>

0:31 cemerick: Raynes: it's not *my* fault that I'm already right about various things ;-)

0:31 sproust: Raynes: you could tell at the meetup, he's way too smart to diss Emacs without twitching. He knows he's just postponing the inevitable.

0:35 amalloy: cemerick: emacs is calling you...i was unwillingly converted not too long ago, and now my fingers are allergic to the arrow keys

0:36 Raynes: One day, he'll be sitting there with his Apple keyboard, and he will look down at his control key. A tear will slide down his cheek...

0:36 cemerick: amalloy: people have been banging on me off and on for almost 15 years now. I think I might be a hopeless cause.

0:37 Jeebus, that makes me sound old.

0:37 amalloy: but we couldn't give up on you. never leave a man behind for the zombies to get at

0:37 Raynes: What, nobody has made a remark about control being switched with caps lock yet?

0:38 amalloy: oh! i did that literally three days ago

0:38 Raynes: I was actually fine with control being control. A friend convinced me to try it for two weeks, and I got used to it.

0:38 amalloy: i just make them both ctl. i never want caps anyway, and this way it's a gentler induction period

0:39 Raynes: amalloy: I use caps a lot.

0:40 sproust: amalloy: get an HHKB, perfect geometry, and the mouse is *right* next to the enter key. Minimal movement. They have sexy models now without any key markings.

0:40 tomoj: Raynes: I friend convinced you to revert from caps<->control switching?

0:40 er.. a friend

0:41 Raynes: No.

0:41 sproust: perfect companion to Emacs: http://elitekeyboards.com/products.php?sub=pfu_keyboards,hhkbpro2&pid=pdkb400b

0:41 Raynes: A friend convinced me to switch.

0:41 I haven't reverted.

0:41 Like I said, I got used to it.

0:41 sproust: Now *THAT*'s discoverability!

0:41 Raynes: I didn't have any problem with it being ctrl before though.

0:42 tomoj: HHKB has tilde all the way up in the right upper corner?

0:42 Raynes: ah, I see

0:42 Raynes: I wish the tilde was closer to the enter key. :(

0:42 Don't feel like moving it.

0:56 sproust: Raynes: the fact that defmult accepts a function object, or a var to one, is that widespread?

0:57 Oh, no, I guess it's in the call application itself.

0:57 Raynes: I haven't seen many people pass vars to defmulti. It would probably be a better idea to use an atom, as cemerick alluded to.

0:57 sproust: ,(let [bli identity] (bli 24))

0:57 clojurebot: 24

0:57 sproust: ,(let [bli #'identity] (bli 24))

0:57 clojurebot: 24

0:58 Raynes: What http client are people using these days?

0:58 I've heard of about 50 come out in the last month.

1:00 sproust: ,(let [bli (atom identity)] (bli 24))

1:00 clojurebot: java.lang.ClassCastException: clojure.lang.Atom cannot be cast to clojure.lang.IFn

1:00 sproust: That won't do, you'd have to wrap it somehow.

1:01 Raynes: clj-http looks promising.

1:01 I think I'll take it.

1:04 The fact that deref is a function is helpful.

1:07 cemerick: sproust: just (defmulti foo #(apply @dispatch-fn-atom %&) will do

1:07 Raynes: Or you could do that.

1:07 ;)

1:17 sproust: Oh! %&, that's nice, didn't know it existed. Thx

1:35 technomancy: watch the language; family-friendly channel here

1:37 scottj: Is there javadoc integration built in to clojure-mode or slime now? (a keystroke to run clojure.java.javadoc/javadoc on thing at point)

1:48 technomancy: scottj: no; anything clojure-specific that wouldn't make sense in CL won't exist in slime

1:48 scottj: now that you mention it I've been thinking of creating a way to piggyback elisp inside swank-clojure plugins

1:50 scottj: swank-clojure plugins, cool

1:50 technomancy: totally a back-burner idea I've had for ages; may never get around to it

1:50 but it would make it a lot easier to enhance emacs since right now distributing elisp is a pain compared to clojars

2:58 LauJensen: Good morning all

3:00 bobo_: morning

3:29 amalloy: hi LauJensen

5:58 bartj: if c1,c2,c3 are collections

5:58 is there an in-built function which returns a vector of the corresponding elements ?

5:58 I currently do it using: (map (fn [a b c] [a b c]) c1 c2 c3)

6:04 zmila: ,(doc zipmap)

6:04 clojurebot: "([keys vals]); Returns a map with the keys mapped to the corresponding vals."

6:05 bartj: zmila, note that there are three collections, and I want to return a vector

6:05 zmila: yes, bartj. i see this is not you want

6:05 raek: ,(vec (list 1 2 3))

6:05 clojurebot: [1 2 3]

6:06 raek: (map vec c1 c2 c3) ; something like this?

6:09 ah, now I see what the map does...

6:10 bartj: raek, vec takes a collection no?

6:10 raek: there is also 'vector' which takes the elements as arguments

6:10 ,(vector 1 2 3)

6:10 clojurebot: [1 2 3]

6:10 raek: (map vector c1 c2 c3) will make a sequence of 3-vectors, taking one element from each collection each step

6:11 LauJensen: ,(map #(vec %&) [1 2 3] [4 5 6] [7 8 9])

6:11 clojurebot: ([1 4 7] [2 5 8] [3 6 9])

6:11 raek: ,(map vector [1 2 3] [4 5 6] [7 8 9])

6:11 clojurebot: ([1 4 7] [2 5 8] [3 6 9])

6:12 bartj: raek, LauJensen thanks!

6:13 LauJensen, this is the first time I am seeing a %&

6:13 %, %1, %2 I understand

6:13 LauJensen: bartj: yea I thought I'd take the opportunity to demo it :)

6:13 bartj: you know '& args' right? This is the same

6:13 bartj: LauJensen, oh ok thanks!

6:14 LauJensen: np

6:31 bartj: LauJensen, how do I get started on contributing to open-source Clojure projects (other than core/contrib of course?)

6:32 LauJensen: bartj: When I contribute to projects, its usually because they're missing something I want, so I email the maintainer a patch. Sometimes that leads to talks, which leads to me getting push rights.

6:33 bartj: LauJensen, In other words, which open-source Clojure projects are accommodating enough re: Clojure n00bs (comparatively speaking of course)

6:33 LauJensen, ok!

6:35 LauJensen: bartj: I think Clojure-land is so friendly, that if you send a patch which looks rough around the edges, most maintainers will tell you in a nice way, whats wrong and give a few pointers on what to do about it

6:50 bartj: LauJensen, I agree the Clojure community is very friendly...I'll just send in a patch I guess. :)

7:10 LauJensen: Swing Question: I have a Swing UI which has a JMenuBar at the top. The menu has 1 dummy menu and a menuitem which you can click to prepare a new UI which is then sent to (.setContentPane frame new-ui). When you click it, nothing happens. If you subsequently click the dummy item, the UI will update. Calling (.paint frame (.getGraphics frame)) after setContentPane does not force an update - Anybody know whats up ?

7:10 bozhidar: I've been hearing a lot of praise lately for "The Joy of Clojure", but noone ever mentions the other upcoming Manning title "Clojure in Action". Is that book that bad or it is that nobody bothered to take a look at it?

7:11 LauJensen: ah, stackoverflow's got my back: http://stackoverflow.com/questions/369823/java-gui-repaint-problem-solved

7:11 bozhidar: I haven't read it and I don't know Luke

7:12 bozhidar: LauJensen: the revalidate is tricky indeed. btw Luke wrote "Practical Clojure"

7:12 LauJensen: Oooh right, Clojure is Action is by Amit Rathore right? Haven't read that one either

7:13 bozhidar: I have "Practical Clojure" - it's not a bad book, but it's a bit too superficial

7:14 I'd love to see books that tackle real programming problems, because I find that the Clojure syntax is fairly easy to grasp, but getting your thinking work in a functional programming manner after many years of imperative is not that easy at all

7:15 LauJensen: I think the Clojure community, collectively will step out of easy mode within a year or 2. So far much work is being put into making entry easier for those yet unenlightened

7:16 bartj: bozhidar, I had a look at Table of Contents section of Amit's book and it had large section devoted to clojure in the industry

7:16 er, how does one go about creating a ticket in assembla - or do I need to have special privileges for that ?

7:17 bozhidar: bartj: yep, the TOC looks nice, but I was wondering if anyone had impressions from the book. All I could find in the web was one very short review which basically said nothing concrete

7:17 LauJensen: bartj: do it under 'support'

7:18 bozhidar: and there is some discount at manning these days 50% off if you buy books for more than 100$

7:18 convenient moment to extend one's clojure library...

7:20 LauJensen: bozhidar: I don't think there's ever been a moment, where manning didn't have some major discount :)

7:38 bobo_: dont think ive ever bought a book for more then 15$ from manning

7:51 sthuebner: I'm studying labrepl's mini-browser lab. Instructions assume that there's a html function in a compojure namespace. but there is no such function in compojure.

7:51 does anybody have any hint?

7:52 bobo_: sthuebner: i think labrepl uses compojure 0.3.2 and you 0.4.0

7:52 i belive (html is moved to hiccup

7:53 sthuebner: bobo_: my labrepl was pulled from git two days ago. project.clj and pom.xml refer to compojure 0.4.0

7:53 so, the instructions are outdated?

7:54 bobo_: it has hiccup included aswell.

7:54 but if it says html is in compojure, it might be outdated yes

7:54 sthuebner: yes

7:55 bobo_: where in the instructions are you?

7:55 sthuebner: mini-browser - layout

7:55 first paragraph

7:57 bobo_: it does include hiccup for the file

7:58 i think il let someone else that might know more answer this

8:00 sthuebner: bobo_: I'll find my way

8:00 thanks

8:26 solussd: ...as Lisp can be likened to a self-licking lollypop. nice.

9:00 Bahman: Hi all!

9:28 shoover: Bahman: Hello

9:28 bartj: Bahman, hey!

9:31 Bahman: He shoover, bartj!

9:38 zoldar: Hello. How can this function be simplified? http://pastebin.com/Dp3g3QBk thank you in advance for any pointers

9:46 LauJensen: zoldar: would this work ?

9:46 ,(map #(reductions vector %) [["Pictures" "Photos"] ["Downloads" "Stuff"]])

9:46 clojurebot: (("Pictures" ["Pictures" "Photos"]) ("Downloads" ["Downloads" "Stuff"]))

9:48 zoldar: LauJensen, almost, but I need it linearized - thanks for nice pointer anyway

9:48 didn't know about reductions

9:48 LauJensen: zoldar: If you really are looking for paths, you might want to check out file-seq

9:49 zoldar: LauJensen, I don't interact with File.io directly

9:49 LauJensen: k

9:49 blackrain: hi

9:51 LauJensen: yo

10:48 fbru02: hey guys how do you call a java function that receives no parameters??

10:48 mefesto: fbru02: an instance method?

10:48 chouser: java doesn't have functions. Do you mean a static method?

10:48 fbru02: mefesto: instance method

10:48 sorry

10:48 mefesto: (.methodName obj)

10:49 fbru02: ok , thanks, i wanted to double check my error must be somewhere else

10:54 mefesto: anyone know how the turn out looks so far for clojure-conj?

10:58 chouser: mefesto: I'm curious about that too. total slots available and number taken so far.

10:58 mefesto: chouser: I'm about to put in for some vacation time for this :)

10:59 chouser: I'm really looking forward to it.

11:12 v-alex: την κλήση της NodeLoad

11:13 fliebel: English? (or are you testing Unicode?)

11:14 v-alex: fliebel: really sorry about that, mixed the windows :(

11:14 fliebel: v-alex: It happens, which lang is it?

11:14 v-alex: greek

11:16 LauJensen: v-alex: you're greek? Hey you owe me money, love Europe

11:16 v-alex: LauJensen: lol, i'm paying, i'm paying

11:17 LauJensen: :D

11:17 fliebel: LauJensen: Can I ask you some stuff about bestinclass.dk? I'm trying to sort out some problems I ran into with Utterson.

11:17 LauJensen: hehe, Utterson, man thats a funny name

11:17 fliebel: yea sure

11:17 Ive got a few minz

11:18 fliebel: LauJensen: It;s the static site generator, and the friend of either Jakyll or Hyde :)

11:18 LauJensen: Yea sure :)

11:19 fliebel: The problem is that at the moment I'm just lazily parsing files and converting them to HTML. Then I realized I need stuff from the other files as well to generate indexes and menus. How do you solve this without an absurd amount of memory or disk IO?

11:20 I came up with one solution, but I would like to know how you did it as well.

11:22 LauJensen: fliebel: for indexes and menus, footers etc, if all thats static, put that in an outer template

11:24 fliebel: LauJensen: They are static, but the index would of course require all the pages in it, so either I'm storing all pages in memory or re-reading them. That is… with the current way things work.

11:24 LauJensen: fliebel: all the pages, or links to all the pages?

11:25 fliebel: LauJensen: If the index contains actual pages or at least excerpts, I need to parse all those pages.

11:26 LauJensen: Im guessing that its a small amount of data, so I would just hold it in memory if thats the case.

11:26 fliebel: LauJensen: So how are you generating index pages?

11:26 LauJensen: fliebel: Its a template like any other?

11:28 fliebel: LauJensen: How would I know that? I'm asking about you now. ;)

11:28 sproust: technomancy: I originally meant "%&" is nice. (Or more appropriately "%&" is really %&'ing nice ;-P )

11:28 LauJensen: fliebel: Im saying, to me it just sounds like a regular template, running clone-for on your data in memory

11:29 fliebel: LauJensen: So you do have the data of all the posts in memory when parsing?

11:29 LauJensen: fliebel: Just the excerpts

11:30 http://github.com/LauJensen/bestinclass.dk/blob/master/src/bestinclass/admin.clj#L144

11:30 When I publish posts, I build the index incrementally, you can do the same from the beginning

11:30 fliebel: LauJensen: So you parse all the pages and keep their excerpts in memory, but then, how do you generate hte individual file? You parse it again?

11:30 LauJensen: No, I prepend

11:31 That way you can handle one post at a time

11:31 fliebel: LauJensen: Yea… sounds like a sound plan.

11:31 LauJensen: brb

11:35 fliebel: LauJensen: It's more or less what I came up with. Don't generate all files at once, but just one and update the others. It makes me wonder how Jekyll does it. Because most of them us PHP style templates

11:35 LauJensen: Anyway, thanks for sharing :)

11:35 LauJensen: I have no experience with Jekyll.. np

11:35 fliebel: I'll take a look at it :)

11:46 LauJensen: It reads the whole site into memory, something I'd like to avoid. http://github.com/mojombo/jekyll/blob/master/lib/jekyll/site.rb#L68 http://github.com/mojombo/jekyll/blob/master/lib/jekyll/site.rb#L135

11:47 LauJensen: fliebel: So just do what I do, make a template with 1 entry, then prepend snippets onto that. The awesome thing about Enlive, is that you can treat your html like a database, ie "insert into html ..."

11:48 fliebel: LauJensen: Yea, that is what I figured out to. First I went like… Okay, lets put it in a database and request the parts I need. Then I realized all the parts I need are already fully rendered in my destination dir.

11:49 LauJensen: fliebel: Did you watch my latest screencast? I think I actually talk about this process in it

11:50 fliebel: I don't remember… You mean the one about your site, right? I think I did while doing other stuff at the same time.

11:50 LauJensen: Yea

11:52 fliebel: I do that a lot, put on a video and try to listen to it while coding. So maybe my idea form this morning was actually your idea stored in the back of my head :P

11:52 LauJensen: fliebel: Awesome, that way you can still take full credit :)

11:54 fliebel: The only downside of doing it my/your way is that I can't do the awesome Moustache hacking I'm doing now. While I use Moustache for the dev server, it also acts as a reverse-proxy to my templates, so I hand-craft requests to parse the files and read the response back to a html file.

11:54 LauJensen: because moustache is serving files?

11:55 fliebel: Oh well, maybe I could still use it.

11:56 LauJensen: Basically I set up Moustache to serve files for a given url, but it also takes the file name, so I just (doall (file-seq)) over the md files and craft a request to the dev server, not actually acting as a server in that case.

11:57 LauJensen: It's like I wrote a custom Ring adapter to request all possible urls and write them to files.

11:57 LauJensen: fliebel: I thought it was supposed to pre-bake this stuff? Why are you generating on requests

11:58 fliebel: LauJensen: I'm not, I'm doing something like wget url > file.html without actually runing a server.

11:58 LauJensen: ?

12:00 fliebel: LauJensen: Basically Ring is just a standard way to turn a request dict into a response dict. I'm just calling the Ring app directly for all md files and instead of sending the response to a server, I write it to a file.

12:01 *client

12:01 hiredman: dict? surely you mean map

12:01 LauJensen: dict?! :) Its called a hash-map

12:02 fliebel: I dont see the point in that approach, but that doesnt mean its not good :)

12:02 fliebel: LauJensen: Yea… Python user you see… Anyway, the advantages is not having to care about writing a dev server, and Moustache also handles the routing of md files to the correct template.

12:03 LauJensen: aha

12:04 fliebel: If you wanted to get nasty, you could let nginx check for the file, if it exists serve it, if not pass the request to a handler, then redirect back to the file.

12:05 fliebel: LauJensen: Why would you involve Nginx for a dev server? I'm using Jetty for that, since that is just one call away to Ring.

12:20 LauJensen: fliebel: Because it takes a couple of minutes to set up and I dont want the route from dev => prod to be too long

12:21 fliebel: LauJensen: But I'm not going to keep Moustache running like you do. It's going to be purely static.

12:21 LauJensen: Ok

12:21 Otherwise it wouldn't be Utterson :)

12:46 iwillig: does anyone know of a project for creating cron jobs in clojure ?

12:46 a wrapper for cron4j or something ?

12:47 i guess i mostly want a job scheduler in clojure

12:48 hiredman: ScheduledThreadPoolExecutor

12:48 iwillig: thats a java thing i am guessing (sorry new to the JVM)

12:49 thanks hiredman that looks like it could work

12:59 cemerick: iwillig: I think the javadoc mentions it, but executors are almost always created via the Executors class' static methods.

12:59 just FYI

13:00 tamps down the configuration work

13:03 jneira: hi people!

13:04 someone has readed my question in stackoverflow? http://stackoverflow.com/questions/3749313/how-could-we-create-instances-of-a-type-or-record-on-the-fly

13:05 my limited mind dont catch the kotarak and cgrand porposal :-(

13:06 *proposal

13:07 ,(Integer. 1)

13:07 clojurebot: 1

13:12 jneira: i wanted something like (create Integer 1) or (create My-Type {:a 1}) with a custom code initialization for each type

13:14 chouser: jneira: why is that better than (create-My-Type {:a 1}) ?

13:14 jneira: mmm

13:16 fliebel: jneira: You could use deftemplate to create loads of them maybe,

13:17 chouser: but if he wants custom code for each one, I don't see what is simpler or clearer than (defn create-My-Type [...] (My-Type. ...))

13:17 jneira: good question chouser

13:17 :-P

13:18 i suppose for the same reason you use a multimethod instead separate functions

13:19 fliebel: jneira: well, why not use a multimethod based on the type of class then?

13:19 I guess it's interesting to know if those classes have anything in common, or are just random classes.

13:22 jneira: yep fliebel i tried this but all methods are (defmethod return ContainerType [mvalue] (ContainerType. (:value mvalue) ))

13:23 i wanted something similar to return function of haskell monads

13:23 a dispatch on return type and no on params types

13:24 maybe it is a nosense ... :-/

13:37 jjido: I cannot add a "count" method in a protocol?

13:39 chouser: sure you can.

13:40 jjido: http://gist.github.com/586791

13:40 I get an error with "count" instead of "counts"

13:40 chouser: a warning?

13:41 jjido: Caused by: java.lang.IllegalArgumentException: No single method: count of interface: user.SimpleListProtocol found for function: count of protocol: SimpleListProtocol

13:44 chouser: It's probably not recommended anyway, since you're overwriting clojure.core's count in your namespace

13:44 but I'm curious what line that exception is pointing to.

13:48 dakrone: does swank-clojure work with 1.3-SNAPSHOT yet? I can't get a swank server started using 'lein swank'

14:35 stuarthalloway: I need to embed a compojure app inside another app. It will have its public directory in the jar file, and need to find it to serve static content. I know how to write the code to make this happen, but was wondering if this is already solved somewhere...

14:36 fliebel: Isn't Compojure just Ring?

14:36 stuarthalloway: under the covers, yes

14:36 fliebel: So is the problem the files or the wrapping?

14:37 stuarthalloway: the problem is that compojure and ring (at least in the simple usage I have done so far) assume a directory, not a resource in a JAR file in the classpath

14:37 LauJensen: stuarthalloway: Ring has a get resource stream from jar helper

14:37 kotarak: wrote a ring handler. But don't have it handy. (And I'm not sure about the quality either...)

14:37 LauJensen: lemme see if I can find it

14:38 stuarthalloway: ahah! ring has a separate fn resource-response that does what I need

14:38 LauJensen: yea thats the one

14:38 kotarak: Is there a reason, why lists don't use a modified vector internally?

14:38 fliebel: stuarthalloway: This gives you a path: (.getFile (.getResource (clojure.lang.DynamicClassLoader.) "something"))

14:39 technomancy: dakrone: there's been an issue reported with the new stack trace printing, but that's the only problem I've heard of with swank and clojure 1.3. haven't tried it myself.

14:39 LauJensen: fliebel: all that stuff is already wrapped in Ring

14:39 stuarthalloway: fliebel: yes, as I said, I know how to do it. I just don't want to write 5-10 lines of glue code if they already exist somewhere

14:39 fliebel: okay

14:40 stuarthalloway: which they apparently halfway do: ring has it, compojure doesn't expost it

14:40 dakrone: technomancy: I get http://gist.github.com/588399 when starting it

14:44 technomancy: dakrone: hrm... could you open an issue?

14:45 dakrone: technomancy: sure, will do

14:45 technomancy: thx

14:45 kotarak: With static method I can have primitive args?

14:45 LauJensen: stuarthalloway: Im not sure why its not there, but wrap-file simply needs to call response/resource-response instead of file-response on this line http://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/file.clj#L26 . I think I actually added that myself last time I needed it

14:45 stuarthalloway: LauJensen: yep, thanks!~

14:50 b6n: Hi Folks, does someone of you use vimclojure and had trouble compiling it? (java.lang.Exception: Unmatched delimiter: ) (backend.clj:171))

14:51 kotarak: b6n: this is due to a change in the reader syntax

14:51 Just a second

14:52 b6n: please try this: http://groups.google.com/group/vimclojure/browse_thread/thread/90e66f1c665e0be3

14:52 See links there.

14:54 chouser: kotarak: you mean like a reversed vector? I have no idea.

14:54 kotarak: I believe :static fns give you primitive args if you hint them as such.

14:55 kotarak: chouser: I'm playing around with vlists. It's much faster than lists for random lookup, but not close to a vector.

14:56 chouser: I guess a reversed vector would be indexed from the far end. Weird and not very useful, I'd guess.

14:57 kotarak: one would have to rewire rseq, peek and pop. Otherwise it could work as a vector. It would give (almost) the current list guarantees + fast random lookup.

14:58 chouser: then we'd have no collection that implements ISeq directly. Dunno if we'd miss that at all.

15:01 kotarak: chouser: me not. ISeq is an abstract view. It's not about datastructures. I was wondering, because the plain list seems - hmm - archaic? while the rest of clojure looks so sophisticated. I'm always afraid, that I miss something essential in such cases.

15:02 chouser: kotarak: I have no insight for you, except that some parts of Clojure are still simple or immature just because they were created when Clojure was much younger and rhickey had bigger fish to fry, and haven't caused enough pain for anyone to replace yet.

15:02 perhaps PersistentList is one of these.

15:02 kotarak: likely

15:02 chouser: or perhaps I'm also missing something essential.

15:02 :-)

15:02 kotarak: :)

15:02 */

15:03 woops

15:09 jjido: chouser: sorry I was away. Are you still around?

15:09 chouser: jjido: yup

15:10 jjido: when I define "count" for my protocol I get "Caused by: java.lang.IllegalArgumentException: No single method: count of interface: user.SimpleListProtocol found for function: count of protocol: SimpleListProtocol " when I call (count somevector)

15:13 line 125 in http://gist.github.com/586791

15:15 chouser: ah, because your count take 3 args and you're only passing one there.

15:17 ohpauleez: is the three quotes a standard style now?

15:17 or carry over from Python?

15:18 chouser: oh. heh, didn't even look at that. yeah, that syntax isn't correct but happens to not cause much harm at the moment.

15:21 jjido: ohpauleez: I can do multi-line with single quotes?

15:22 chouser: jjido: yep

15:22 jjido: chouser: no I am not using my count. I am using vector's.

15:22 chouser: that's what's actually happenening there

15:23 jjido: but you're not. you're using the one count in your namespace, which you overwrote when you defined 'count' with defprotocol

15:23 LauJensen: hugod: Did you get Critions GC stats under control ?

15:23 chouser: you should have gotten a warning when you did that.

15:23 jjido: chouser: you are right

15:23 Warning: protocol #'user/SimpleListProtocol is overwriting function count

15:25 I wish it would keep the old one around for when I deal with vectors...

15:26 chouser: jjido: you can use clojure.core/count if you want

15:29 b6n: kotarak: Thanks for the hint, now I got it working. And thanks for you effort making this! How I missed '*' and '.' :-)

15:30 kotarak: b6n: glad it helps :)

15:31 hugod: LauJensen: I haven't - not really touch criterium since we last spoke

15:32 LauJensen: hugod: Alright

15:32 hugod: busy on pallet - btw now with minimal arch support

15:32 LauJensen: uuuuh - I'll have to find an excuse to play with it one of these days :)

15:32 (I've only heard good things about it)

15:33 hugod: it has its supporters :)

15:33 LauJensen: Guess I should be a good contributing and work some on Criterion on then, its really too good just to rot :)

15:34 hugod: we're putting together some examples of deploying web apps with pallet

15:34 LauJensen: hugod: for which targets?

15:35 hugod: patches gladly accepted - I will get back to it at some point - I want to play with kernel distribution estimates, or whatever they are called

15:36 LauJensen: tomcat, haproxy, probably couch

15:36 LauJensen: hugod: You mentioned the last time that you wanted me to push into some branch other than master, did you set a name ?

15:36 hugod: man I would love to see a tutorial on tomcat. Or even write one, but I guess you'll be faster/better at it

15:36 hugod: LauJensen: work on master if you like - I'm not doing anything actively

15:37 LauJensen: tbatchelli is actually doing most of the hard work :)

15:37 LauJensen: hugod: I can imagine, he's a cool guy

15:39 hugod: LauJensen: indeed - he is presenting pallet to the bay area group (in october I think)

15:39 LauJensen: yea, you guys do too few events in Europe :)

15:39 But then again, Denmark IT wise might be comparable to the US in the early 90s

15:40 hugod: when I get cloudhoist up and running, I promise to demo in denmark :)

15:40 jclouds is doing a workshop with pallet at ørdev

15:42 kotarak: hugod: is criterium on clojars up to date?

15:42 hugod: kotarak: I believe so

15:42 kotarak: ok, thx

15:43 LauJensen: hugod: Alright Just note that Øredev isnt in Denmark

15:43 kotarak: criterium is the Haskell version though?

15:43 kotarak: LauJensen: no. criterion is the Haskell version.

15:44 hugod: LauJensen: I realise that, but it counts as Europe though?

15:44 LauJensen: Wow, my mind had run rseq on itself

15:44 hugod: sure :)

15:44 hugod: LauJensen: could you update criterium to 1.2 release ?

15:45 jjido: I used (def cljcount count), still getting a warning though.

15:45 LauJensen: hugod: I dont have an overview of what entails

15:45 hugod: LauJensen: ok, no problem :)

15:45 worth a try...

15:46 LauJensen: yea, its not that I dont want to, but I just need to re-read the source

15:46 also - Until Conj Labs Frankfurt is complete, Im not seeing a lot of sparetime ahead of me :)

15:51 mrBliss: Can someone come up with a good name for a function that has the following docstring:

15:51 "Returns the longest subsequence of indices for which the following statement is true: for all i, j in subsequence: (f i) = (f j) != nil"

15:52 LauJensen: mrBliss: If its for Common Lisp, simple replace all spaces with dashes in the docstring, and thats the name

15:52 kotarak: Wow. Criterium seems cool.

15:53 Although I'm not a microbenching fan.

15:53 mrBliss: LauJensen: haha. I currently have longest-equal-subseq-for

15:53 ohpauleez: LauJensen: hahaha

15:53 LauJensen: mrBliss: take-indices-while

15:53 ohpauleez: mrBliss: isn't that just lcs?

15:55 mrBliss: ohpauleez: no, should I gist the source for clarification?

15:55 (btw args are [f indices])

15:56 hugod: kotarak: thanks - its a little slow, and the memory thing LauJensen was refering to needs fixing, but it is useful as is

15:56 ohpauleez: is it a filtered-lcs? or are you just filtering, and returning the indices, or the subsequence of values

15:56 hugod: kotarak: just pushed a version using clojure 1.2 release

15:56 kotarak: hugod: oeh, the one from March 8th worked for me with 1.2?

15:57 mrBliss: ohpauleez: http://gist.github.com/588542

15:57 ohpauleez: mrBliss: thanks, let me take a look

15:57 hugod: kotarak: its been using 1.2 for a while

15:57 just not the release version...

16:06 ohpauleez: mrBliss: I would just name it in the context it's being used. The name is long, but fine. Typically, you want to use clojure-esque verbs

16:07 jjido: what is another name for "->"?

16:07 ohpauleez: jjido: sometimes it's called lacing or threading a call

16:08 mrBliss: ohpauleez: I'm writing connect 4, so it's not an api function

16:09 ohpauleez: jjido: maybe "The form threading macro")

16:09 jjido: I write all the time: (-> obj (method args (fn [result] (->...again the same

16:10 ohpauleez: you can use, doto

16:10 as in (doto obj (form1) (form 2)... (form n))

16:11 jjido: ohpauleez: it would be (doto obj (method args (fn [result] (doto...

16:12 ohpauleez: jjido: let me get you can example

16:13 jjido: http://stuartsierra.com/2010/01/03/doto-swing-with-clojure

16:13 jjido: ohpauleez: yeah, cool but it does not help with CPS style

16:15 ohpauleez: jjido: It really just depends on stye. Typically I only use the form-thread for things that would have be new Reader(new Stream(myObj.getStream()))

16:15 or something to that affect

16:15 otherwise, I use let, functions, and (typical-func args (one-more-func args))

16:16 jjido: What is CPS?

16:17 LauJensen: hugod: Since you're going to Sweden I just want to prepare you. This video summarizes everything I know about Sweden: http://www.youtube.com/watch?v=qq6iEKVLzWY just watch the first minute or so

16:18 jjido: What I would like is (something obj [(partial method args) (partial method2 args) (partial method3 args)]) which should give (-> obj (method args (fn [result] (-> obj (method2 args (fn [result] (-> obj (method3 args)))))))

16:18 ohpauleez: continuation passing style

16:19 hugod: LauJensen: I'm not going :) @jclouds is doing the workshop - I remember sweden much more reserved than that :)

16:20 jjido: I forgot the name of the result variable(s)

16:22 ohpauleez: jjido: Ahhh you might want ->>

16:22 for the entire statement

16:22 jjido: (cps obj [(method1 args [results1]) (method2 args [result2]) (method3 args [result3]))

16:22 ohpauleez: ohh, nvm

16:23 you have three sets of results, all need to get passed to different functions, but passed into one vector

16:24 well, I would use destructuring for that, in a let, and then return the cps call

16:25 jjido: ohpauleez: help me with destructuring/and back?

16:26 ohpauleez: totally, I was already working on an example :)

16:31 jjido: Still some repetition, not the best style, but here's the idea: http://gist.github.com/588586

16:32 jjido: ohpauleez: and about "cps"?

16:32 ohpauleez: jjido: not really destructuring, just let.

16:32 cps is a function call, right?

16:32 ohhh continuation passing style

16:33 jjido: ohpauleez: there is a real example at the bottom of: http://gist.github.com/586791

16:38 ohpauleez: jjido: That's how you do callbacks, inline continuations

16:39 jjido: ohpauleez: yes

16:39 ohpauleez: so wait, did you have a problem? or you just wanted to know the name of the macro

16:39 haha

16:40 jjido: sorry for the run around here :)

16:40 jjido: ohpauleez: syntax problem. I am opening too many pars and not closing them

16:43 ohpauleez: ahh, sorry about that

16:47 chouser: jjido: do you need real nesting so you can use outer locals?

16:49 jjido_: chouser generally yes but I can work around it

16:50 chouser: and the next fn form can appear anywhere and at any level of the current form. :-/

16:51 cemerick: technomancy: was the switch to EPL for swank-clojure simply to make it compatible with clojure itself? Google groups isn't giving up the thread I remember seeing about the license change.

16:51 chouser: something like: (cps-> #(instance SimpleListClass __ logException) #(associate % "Hello" 1 __ logException) (fn [value next] (println value next)))

16:52 ?

16:53 jjido_: chouser: the logException part is always the same, can be inserted later

16:53 if it differs I can fall back to standard clojure

16:54 cemerick: technomancy: nm, found that gg thread

16:54 technomancy: cemerick: more or less, yes

16:56 chouser: jjido_: (defmacro cps-> [& exprs] (reduce (fn [inner step] (clojure.walk/postwalk-replace {'__ inner} step)) (reverse exprs)))

16:57 not sure the -> in the name is appropriate

16:59 jonnyb`: hi

16:59 i just upgraded my lein from some ancient version

17:00 now "lein swank" s not working anymore

17:00 how can i start my swank server now ? :)

17:01 bobo_: jonnyb`: do you have :dev-dependencies?

17:01 or the or swank-clojure.jar in ~/.lein/plugins

17:02 jonnyb`: i thought it was in there, yes but i have a look again

17:02 thanks!

17:02 bobo_: if you put the jar in .lein/plugins it will work on all projects

17:03 jonnyb`: my lein/plugins is empty, is there some "automatic" way to get in there?

17:03 bobo_: dont think so

17:03 god old fashioned copy :-)

17:03 jonnyb`: ok, thanks, i'll look for it :)

17:06 technomancy: it'll be automated for the next release

17:08 jonnyb`: it's running, thank you a lot!

17:19 ivey: technomancy: you already have code in progress for doing that?

17:19 if not, i may be interested in tackling

17:19 a plugins.clj that lists which ones I want, and then auto-update, or something

17:26 technomancy: ivey: thanks; colin jones is on it. see the lein mailing list... he may like help if you want to chime in.

17:27 ivey: i'll clone and take a look

17:27 thanks

17:43 jjido: chouser: I can't figure what I need to write to use cps->

17:46 ah... I think I understand

18:20 amalloy: technomancy: the ~/.lein/plugins is a new feature in 1.3?

18:21 i was trying to use it and it wasn't working, till i upgraded to 1.3. might want to mention that in an FAQ or something

18:27 technomancy: amalloy: it's in the release news; I'm not sure there's another place to put info like that without making the documentation extremely verbose

18:27 there's a reason "lein upgrade" was made so easy to do

18:28 ={

18:28 err =)

18:29 amalloy: technomancy: yes, it was certainly a painless operation once i realized i needed to perform it (modulo the terrible internet connection i used to download the jars)

18:29 jjido: what am I doing wrong? http://gist.github.com/588764

18:42 chouser-- I don't get it :'-{

19:01 amalloy: jjido: not really an expert at this, but it looks like your cps macro doesn't return a function? in that case trampoline will be complaining that the list it creates isn't a function

19:02 which seems to at least match with the error message

19:03 jjido: heh.... it looks like the replace directive in the macro is for __

19:04 so I should not quote it

19:05 http://gist.github.com/588764

19:26 Spreadsheet_: What's the most supported framework for clojure?

19:29 ivey: Spreadsheet_: web framework you mean?

19:29 Spreadsheet_: ivey: Yes

19:31 kotrin: Spreadsheet_ : ring/compojure

19:31 Spreadsheet_: kotrin: thanks

19:31 Have any major websites been written in it?

19:41 laurus: Does anyone know a good way to open a PDF in a GTK window in Clojure?

19:41 I've taken a look at this GTK code sample and it's simple enough to make the window (http://paste.lisp.org/display/69927)

19:41 But I'm not sure about opening the PDF inside

19:48 replaca: Q: when using deftype (defprotocol, etc.), what's the prototyping procedure from slime? Can I just (use ...), do I have to (import ...), or do I need AOT compiling?

19:49 * replaca feels very behind the curve

19:57 laurus: When I run "(java.awt.Desktop/open hello.pdf)" I get "java.lang.ClassNotFoundException: hello.pdf". I thought the syntax was (Classname/staticMethod args*)... what am I doing wrong?

19:59 ivey: laurus: one thing wrong is that you need hello.pdf as a string "hello.pdf"

20:00 laurus: ivey, thanks. Now I get java.lang.IllegalArgumentException: No matching method: open.

20:00 ivey: yeah that was the end of my helpfulness :-)

20:00 laurus: Heh ok :)

20:00 Thanks though!

20:01 I'm just trying to test something

20:01 I'm a total beginner at Clojure and this is way out of my knowledge base

20:01 ivey: oh

20:01 open wants a File not a string

20:01 laurus: Ah... right. This is Java. :P

20:02 What's the simplest way to open a file in Clojure?

20:03 vacho: laurus: What platform?

20:03 ivey: -> (java.io.File. "/etc/passwd")

20:03 sexpbot: java.lang.SecurityException: Code did not pass sandbox guidelines: ()

20:03 ivey: heh

20:03 laurus: Hahaha

20:03 Ok!

20:03 vacho: open a file or run a script?

20:04 laurus: Yuck, it's still not working.

20:04 vacho, open a file

20:04 amalloy: laurus: also take a look at clojure.java.io. i haven't tried it out, but i bet it works moderately well

20:04 vacho: laurus: win,macos or unix?

20:04 laurus: Now I have (java.awt.Desktop/open (java.io.File. "guide.pdf")), but it still failed.

20:04 vacho, Unix

20:04 vacho: laurus: I am fairly new myself..but I am using cljr

20:04 laurus: vacho, me too

20:04 But I'm talking about opening a file inside of a REPL

20:05 As an object.

20:05 vacho: there is a command for that

20:05 include file or something like that

20:05 laurus: vacho, not a source file, like, a PDF

20:05 vacho: ohh..no idea sorry

20:05 maybe java IO

20:05 laurus: No problem :)

20:05 ivey: laurus: I don't know (open) enough to know why, but the File. is def. making a new file

20:05 tested it at the repl

20:05 laurus: ivey, yes, that part is definitely working

20:05 amalloy: laurus: clojure.java.io makes this fairly easy

20:06 laurus: amalloy, how do I call a static method of a Java class in Clojure?

20:06 amalloy: user=> (use '(clojure.java io))

20:06 user=> (file ".")

20:06 #<File .>

20:06 laurus: amalloy, oh, that's even better :)

20:06 But how do I call the static method and pass that file object now?

20:06 jjido: We should add chouser's macro to core clojure. I call it "feed", or _>_. it helps a lot! example: http://gist.github.com/588764

20:07 abrenk: laurus: Derander

20:08 laurus: Desktop#open is not static

20:08 laurus: abrenk, oh, wow, my fault

20:08 :P

20:08 abrenk: laurus: ignore my fist line...

20:08 laurus: abrenk, no problem, the second is very valuable :)

20:08 abrenk: laurus: you need to call Desktop#getDesktop and then open on that

20:08 laurus: abrenk, ah, thank you, very much

20:09 abrenk: and check if Desktop#isDesktopSupported returns true

20:09 amalloy: laurus: but if it *were* static, your way of calling it would have been right :)

20:10 laurus: amalloy, that's good to know, I thought I was going bonkers

20:10 :P

20:11 Holy cow, it worked!!

20:11 Now that is seriously, seriously awesome.

20:11 amalloy: ,(first (java.lang.System/getProperties)) ; static method

20:11 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)

20:12 abrenk: laurus: to open a PDF on Linux and Windows I ended up with http://paste.lisp.org/+2GJ8

20:12 laurus: I wish there were a way to size the window to the PDF

20:12 abrenk, ah, that's really good

20:12 On my system it opens in Evince

20:12 I guess there's no way to control the window sizing from within Clojure though

20:12 abrenk: right

20:13 laurus: This is so great.

20:13 Thank you everyone!

20:56 thunk: In the section "Making A Lancet DSL" on page ~234 in _Programming Clojure_, `has-run-fn' and `reset-fn' are added to the target's metadata. Is this idiomatic in Clojure?

20:57 It feels to me like metadata should be preferred for stuff that's orthogonal to a program's functionality, and that these fns might better be stored explicitly. But maybe I need to adapt my thinking.

21:06 Chousuke: I don't think there are any clear idioms for metadata yet.

21:08 dnolen: Chousuke: except maybe adding ad-hoc type information? (type ...) will grab the type out of the metadata.

21:08 also in a bind, adding metadata to fns is useful.

21:17 ohpauleez: I'd also like to take on faux-typing and signaling

21:18 In a recent project I didn't want to change the hard type, but I did want to store meta information about a "job" and to what degree it was processed

21:18 You can also bend the metadata facilities to operator like decorators (which is cool)

21:19 chouser: ad-hoc type info for multimethods is pretty clearly idiomatic -- supported by the 'type' fn

21:19 ohpauleez: I would agree the most idiomatic one is type info

21:19 chouser: and that has a direct impact on program behavior

21:19 so I don't think it has to be inconsequential or anything.

21:21 ohpauleez: I recently had an idea that if you bent defrecord/protocols or multimethods, and metadata you could achieve something similar to MOP

21:21 minus the objects of course

21:22 but soon realized it'd be doing a lot to get very little useful functionality

22:06 tomoj: didn't vectors used to take 2 args?

22:10 huh. had enlive giving me "wrong number of args (2) passed to PersistentVector" errors, now they've disappeared

22:52 lazy1_: set completion_suffix :

22:52 set completion_suffix = :

22:52 Sorry about that

22:59 chouser: nooooo

22:59 the finger trees are wrong!

22:59 Raynes: chouser: Abandon ship!

22:59 chouser: I mean, I'm glad I discovered it now rather than while standing in front of ... everyone.

23:01 Raynes: chouser: I'll be sure to bring tomatoes to throw in case you get something else wrong.

23:01 chouser: oh, you won't have to.

23:01 just say "well that's all very nice, but how do you handle when ..."

23:02 tomoj: chouser: they've been wrong the whole time?

23:02 chouser: well

23:02 yes

23:02 I mean

23:03 it's not as if I built something else, it's just they're not right for integrating properly with the rest of Clojure.

23:03 Nothing a little refactoring won't cure.

23:03 I assume...

23:05 tomoj: ah

23:06 I thought you meant they hadn't been finger trees the whole time, which would have been.. odd

23:06 chouser: well, no need to be mysterious...

23:06 similar to Clojure's hash-maps, finger trees are actually a few different types of objects that implement the same tree interfaces.

23:06 EmptyTree, SingleTree, DeepTree, etc.

23:07 when you do a op on a tree obj, you get a new one of possibly a different concrete type, but you work with them all the same way, so that's fine.

23:08 Similar to sorted maps, finger trees are configurable. You can give a sorted map a comparator, and you can give a finger tree what I've been calling a Meter obj.

23:09 But Meters have a bigger impact on how finger trees behave. Depending on the specific Meter you give, your finger tree can act like a bit like a sorted set or a vector or a queue, etc.

23:11 In order to integrate with Clojure nicely, I had been planning for all the tree types (EmptyTree, etc.) to basically claim to support all potentially possible Clojure interfaces -- IPersistentSet, IPersistentVector, IPersistentMap, etc. and then simply fail at runtime if the Meter you gave didn't support one of those.

23:11 Seemed a little messy but not too bad.

23:12 But I was just realizing I had forgotten about marker interfaces. Is a DeepTree Countable? Well, it depends.

23:12 and yet there is code that will simple do (instance? Counted x) and make decisions based on that. No actual asking of the object such that I could check the Meter obj at runtime.

23:12 so .. this just won't work.

23:13 I need to be able to have a separate top-level interface type for each Meter, so it can claim the appropriate interfaces, including markers.

23:16 tomoj: so if I want a custom meter I have to provide my own finger tree types?

23:18 chouser: we'll see :-)

23:18 well, no. But I'm not sure what all you'll have to specify.

23:19 tomoj: (instance? Counted my-finger-tree) doesn't mean that you need separate finger tree types for each meter?

23:20 chouser: you'll need a type, but probably not 3 (or more)

23:20 tomoj: ah

23:20 chouser: but it may mean an extra allocation per op. :-/

23:21 unless I generate all the needed types ...via macros. yikes.

23:29 laurus: Has anyone here successfully utilized Clojure from within Org mode in Emacs?

23:29 chouser: laurus: I saw shoover do it over a year ago.

23:29 laurus: chouser, I'm wondering how it knows which "Clojure" to execute.

23:29 chouser: But I don't know enough about emacs to know what he was doing.

23:30 laurus: I use cljr, which loads up all the jars, but I doubt Emacs knows about it.

23:30 chouser: ah

23:30 tomoj: it relies on swank-clojure.el

23:30 laurus: tomoj, oh, really. Is there a way to change that?

23:30 tomoj: ..unless someone fixed that since I last looked

23:30 sure, fix it :)

23:30 laurus: Well, I'm not sure I'd call it "fixing" it, I just want it to work the way I want, which may not be what most people want

23:30 tomoj: I looked at it a little and gave up for now

23:31 laurus: I don't want to bother with swank and SLIME and those things right now

23:31 AspyKid: Hello. I am having trouble getting the REPL for Clojure to work in Netbeans with Enclojure it gives an error about missing libraries. Please help me.

23:31 tomoj: imo it should be able to use an external swank server

23:31 laurus: Honestly I don't even know what swank is, yet

23:31 AspyKid: The libaries it says it needs are clojure and clojure.contrib

23:31 tomoj: I guess there's a certain classpath you can use which will make all your cljr stuff available, right?

23:32 laurus: tomoj, probably, I hate messing with java and classpaths :P

23:32 I got spoiled by Python and its virtual environments

23:32 tomoj: if you install swank-clojure, you can configure its classpath by setting some variable

23:32 and the clojure babel stuff will use that, I think

23:32 laurus: Hmm, ok

23:33 tomoj: virtual environments sounds like what I want

23:33 laurus: I wonder if there's a way to just change what command it runs

23:33 tomoj: what would you change it to?

23:33 laurus: tomoj, cljr seems like a virtual environment, to me, I mean, it acts like one.

23:33 tomoj: but it's a single global virtual environment, no?

23:33 laurus: tomoj, yes :P Heh

23:33 tomoj: lein lets you have it per-project

23:33 laurus: Well, that's cool if one needs it

23:33 tomoj: a single global one is cool too if one needs it :)

23:34 laurus: I guess I want "cljr repl", execute code, return code, print out.

23:34 Haha right ;)

23:34 tomoj: there's no hope for "cljr repl"

23:34 it will only work with a swank server

23:34 laurus: Is swank like a repl for programs?

23:34 tomoj: swank-clojure.el can start up a swank server itself

23:34 swank is how emacs communicates with lisps

23:34 laurus: Oh, so I have to have SLIME too

23:34 Ugh, see, all of this seems so bloated

23:35 tomoj: I don't know that you need slime

23:35 AspyKid: how do I get NetBeans REPL to work ...

23:35 laurus: "Swank Clojure is a server that allows SLIME (the Superior Lisp Interaction Mode for Emacs) to connect to Clojure projects."

23:35 tomoj: yeah, but maybe org-babel can connect without slime

23:35 laurus: Ah, ok

23:35 tomoj: not sure

23:35 laurus: I don't like the name swank, that's part of my aversion to it, I admit

23:36 But it looks like swank is part of cljr so I guess it's okay with me :P

23:36 tomoj: swank is pretty gross

23:36 laurus: The system or the name?

23:36 tomoj: the system

23:36 laurus: Oh, really, why?

23:36 tomoj: for one thing, the protocol is totally undocumented

23:38 laurus: As that one creepy guy in that one old Star Trek episode said: "Unfortunate. Terribly unfortunate."

23:39 AspyKid: how do I load clojure and clojure.contrib as jar libraries for my netbeans project ...

23:39 laurus: AspyKid, I've never used Netbeans I'm sorry :( Have you Googled it?

23:39 AspyKid: yes. I have, but I am still getting an error.

23:40 tomoj: laurus: looks like `cljr list-classpath` gives you the classpath

23:40 split that into a list and set swank-clojure-classpath to it

23:40 laurus: Ah, okay

23:41 Hahaha

23:41 That's amusing

23:41 tomoj: the org-babel stuff should use swank-clojure.el and start a swank server automagically, I think

23:43 laurus: tomoj, take a look at this: http://nakkaya.com/2009/12/01/adding-inferior-lisp-support-for-clojure-mode/

23:44 It's off-topic from what you're telling me but it's interesting

23:45 technomancy: swank is gross because it's designed to trick Emacs into thinking Clojure is Common Lisp

23:45 laurus: technomancy, yeah, that's why I'm trying to avoid it at all costs :P

23:45 What do you think of that page I just posted?

23:45 tomoj: inferior lisp support is inferior

23:46 technomancy: laurus: I mean it's gross if you read the code

23:46 it's pretty nice to actually use it

23:46 laurus: Right, but take a look at that page

23:46 tomoj: maybe slime/swank is ugly, but it works great

23:46 laurus: the setq clojure-command looks like what I want

23:46 technomancy: inf-lisp is pretty boring

23:46 tomoj: ..well, it works great once you get it to work

23:46 laurus: I can specify how I want clojure to be called

23:46 technomancy: it's basically just an automated copy-from-buffer-paste-into-repl

23:46 none of the interesting things from slime

23:46 tomoj: laurus: it won't help you with org-babel, since the clojure stuff there works directly with swank-clojure

23:46 hugod: I use org-babel-clojure-bind-session-to-repl

23:47 laurus: tomoj, ugh, so there isn't any kind of hook where I can tell it what I want it to do?

23:47 tomoj: holy shit

23:47 laurus: hugod, what's that?

23:47 tomoj: hugod: I didn't know that existed, that's exactly what I want

23:47 technomancy: anyway, the commit which removed inf-lisp support got removed

23:47 err--reverted

23:47 laurus: technomancy, cool

23:47 :)

23:47 hugod, tell us more

23:47 How do we do what you did?

23:48 hugod: I need to check what I changed

23:48 laurus: Well do it man! :) You sound like you figured something awesome out :)

23:48 hugod: I remember changing a couple of things, but it was a while ago

23:48 laurus: Oh, well if you're too busy or don't have time, don't worry about it :)

23:50 hugod: laurus: http://gist.github.com/589154 is my org-babel-clojure.el

23:51 tomoj: hugod: many thanks!

23:51 laurus: hugod, you rock

23:51 tomoj: I had hoped someone would remove the swank-clojure dependency

23:51 laurus: So you commented out the swank-clojure line

23:52 And some other stuff that's too complicated for me to understand

23:52 :p

23:52 tomoj: hugod: needs slime, right?

23:52 oh, yes..

23:52 hugod: yes - binds to a slime session

23:53 laurus: hugod, so how do I use this?

23:53 tomoj: laurus: well looks like swank-clojure.el requires slime anyway

23:53 hugod: connect to a repl with slime-connect

23:53 tomoj: so unless you want to write your own org-babel-clojure.el, you need slime

23:53 laurus: tomoj, it's ok :)

23:54 I'll just bite the bullet, it's probably better anyway

23:54 I'm always too much of a purist with these things

23:54 hugod: and then org-babel-clojure-bind-session-to-repl

23:54 tomoj: do you hate ELPA?

23:54 laurus: tomoj, I've never used it

23:54 hugod, you mean run that function?

23:54 tomoj: well if you don't mind it it gives you a working clojure-mode+slime setup very easily

23:54 laurus: tomoj, yeah, I guess I find a lot of this Emacs stuff really crufty and weird

23:55 tomoj: accept cruftiness in return for power :)

23:56 laurus: tomoj, take a look at this if you're interested: http://sardakcode.blogspot.com/2009/02/litterate-programming-in-clojure.html

23:58 tomoj: hmm, org-babel-clojure.el is no more

23:58 laurus: I know, I just think it's neat that he made that :)

23:58 tomoj: I mean that org-babel-clojure.el no longer exists in org-mode. maybe it was only renamed and not changed since hugod fixed it

23:59 laurus: Oh, I see

Logging service provided by n01se.net