#clojure logs

2010-09-20

00:03sproustI've learned to clean up namespaces when things go wrong, using (remove-ns) and (ns-unmap).
00:03sproustNow... is there a way to remove or replace dispatching defined with (defmulti) ?
00:03cemericksproust: remove-method?
00:04Raynescais2002: It makes no difference.
00:05sproustcemerick: no, I want to redefine the dispatch function itself.
00:05cemerickah
00:05sproustcemerick: sproust = blais from the meetup.
00:05cemerickheh, yeah, I remembered this time :-)
00:05cemerickI think defmulti is the only way to swap out the dispatch fn
00:05Raynessproust: You'd need to unmap the defmulti or something equally destructive and then redefine it.
00:06sproustRaynes: if I (def <methodname> nil), and then redefine, it appears to work.
00:06cais2002Raynes: 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
00:07RaynesYou'd want to require nsB and nsC.
00:07cemericksproust: That's also blowing away your methods.
00:07sproustI like it.
00:07cemerickYeah, if it works, it's good.
00:07sproustcemerick: defmulti eval'ed multiple times won't clear it
00:08cemerickOh, I see what you mean.
00:08sproustcemerick: does it do it in your environment?
00:08cemerickYeah, that's an optimization issue.
00:08cemerickor, a side effect of an optimization, I should say
00:09cemerickNote 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.
00:11sproustOh macroexpand shows why; I see what you mean by the optimization.
00:12sproustcemerick: 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.
00:12cemericksproust: Nope, the dispatchFn field is final in MultiFn.
00:13sproustMan I like how the source for the VM code itself is so simple.
00:13cemerickI'll bet that will never be changed.
00:14sproustActually, the reason I got started on this multimethod stuff tonight is related to your book.
00:14cemericksproust: you can easily work around that limitation by routing dispatch through a fn in an atom.
00:14cemerickIt's such an edge case, that that's a reasonable fallback -- I'll bet the final designation for the multifn field is important.
00:14cemericksproust: oh?
00:15sproustI 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.
00:15Raynessproust: http://gist.github.com/587417 Hackery.
00:15RaynesEr, I gisted too much.
00:15RaynesCurse you, gist-buffer rather than gist-region!
00:15sproustMidway I realized I was being silly and I don't know anything about anything, and now I'm here asking questions haha :-)
00:15RaynesLook at the bottom of the gist.
00:16cemericksproust: :-)
00:16Rayneshttp://gist.github.com/587419 for those too lazy for scrolling.
00:16cemericksproust: BTW, check out the emacs UX discoverability in action over there with Raynes' memory failing him... ;-) :-D
00:16cemerick(that timing was simply too perfect)
00:16sproustIt's quite a gistful indeed.
00:17Raynes:>
00:17cemerickRaynes: no worries, I'm just poking sproust re: a discussion we were having last week about emacs vs. eclipse (for example) UI issues.
00:18sproustcemerick: he probably did it in a key combination, whiile you were still reaching above the penalty zone for the mouse.
00:18sproustprrrrtt ;-P
00:18RaynesM-x gist-buffer
00:18cemericklol
00:18RaynesShould have been gist-region.
00:18RaynesOr, I should have just deleted that buffer after I gisted the former part of it hours ago.
00:19sproustgist-buffer is dangerous... imagine if you'
00:19tomojwhat's discoverability?
00:20sproustd had all your credit card numbers above, from doing all your banking within Emacs?
00:20Raynessproust: That's why I always go to a special buffer that I usually create on the fly when I need to gist something.
00:20cemericktomoj: I think it was supposed to make it into emacs 16, but has been put on the back burner since then.
00:20RaynesI'd never 'just happen' to try to gist something in a buffer that contained information like that, thanks to habits.
00:20sprousttomoj: I think cemerick means that Emacs can't be figured out by examining menus and buttons. But... there _is_ the mighty C-h...
00:21tomojyes, C-h seems like great discoverability to me
00:21tomojI just habitually use -privately
00:21tomojer, -private
00:23cemericksproust: 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...!"
00:23sproustRaynes: that #' trick i mesmerizing me. What's this var-quote business? [digging in the books]
00:23sproustHahah that's true :-)
00:23RaynesBy the end of this month, I'll be so impatiently waiting for October 21st that I'll be sleeping on my packed luggage.
00:24tomojthe tutorial explains how to get help
00:24Raynes->(#'identity "blah")
00:24sexpbot⟹ "blah"
00:24cemericktomoj: Don't mind me, I was just picking the scab on a fun discussion sproust and I had last week. :-)
00:24RaynesWhen you call a var, it calls the function that is stored in it. Assuming a function is stored in it.
00:25RaynesEr, returns the value that is stored in it.
00:25cemerickThat's an impl detail, but it's so useful and so widely-used that I'm sure it'll never change.
00:25RaynesThat makes more sense.
00:25tomojI'm just wondering what 'discoverability' means.. sit down at the app for the first time and start using it easily?
00:25RaynesI think, anyway. Vars confuse me. :)
00:26sproustcemerick: 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
00:26cemericktomoj: lots of material on this; http://rickosborne.org/blog/index.php/2007/04/19/usability-vs-discoverability/ is a good start?
00:26cemericksproust: yeah, that's *not* discoverability. That's a command reference.
00:27tomojaha
00:27sproustHehehe :-) 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.
00:27tomojyes emacs sucks at discoverability
00:28Raynessproust: Also, #'name -> (var name)
00:28cemerickJacob Nielson had a great writeup on the concept, though I'm not finding it instantly right now.
00:28tomojoh, and he even says so: "Emacs is a paragon of usable, but just about as un-discoverable as you can get."
00:28cemerickTufte talks about it frequently.
00:29cemericktomoj: heh, so he does -- I didn't read that far down :-)
00:29Raynescemerick: Maybe I can dazzle you with my subpar Emacs skills and convince you to convert.
00:29sprousttomoj: the fantastic book The Humane Interface screams emacs the whole time too, about usability.
00:30cemerickRaynes: I'm an immovable body in that regard. :-)
00:30sproustRaynes: you don't have to-- it's just like LISP, he's inedubitably headed that direction anyway.
00:30Raynessproust: He's pretty stubborn.
00:30cemerickha!
00:30RaynesIf he wasn't I'd be sitting at home twiddling my thumbs during the Conj next month. :>
00:31cemerickRaynes: it's not *my* fault that I'm already right about various things ;-)
00:31sproustRaynes: you could tell at the meetup, he's way too smart to diss Emacs without twitching. He knows he's just postponing the inevitable.
00:35amalloycemerick: emacs is calling you...i was unwillingly converted not too long ago, and now my fingers are allergic to the arrow keys
00:36RaynesOne 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...
00:36cemerickamalloy: people have been banging on me off and on for almost 15 years now. I think I might be a hopeless cause.
00:37cemerickJeebus, that makes me sound old.
00:37amalloybut we couldn't give up on you. never leave a man behind for the zombies to get at
00:37RaynesWhat, nobody has made a remark about control being switched with caps lock yet?
00:38amalloyoh! i did that literally three days ago
00:38RaynesI was actually fine with control being control. A friend convinced me to try it for two weeks, and I got used to it.
00:38amalloyi just make them both ctl. i never want caps anyway, and this way it's a gentler induction period
00:39Raynesamalloy: I use caps a lot.
00:40sproustamalloy: 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.
00:40tomojRaynes: I friend convinced you to revert from caps<->control switching?
00:40tomojer.. a friend
00:41RaynesNo.
00:41sproustperfect companion to Emacs: http://elitekeyboards.com/products.php?sub=pfu_keyboards,hhkbpro2&amp;pid=pdkb400b
00:41RaynesA friend convinced me to switch.
00:41RaynesI haven't reverted.
00:41RaynesLike I said, I got used to it.
00:41sproustNow *THAT*'s discoverability!
00:41RaynesI didn't have any problem with it being ctrl before though.
00:42tomojHHKB has tilde all the way up in the right upper corner?
00:42tomojRaynes: ah, I see
00:42RaynesI wish the tilde was closer to the enter key. :(
00:42RaynesDon't feel like moving it.
00:56sproustRaynes: the fact that defmult accepts a function object, or a var to one, is that widespread?
00:57sproustOh, no, I guess it's in the call application itself.
00:57RaynesI haven't seen many people pass vars to defmulti. It would probably be a better idea to use an atom, as cemerick alluded to.
00:57sproust,(let [bli identity] (bli 24))
00:57clojurebot24
00:57sproust,(let [bli #'identity] (bli 24))
00:57clojurebot24
00:58RaynesWhat http client are people using these days?
00:58RaynesI've heard of about 50 come out in the last month.
01:00sproust,(let [bli (atom identity)] (bli 24))
01:00clojurebotjava.lang.ClassCastException: clojure.lang.Atom cannot be cast to clojure.lang.IFn
01:00sproustThat won't do, you'd have to wrap it somehow.
01:01Raynesclj-http looks promising.
01:01RaynesI think I'll take it.
01:04RaynesThe fact that deref is a function is helpful.
01:07cemericksproust: just (defmulti foo #(apply @dispatch-fn-atom %&) will do
01:07RaynesOr you could do that.
01:07Raynes;)
01:17sproustOh! %&, that's nice, didn't know it existed. Thx
01:35technomancywatch the language; family-friendly channel here
01:37scottjIs there javadoc integration built in to clojure-mode or slime now? (a keystroke to run clojure.java.javadoc/javadoc on thing at point)
01:48technomancyscottj: no; anything clojure-specific that wouldn't make sense in CL won't exist in slime
01:48technomancyscottj: now that you mention it I've been thinking of creating a way to piggyback elisp inside swank-clojure plugins
01:50scottjswank-clojure plugins, cool
01:50technomancytotally a back-burner idea I've had for ages; may never get around to it
01:50technomancybut it would make it a lot easier to enhance emacs since right now distributing elisp is a pain compared to clojars
02:58LauJensenGood morning all
03:00bobo_morning
03:29amalloyhi LauJensen
05:58bartjif c1,c2,c3 are collections
05:58bartjis there an in-built function which returns a vector of the corresponding elements ?
05:58bartjI currently do it using: (map (fn [a b c] [a b c]) c1 c2 c3)
06:04zmila,(doc zipmap)
06:04clojurebot"([keys vals]); Returns a map with the keys mapped to the corresponding vals."
06:05bartjzmila, note that there are three collections, and I want to return a vector
06:05zmilayes, bartj. i see this is not you want
06:05raek,(vec (list 1 2 3))
06:05clojurebot[1 2 3]
06:06raek(map vec c1 c2 c3) ; something like this?
06:09raekah, now I see what the map does...
06:10bartjraek, vec takes a collection no?
06:10raekthere is also 'vector' which takes the elements as arguments
06:10raek,(vector 1 2 3)
06:10clojurebot[1 2 3]
06:10raek(map vector c1 c2 c3) will make a sequence of 3-vectors, taking one element from each collection each step
06:11LauJensen,(map #(vec %&) [1 2 3] [4 5 6] [7 8 9])
06:11clojurebot([1 4 7] [2 5 8] [3 6 9])
06:11raek,(map vector [1 2 3] [4 5 6] [7 8 9])
06:11clojurebot([1 4 7] [2 5 8] [3 6 9])
06:12bartjraek, LauJensen thanks!
06:13bartjLauJensen, this is the first time I am seeing a %&
06:13bartj%, %1, %2 I understand
06:13LauJensenbartj: yea I thought I'd take the opportunity to demo it :)
06:13LauJensenbartj: you know '& args' right? This is the same
06:13bartjLauJensen, oh ok thanks!
06:14LauJensennp
06:31bartjLauJensen, how do I get started on contributing to open-source Clojure projects (other than core/contrib of course?)
06:32LauJensenbartj: 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.
06:33bartjLauJensen, In other words, which open-source Clojure projects are accommodating enough re: Clojure n00bs (comparatively speaking of course)
06:33bartjLauJensen, ok!
06:35LauJensenbartj: 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
06:50bartjLauJensen, I agree the Clojure community is very friendly...I'll just send in a patch I guess. :)
07:10LauJensenSwing 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 ?
07:10bozhidarI'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?
07:11LauJensenah, stackoverflow's got my back: http://stackoverflow.com/questions/369823/java-gui-repaint-problem-solved
07:11LauJensenbozhidar: I haven't read it and I don't know Luke
07:12bozhidarLauJensen: the revalidate is tricky indeed. btw Luke wrote "Practical Clojure"
07:12LauJensenOooh right, Clojure is Action is by Amit Rathore right? Haven't read that one either
07:13bozhidarI have "Practical Clojure" - it's not a bad book, but it's a bit too superficial
07:14bozhidarI'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
07:15LauJensenI 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
07:16bartjbozhidar, I had a look at Table of Contents section of Amit's book and it had large section devoted to clojure in the industry
07:16bartjer, how does one go about creating a ticket in assembla - or do I need to have special privileges for that ?
07:17bozhidarbartj: 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
07:17LauJensenbartj: do it under 'support'
07:18bozhidarand there is some discount at manning these days 50% off if you buy books for more than 100$
07:18bozhidarconvenient moment to extend one's clojure library...
07:20LauJensenbozhidar: I don't think there's ever been a moment, where manning didn't have some major discount :)
07:38bobo_dont think ive ever bought a book for more then 15$ from manning
07:51sthuebnerI'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.
07:51sthuebnerdoes anybody have any hint?
07:52bobo_sthuebner: i think labrepl uses compojure 0.3.2 and you 0.4.0
07:52bobo_i belive (html is moved to hiccup
07:53sthuebnerbobo_: my labrepl was pulled from git two days ago. project.clj and pom.xml refer to compojure 0.4.0
07:53sthuebnerso, the instructions are outdated?
07:54bobo_it has hiccup included aswell.
07:54bobo_but if it says html is in compojure, it might be outdated yes
07:54sthuebneryes
07:55bobo_where in the instructions are you?
07:55sthuebnermini-browser - layout
07:55sthuebnerfirst paragraph
07:57bobo_it does include hiccup for the file
07:58bobo_i think il let someone else that might know more answer this
08:00sthuebnerbobo_: I'll find my way
08:00sthuebnerthanks
08:26solussd...as Lisp can be likened to a self-licking lollypop. nice.
09:00BahmanHi all!
09:28shooverBahman: Hello
09:28bartjBahman, hey!
09:31BahmanHe shoover, bartj!
09:38zoldarHello. How can this function be simplified? http://pastebin.com/Dp3g3QBk thank you in advance for any pointers
09:46LauJensenzoldar: would this work ?
09:46LauJensen,(map #(reductions vector %) [["Pictures" "Photos"] ["Downloads" "Stuff"]])
09:46clojurebot(("Pictures" ["Pictures" "Photos"]) ("Downloads" ["Downloads" "Stuff"]))
09:48zoldarLauJensen, almost, but I need it linearized - thanks for nice pointer anyway
09:48zoldar didn't know about reductions
09:48LauJensenzoldar: If you really are looking for paths, you might want to check out file-seq
09:49zoldarLauJensen, I don't interact with File.io directly
09:49LauJensenk
09:49blackrainhi
09:51LauJensenyo
10:48fbru02hey guys how do you call a java function that receives no parameters??
10:48mefestofbru02: an instance method?
10:48chouserjava doesn't have functions. Do you mean a static method?
10:48fbru02mefesto: instance method
10:48fbru02sorry
10:48mefesto(.methodName obj)
10:49fbru02ok , thanks, i wanted to double check my error must be somewhere else
10:54mefestoanyone know how the turn out looks so far for clojure-conj?
10:58chousermefesto: I'm curious about that too. total slots available and number taken so far.
10:58mefestochouser: I'm about to put in for some vacation time for this :)
10:59chouserI'm really looking forward to it.
11:12v-alexτην κλήση της NodeLoad
11:13fliebelEnglish? (or are you testing Unicode?)
11:14v-alexfliebel: really sorry about that, mixed the windows :(
11:14fliebelv-alex: It happens, which lang is it?
11:14v-alexgreek
11:16LauJensenv-alex: you're greek? Hey you owe me money, love Europe
11:16v-alexLauJensen: lol, i'm paying, i'm paying
11:17LauJensen:D
11:17fliebelLauJensen: Can I ask you some stuff about bestinclass.dk? I'm trying to sort out some problems I ran into with Utterson.
11:17LauJensenhehe, Utterson, man thats a funny name
11:17LauJensenfliebel: yea sure
11:17LauJensenIve got a few minz
11:18fliebelLauJensen: It;s the static site generator, and the friend of either Jakyll or Hyde :)
11:18LauJensenYea sure :)
11:19fliebelThe 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:20fliebelI came up with one solution, but I would like to know how you did it as well.
11:22LauJensenfliebel: for indexes and menus, footers etc, if all thats static, put that in an outer template
11:24fliebelLauJensen: 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:24LauJensenfliebel: all the pages, or links to all the pages?
11:25fliebelLauJensen: If the index contains actual pages or at least excerpts, I need to parse all those pages.
11:26LauJensenIm guessing that its a small amount of data, so I would just hold it in memory if thats the case.
11:26fliebelLauJensen: So how are you generating index pages?
11:26LauJensenfliebel: Its a template like any other?
11:28fliebelLauJensen: How would I know that? I'm asking about you now. ;)
11:28sprousttechnomancy: I originally meant "%&" is nice. (Or more appropriately "%&" is really %&'ing nice ;-P )
11:28LauJensenfliebel: Im saying, to me it just sounds like a regular template, running clone-for on your data in memory
11:29fliebelLauJensen: So you do have the data of all the posts in memory when parsing?
11:29LauJensenfliebel: Just the excerpts
11:30LauJensenhttp://github.com/LauJensen/bestinclass.dk/blob/master/src/bestinclass/admin.clj#L144
11:30LauJensenWhen I publish posts, I build the index incrementally, you can do the same from the beginning
11:30fliebelLauJensen: 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:30LauJensenNo, I prepend
11:31LauJensenThat way you can handle one post at a time
11:31fliebelLauJensen: Yea… sounds like a sound plan.
11:31LauJensenbrb
11:35fliebelLauJensen: 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:35fliebelLauJensen: Anyway, thanks for sharing :)
11:35LauJensenI have no experience with Jekyll.. np
11:35fliebelI'll take a look at it :)
11:46fliebelLauJensen: 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:47LauJensenfliebel: 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:48fliebelLauJensen: 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:49LauJensenfliebel: Did you watch my latest screencast? I think I actually talk about this process in it
11:50fliebelI don't remember… You mean the one about your site, right? I think I did while doing other stuff at the same time.
11:50LauJensenYea
11:52fliebelI 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:52LauJensenfliebel: Awesome, that way you can still take full credit :)
11:54fliebelThe 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:54LauJensenbecause moustache is serving files?
11:55fliebelOh well, maybe I could still use it.
11:56fliebelLauJensen: 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:57fliebelLauJensen: It's like I wrote a custom Ring adapter to request all possible urls and write them to files.
11:57LauJensenfliebel: I thought it was supposed to pre-bake this stuff? Why are you generating on requests
11:58fliebelLauJensen: I'm not, I'm doing something like wget url > file.html without actually runing a server.
11:58LauJensen?
12:00fliebelLauJensen: 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:01fliebel*client
12:01hiredmandict? surely you mean map
12:01LauJensendict?! :) Its called a hash-map
12:02LauJensenfliebel: I dont see the point in that approach, but that doesnt mean its not good :)
12:02fliebelLauJensen: 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:03LauJensenaha
12:04LauJensenfliebel: 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:05fliebelLauJensen: 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:20LauJensenfliebel: Because it takes a couple of minutes to set up and I dont want the route from dev => prod to be too long
12:21fliebelLauJensen: But I'm not going to keep Moustache running like you do. It's going to be purely static.
12:21LauJensenOk
12:21LauJensenOtherwise it wouldn't be Utterson :)
12:46iwilligdoes anyone know of a project for creating cron jobs in clojure ?
12:46iwilliga wrapper for cron4j or something ?
12:47iwilligi guess i mostly want a job scheduler in clojure
12:48hiredmanScheduledThreadPoolExecutor
12:48iwilligthats a java thing i am guessing (sorry new to the JVM)
12:49iwilligthanks hiredman that looks like it could work
12:59cemerickiwillig: I think the javadoc mentions it, but executors are almost always created via the Executors class' static methods.
12:59cemerickjust FYI
13:00cemericktamps down the configuration work
13:03jneirahi people!
13:04jneirasomeone 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:05jneiramy limited mind dont catch the kotarak and cgrand porposal :-(
13:06jneira*proposal
13:07jneira,(Integer. 1)
13:07clojurebot1
13:12jneirai wanted something like (create Integer 1) or (create My-Type {:a 1}) with a custom code initialization for each type
13:14chouserjneira: why is that better than (create-My-Type {:a 1}) ?
13:14jneirammm
13:16fliebeljneira: You could use deftemplate to create loads of them maybe,
13:17chouserbut 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:17jneiragood question chouser
13:17jneira:-P
13:18jneirai suppose for the same reason you use a multimethod instead separate functions
13:19fliebeljneira: well, why not use a multimethod based on the type of class then?
13:19fliebelI guess it's interesting to know if those classes have anything in common, or are just random classes.
13:22jneirayep fliebel i tried this but all methods are (defmethod return ContainerType [mvalue] (ContainerType. (:value mvalue) ))
13:23jneirai wanted something similar to return function of haskell monads
13:23jneiraa dispatch on return type and no on params types
13:24jneiramaybe it is a nosense ... :-/
13:37jjidoI cannot add a "count" method in a protocol?
13:39chousersure you can.
13:40jjidohttp://gist.github.com/586791
13:40jjidoI get an error with "count" instead of "counts"
13:40chousera warning?
13:41jjidoCaused by: java.lang.IllegalArgumentException: No single method: count of interface: user.SimpleListProtocol found for function: count of protocol: SimpleListProtocol
13:44chouserIt's probably not recommended anyway, since you're overwriting clojure.core's count in your namespace
13:44chouserbut I'm curious what line that exception is pointing to.
13:48dakronedoes swank-clojure work with 1.3-SNAPSHOT yet? I can't get a swank server started using 'lein swank'
14:35stuarthallowayI 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:36fliebelIsn't Compojure just Ring?
14:36stuarthallowayunder the covers, yes
14:36fliebelSo is the problem the files or the wrapping?
14:37stuarthallowaythe 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:37LauJensenstuarthalloway: Ring has a get resource stream from jar helper
14:37kotarakwrote a ring handler. But don't have it handy. (And I'm not sure about the quality either...)
14:37LauJensenlemme see if I can find it
14:38stuarthallowayahah! ring has a separate fn resource-response that does what I need
14:38LauJensenyea thats the one
14:38kotarakIs there a reason, why lists don't use a modified vector internally?
14:38fliebelstuarthalloway: This gives you a path: (.getFile (.getResource (clojure.lang.DynamicClassLoader.) "something"))
14:39technomancydakrone: 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:39LauJensenfliebel: all that stuff is already wrapped in Ring
14:39stuarthallowayfliebel: 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:39fliebelokay
14:40stuarthallowaywhich they apparently halfway do: ring has it, compojure doesn't expost it
14:40dakronetechnomancy: I get http://gist.github.com/588399 when starting it
14:44technomancydakrone: hrm... could you open an issue?
14:45dakronetechnomancy: sure, will do
14:45technomancythx
14:45kotarakWith static method I can have primitive args?
14:45LauJensenstuarthalloway: 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:45stuarthallowayLauJensen: yep, thanks!~
14:50b6nHi Folks, does someone of you use vimclojure and had trouble compiling it? (java.lang.Exception: Unmatched delimiter: ) (backend.clj:171))
14:51kotarakb6n: this is due to a change in the reader syntax
14:51kotarakJust a second
14:52kotarakb6n: please try this: http://groups.google.com/group/vimclojure/browse_thread/thread/90e66f1c665e0be3
14:52kotarakSee links there.
14:54chouserkotarak: you mean like a reversed vector? I have no idea.
14:54chouserkotarak: I believe :static fns give you primitive args if you hint them as such.
14:55kotarakchouser: I'm playing around with vlists. It's much faster than lists for random lookup, but not close to a vector.
14:56chouserI guess a reversed vector would be indexed from the far end. Weird and not very useful, I'd guess.
14:57kotarakone 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:58chouserthen we'd have no collection that implements ISeq directly. Dunno if we'd miss that at all.
15:01kotarakchouser: 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:02chouserkotarak: 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:02chouserperhaps PersistentList is one of these.
15:02kotaraklikely
15:02chouseror perhaps I'm also missing something essential.
15:02chouser:-)
15:02kotarak:)
15:02kotarak*/
15:03kotarakwoops
15:09jjidochouser: sorry I was away. Are you still around?
15:09chouserjjido: yup
15:10jjidowhen 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:13jjidoline 125 in http://gist.github.com/586791
15:15chouserah, because your count take 3 args and you're only passing one there.
15:17ohpauleezis the three quotes a standard style now?
15:17ohpauleezor carry over from Python?
15:18chouseroh. heh, didn't even look at that. yeah, that syntax isn't correct but happens to not cause much harm at the moment.
15:21jjidoohpauleez: I can do multi-line with single quotes?
15:22chouserjjido: yep
15:22jjidochouser: no I am not using my count. I am using vector's.
15:22chouserthat's what's actually happenening there
15:23chouserjjido: but you're not. you're using the one count in your namespace, which you overwrote when you defined 'count' with defprotocol
15:23LauJensenhugod: Did you get Critions GC stats under control ?
15:23chouseryou should have gotten a warning when you did that.
15:23jjidochouser: you are right
15:23jjidoWarning: protocol #'user/SimpleListProtocol is overwriting function count
15:25jjidoI wish it would keep the old one around for when I deal with vectors...
15:26chouserjjido: you can use clojure.core/count if you want
15:29b6nkotarak: Thanks for the hint, now I got it working. And thanks for you effort making this! How I missed '*' and '.' :-)
15:30kotarakb6n: glad it helps :)
15:31hugodLauJensen: I haven't - not really touch criterium since we last spoke
15:32LauJensenhugod: Alright
15:32hugodbusy on pallet - btw now with minimal arch support
15:32LauJensenuuuuh - I'll have to find an excuse to play with it one of these days :)
15:32LauJensen(I've only heard good things about it)
15:33hugodit has its supporters :)
15:33LauJensenGuess I should be a good contributing and work some on Criterion on then, its really too good just to rot :)
15:34hugodwe're putting together some examples of deploying web apps with pallet
15:34LauJensenhugod: for which targets?
15:35hugodpatches 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:36hugodLauJensen: tomcat, haproxy, probably couch
15:36LauJensenhugod: You mentioned the last time that you wanted me to push into some branch other than master, did you set a name ?
15:36LauJensenhugod: 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:36hugodLauJensen: work on master if you like - I'm not doing anything actively
15:37hugodLauJensen: tbatchelli is actually doing most of the hard work :)
15:37LauJensenhugod: I can imagine, he's a cool guy
15:39hugodLauJensen: indeed - he is presenting pallet to the bay area group (in october I think)
15:39LauJensenyea, you guys do too few events in Europe :)
15:39LauJensenBut then again, Denmark IT wise might be comparable to the US in the early 90s
15:40hugodwhen I get cloudhoist up and running, I promise to demo in denmark :)
15:40hugodjclouds is doing a workshop with pallet at ørdev
15:42kotarakhugod: is criterium on clojars up to date?
15:42hugodkotarak: I believe so
15:42kotarakok, thx
15:43LauJensenhugod: Alright Just note that Øredev isnt in Denmark
15:43LauJensenkotarak: criterium is the Haskell version though?
15:43kotarakLauJensen: no. criterion is the Haskell version.
15:44hugodLauJensen: I realise that, but it counts as Europe though?
15:44LauJensenWow, my mind had run rseq on itself
15:44LauJensenhugod: sure :)
15:44hugodLauJensen: could you update criterium to 1.2 release ?
15:45jjidoI used (def cljcount count), still getting a warning though.
15:45LauJensenhugod: I dont have an overview of what entails
15:45hugodLauJensen: ok, no problem :)
15:45hugodworth a try...
15:46LauJensenyea, its not that I dont want to, but I just need to re-read the source
15:46LauJensenalso - Until Conj Labs Frankfurt is complete, Im not seeing a lot of sparetime ahead of me :)
15:51mrBlissCan someone come up with a good name for a function that has the following docstring:
15:51mrBliss"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:52LauJensenmrBliss: If its for Common Lisp, simple replace all spaces with dashes in the docstring, and thats the name
15:52kotarakWow. Criterium seems cool.
15:53kotarakAlthough I'm not a microbenching fan.
15:53mrBlissLauJensen: haha. I currently have longest-equal-subseq-for
15:53ohpauleezLauJensen: hahaha
15:53LauJensenmrBliss: take-indices-while
15:53ohpauleezmrBliss: isn't that just lcs?
15:55mrBlissohpauleez: no, should I gist the source for clarification?
15:55mrBliss(btw args are [f indices])
15:56hugodkotarak: thanks - its a little slow, and the memory thing LauJensen was refering to needs fixing, but it is useful as is
15:56ohpauleezis it a filtered-lcs? or are you just filtering, and returning the indices, or the subsequence of values
15:56hugodkotarak: just pushed a version using clojure 1.2 release
15:56kotarakhugod: oeh, the one from March 8th worked for me with 1.2?
15:57mrBlissohpauleez: http://gist.github.com/588542
15:57ohpauleezmrBliss: thanks, let me take a look
15:57hugodkotarak: its been using 1.2 for a while
15:57hugodjust not the release version...
16:06ohpauleezmrBliss: 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:07jjidowhat is another name for "->"?
16:07ohpauleezjjido: sometimes it's called lacing or threading a call
16:08mrBlissohpauleez: I'm writing connect 4, so it's not an api function
16:09ohpauleezjjido: maybe "The form threading macro")
16:09jjidoI write all the time: (-> obj (method args (fn [result] (->...again the same
16:10ohpauleezyou can use, doto
16:10ohpauleezas in (doto obj (form1) (form 2)... (form n))
16:11jjidoohpauleez: it would be (doto obj (method args (fn [result] (doto...
16:12ohpauleezjjido: let me get you can example
16:13ohpauleezjjido: http://stuartsierra.com/2010/01/03/doto-swing-with-clojure
16:13jjidoohpauleez: yeah, cool but it does not help with CPS style
16:15ohpauleezjjido: 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:15ohpauleezor something to that affect
16:15ohpauleezotherwise, I use let, functions, and (typical-func args (one-more-func args))
16:16ohpauleezjjido: What is CPS?
16:17LauJensenhugod: 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:18jjidoWhat 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:18jjidoohpauleez: continuation passing style
16:19hugodLauJensen: I'm not going :) @jclouds is doing the workshop - I remember sweden much more reserved than that :)
16:20jjidoI forgot the name of the result variable(s)
16:22ohpauleezjjido: Ahhh you might want ->>
16:22ohpauleezfor the entire statement
16:22jjido(cps obj [(method1 args [results1]) (method2 args [result2]) (method3 args [result3]))
16:22ohpauleezohh, nvm
16:23ohpauleezyou have three sets of results, all need to get passed to different functions, but passed into one vector
16:24ohpauleezwell, I would use destructuring for that, in a let, and then return the cps call
16:25jjidoohpauleez: help me with destructuring/and back?
16:26ohpauleeztotally, I was already working on an example :)
16:31ohpauleezjjido: Still some repetition, not the best style, but here's the idea: http://gist.github.com/588586
16:32jjidoohpauleez: and about "cps"?
16:32ohpauleezjjido: not really destructuring, just let.
16:32ohpauleezcps is a function call, right?
16:32ohpauleezohhh continuation passing style
16:33jjidoohpauleez: there is a real example at the bottom of: http://gist.github.com/586791
16:38ohpauleezjjido: That's how you do callbacks, inline continuations
16:39jjidoohpauleez: yes
16:39ohpauleezso wait, did you have a problem? or you just wanted to know the name of the macro
16:39ohpauleezhaha
16:40ohpauleezjjido: sorry for the run around here :)
16:40jjidoohpauleez: syntax problem. I am opening too many pars and not closing them
16:43ohpauleezahh, sorry about that
16:47chouserjjido: do you need real nesting so you can use outer locals?
16:49jjido_chouser generally yes but I can work around it
16:50chouserand the next fn form can appear anywhere and at any level of the current form. :-/
16:51cemericktechnomancy: 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:51chousersomething like: (cps-> #(instance SimpleListClass __ logException) #(associate % "Hello" 1 __ logException) (fn [value next] (println value next)))
16:52chouser?
16:53jjido_chouser: the logException part is always the same, can be inserted later
16:53jjido_if it differs I can fall back to standard clojure
16:54cemericktechnomancy: nm, found that gg thread
16:54technomancycemerick: more or less, yes
16:56chouserjjido_: (defmacro cps-> [& exprs] (reduce (fn [inner step] (clojure.walk/postwalk-replace {'__ inner} step)) (reverse exprs)))
16:57chousernot sure the -> in the name is appropriate
16:59jonnyb`hi
16:59jonnyb`i just upgraded my lein from some ancient version
17:00jonnyb`now "lein swank" s not working anymore
17:00jonnyb`how can i start my swank server now ? :)
17:01bobo_jonnyb`: do you have :dev-dependencies?
17:01bobo_or the or swank-clojure.jar in ~/.lein/plugins
17:02jonnyb`i thought it was in there, yes but i have a look again
17:02jonnyb`thanks!
17:02bobo_if you put the jar in .lein/plugins it will work on all projects
17:03jonnyb`my lein/plugins is empty, is there some "automatic" way to get in there?
17:03bobo_dont think so
17:03bobo_god old fashioned copy :-)
17:03jonnyb`ok, thanks, i'll look for it :)
17:06technomancyit'll be automated for the next release
17:08jonnyb`it's running, thank you a lot!
17:19iveytechnomancy: you already have code in progress for doing that?
17:19iveyif not, i may be interested in tackling
17:19iveya plugins.clj that lists which ones I want, and then auto-update, or something
17:26technomancyivey: thanks; colin jones is on it. see the lein mailing list... he may like help if you want to chime in.
17:27iveyi'll clone and take a look
17:27iveythanks
17:43jjidochouser: I can't figure what I need to write to use cps->
17:46jjidoah... I think I understand
18:20amalloytechnomancy: the ~/.lein/plugins is a new feature in 1.3?
18:21amalloyi 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:27technomancyamalloy: 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:27technomancythere's a reason "lein upgrade" was made so easy to do
18:28technomancy={
18:28technomancyerr =)
18:29amalloytechnomancy: 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:29jjidowhat am I doing wrong? http://gist.github.com/588764
18:42jjidochouser-- I don't get it :'-{
19:01amalloyjjido: 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:02amalloywhich seems to at least match with the error message
19:03jjidoheh.... it looks like the replace directive in the macro is for __
19:04jjidoso I should not quote it
19:05jjidohttp://gist.github.com/588764
19:26Spreadsheet_What's the most supported framework for clojure?
19:29iveySpreadsheet_: web framework you mean?
19:29Spreadsheet_ivey: Yes
19:31kotrinSpreadsheet_ : ring/compojure
19:31Spreadsheet_kotrin: thanks
19:31Spreadsheet_Have any major websites been written in it?
19:41laurusDoes anyone know a good way to open a PDF in a GTK window in Clojure?
19:41laurusI'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:41laurusBut I'm not sure about opening the PDF inside
19:48replacaQ: 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:57laurusWhen 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:59iveylaurus: one thing wrong is that you need hello.pdf as a string "hello.pdf"
20:00laurusivey, thanks. Now I get java.lang.IllegalArgumentException: No matching method: open.
20:00iveyyeah that was the end of my helpfulness :-)
20:00laurusHeh ok :)
20:00laurusThanks though!
20:01laurusI'm just trying to test something
20:01laurusI'm a total beginner at Clojure and this is way out of my knowledge base
20:01iveyoh
20:01iveyopen wants a File not a string
20:01laurusAh... right. This is Java. :P
20:02laurusWhat's the simplest way to open a file in Clojure?
20:03vacholaurus: What platform?
20:03ivey-> (java.io.File. "/etc/passwd")
20:03sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: ()
20:03iveyheh
20:03laurusHahaha
20:03laurusOk!
20:03vachoopen a file or run a script?
20:04laurusYuck, it's still not working.
20:04laurusvacho, open a file
20:04amalloylaurus: also take a look at clojure.java.io. i haven't tried it out, but i bet it works moderately well
20:04vacholaurus: win,macos or unix?
20:04laurusNow I have (java.awt.Desktop/open (java.io.File. "guide.pdf")), but it still failed.
20:04laurusvacho, Unix
20:04vacholaurus: I am fairly new myself..but I am using cljr
20:04laurusvacho, me too
20:04laurusBut I'm talking about opening a file inside of a REPL
20:05laurusAs an object.
20:05vachothere is a command for that
20:05vachoinclude file or something like that
20:05laurusvacho, not a source file, like, a PDF
20:05vachoohh..no idea sorry
20:05vachomaybe java IO
20:05laurusNo problem :)
20:05iveylaurus: I don't know (open) enough to know why, but the File. is def. making a new file
20:05iveytested it at the repl
20:05laurusivey, yes, that part is definitely working
20:05amalloylaurus: clojure.java.io makes this fairly easy
20:06laurusamalloy, how do I call a static method of a Java class in Clojure?
20:06amalloyuser=> (use '(clojure.java io))
20:06amalloyuser=> (file ".")
20:06amalloy#<File .>
20:06laurusamalloy, oh, that's even better :)
20:06laurusBut how do I call the static method and pass that file object now?
20:06jjidoWe should add chouser's macro to core clojure. I call it "feed", or _>_. it helps a lot! example: http://gist.github.com/588764
20:07abrenklaurus: Derander
20:08abrenklaurus: Desktop#open is not static
20:08laurusabrenk, oh, wow, my fault
20:08laurus:P
20:08abrenklaurus: ignore my fist line...
20:08laurusabrenk, no problem, the second is very valuable :)
20:08abrenklaurus: you need to call Desktop#getDesktop and then open on that
20:08laurusabrenk, ah, thank you, very much
20:09abrenkand check if Desktop#isDesktopSupported returns true
20:09amalloylaurus: but if it *were* static, your way of calling it would have been right :)
20:10laurusamalloy, that's good to know, I thought I was going bonkers
20:10laurus:P
20:11laurusHoly cow, it worked!!
20:11laurusNow that is seriously, seriously awesome.
20:11amalloy,(first (java.lang.System/getProperties)) ; static method
20:11clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
20:12abrenklaurus: to open a PDF on Linux and Windows I ended up with http://paste.lisp.org/+2GJ8
20:12laurusI wish there were a way to size the window to the PDF
20:12laurusabrenk, ah, that's really good
20:12laurusOn my system it opens in Evince
20:12laurusI guess there's no way to control the window sizing from within Clojure though
20:12abrenkright
20:13laurusThis is so great.
20:13laurusThank you everyone!
20:56thunkIn 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:57thunkIt 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:06ChousukeI don't think there are any clear idioms for metadata yet.
21:08dnolenChousuke: except maybe adding ad-hoc type information? (type ...) will grab the type out of the metadata.
21:08dnolenalso in a bind, adding metadata to fns is useful.
21:17ohpauleezI'd also like to take on faux-typing and signaling
21:18ohpauleezIn 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:18ohpauleezYou can also bend the metadata facilities to operator like decorators (which is cool)
21:19chouserad-hoc type info for multimethods is pretty clearly idiomatic -- supported by the 'type' fn
21:19ohpauleezI would agree the most idiomatic one is type info
21:19chouserand that has a direct impact on program behavior
21:19chouserso I don't think it has to be inconsequential or anything.
21:21ohpauleezI recently had an idea that if you bent defrecord/protocols or multimethods, and metadata you could achieve something similar to MOP
21:21ohpauleezminus the objects of course
21:22ohpauleezbut soon realized it'd be doing a lot to get very little useful functionality
22:06tomojdidn't vectors used to take 2 args?
22:10tomojhuh. had enlive giving me "wrong number of args (2) passed to PersistentVector" errors, now they've disappeared
22:52lazy1_set completion_suffix :
22:52lazy1_set completion_suffix = :
22:52lazy1_Sorry about that
22:59chousernooooo
22:59chouserthe finger trees are wrong!
22:59Rayneschouser: Abandon ship!
22:59chouserI mean, I'm glad I discovered it now rather than while standing in front of ... everyone.
23:01Rayneschouser: I'll be sure to bring tomatoes to throw in case you get something else wrong.
23:01chouseroh, you won't have to.
23:01chouserjust say "well that's all very nice, but how do you handle when ..."
23:02tomojchouser: they've been wrong the whole time?
23:02chouserwell
23:02chouseryes
23:02chouserI mean
23:03chouserit's not as if I built something else, it's just they're not right for integrating properly with the rest of Clojure.
23:03chouserNothing a little refactoring won't cure.
23:03chouserI assume...
23:05tomojah
23:06tomojI thought you meant they hadn't been finger trees the whole time, which would have been.. odd
23:06chouserwell, no need to be mysterious...
23:06chousersimilar to Clojure's hash-maps, finger trees are actually a few different types of objects that implement the same tree interfaces.
23:06chouserEmptyTree, SingleTree, DeepTree, etc.
23:07chouserwhen 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:08chouserSimilar 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:09chouserBut 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:11chouserIn 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:11chouserSeemed a little messy but not too bad.
23:12chouserBut I was just realizing I had forgotten about marker interfaces. Is a DeepTree Countable? Well, it depends.
23:12chouserand 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:12chouserso .. this just won't work.
23:13chouserI 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:16tomojso if I want a custom meter I have to provide my own finger tree types?
23:18chouserwe'll see :-)
23:18chouserwell, no. But I'm not sure what all you'll have to specify.
23:19tomoj(instance? Counted my-finger-tree) doesn't mean that you need separate finger tree types for each meter?
23:20chouseryou'll need a type, but probably not 3 (or more)
23:20tomojah
23:20chouserbut it may mean an extra allocation per op. :-/
23:21chouserunless I generate all the needed types ...via macros. yikes.
23:29laurusHas anyone here successfully utilized Clojure from within Org mode in Emacs?
23:29chouserlaurus: I saw shoover do it over a year ago.
23:29lauruschouser, I'm wondering how it knows which "Clojure" to execute.
23:29chouserBut I don't know enough about emacs to know what he was doing.
23:30laurusI use cljr, which loads up all the jars, but I doubt Emacs knows about it.
23:30chouserah
23:30tomojit relies on swank-clojure.el
23:30laurustomoj, oh, really. Is there a way to change that?
23:30tomoj..unless someone fixed that since I last looked
23:30tomojsure, fix it :)
23:30laurusWell, 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:30tomojI looked at it a little and gave up for now
23:31laurusI don't want to bother with swank and SLIME and those things right now
23:31AspyKidHello. 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:31tomojimo it should be able to use an external swank server
23:31laurusHonestly I don't even know what swank is, yet
23:31AspyKidThe libaries it says it needs are clojure and clojure.contrib
23:31tomojI guess there's a certain classpath you can use which will make all your cljr stuff available, right?
23:32laurustomoj, probably, I hate messing with java and classpaths :P
23:32laurusI got spoiled by Python and its virtual environments
23:32tomojif you install swank-clojure, you can configure its classpath by setting some variable
23:32tomojand the clojure babel stuff will use that, I think
23:32laurusHmm, ok
23:33tomojvirtual environments sounds like what I want
23:33laurusI wonder if there's a way to just change what command it runs
23:33tomojwhat would you change it to?
23:33laurustomoj, cljr seems like a virtual environment, to me, I mean, it acts like one.
23:33tomojbut it's a single global virtual environment, no?
23:33laurustomoj, yes :P Heh
23:33tomojlein lets you have it per-project
23:33laurusWell, that's cool if one needs it
23:33tomoja single global one is cool too if one needs it :)
23:34laurusI guess I want "cljr repl", execute code, return code, print out.
23:34laurusHaha right ;)
23:34tomojthere's no hope for "cljr repl"
23:34tomojit will only work with a swank server
23:34laurusIs swank like a repl for programs?
23:34tomojswank-clojure.el can start up a swank server itself
23:34tomojswank is how emacs communicates with lisps
23:34laurusOh, so I have to have SLIME too
23:34laurusUgh, see, all of this seems so bloated
23:35tomojI don't know that you need slime
23:35AspyKidhow do I get NetBeans REPL to work ...
23:35laurus"Swank Clojure is a server that allows SLIME (the Superior Lisp Interaction Mode for Emacs) to connect to Clojure projects."
23:35tomojyeah, but maybe org-babel can connect without slime
23:35laurusAh, ok
23:35tomojnot sure
23:35laurusI don't like the name swank, that's part of my aversion to it, I admit
23:36laurusBut it looks like swank is part of cljr so I guess it's okay with me :P
23:36tomojswank is pretty gross
23:36laurusThe system or the name?
23:36tomojthe system
23:36laurusOh, really, why?
23:36tomojfor one thing, the protocol is totally undocumented
23:38laurusAs that one creepy guy in that one old Star Trek episode said: "Unfortunate. Terribly unfortunate."
23:39AspyKidhow do I load clojure and clojure.contrib as jar libraries for my netbeans project ...
23:39laurusAspyKid, I've never used Netbeans I'm sorry :( Have you Googled it?
23:39AspyKidyes. I have, but I am still getting an error.
23:40tomojlaurus: looks like `cljr list-classpath` gives you the classpath
23:40tomojsplit that into a list and set swank-clojure-classpath to it
23:40laurusAh, okay
23:41laurusHahaha
23:41laurusThat's amusing
23:41tomojthe org-babel stuff should use swank-clojure.el and start a swank server automagically, I think
23:43laurustomoj, take a look at this: http://nakkaya.com/2009/12/01/adding-inferior-lisp-support-for-clojure-mode/
23:44laurusIt's off-topic from what you're telling me but it's interesting
23:45technomancyswank is gross because it's designed to trick Emacs into thinking Clojure is Common Lisp
23:45laurustechnomancy, yeah, that's why I'm trying to avoid it at all costs :P
23:45laurusWhat do you think of that page I just posted?
23:45tomojinferior lisp support is inferior
23:46technomancylaurus: I mean it's gross if you read the code
23:46technomancyit's pretty nice to actually use it
23:46laurusRight, but take a look at that page
23:46tomojmaybe slime/swank is ugly, but it works great
23:46laurusthe setq clojure-command looks like what I want
23:46technomancyinf-lisp is pretty boring
23:46tomoj..well, it works great once you get it to work
23:46laurusI can specify how I want clojure to be called
23:46technomancyit's basically just an automated copy-from-buffer-paste-into-repl
23:46technomancynone of the interesting things from slime
23:46tomojlaurus: it won't help you with org-babel, since the clojure stuff there works directly with swank-clojure
23:46hugodI use org-babel-clojure-bind-session-to-repl
23:47laurustomoj, ugh, so there isn't any kind of hook where I can tell it what I want it to do?
23:47tomojholy shit
23:47laurushugod, what's that?
23:47tomojhugod: I didn't know that existed, that's exactly what I want
23:47technomancyanyway, the commit which removed inf-lisp support got removed
23:47technomancyerr--reverted
23:47laurustechnomancy, cool
23:47laurus:)
23:47laurushugod, tell us more
23:47laurusHow do we do what you did?
23:48hugodI need to check what I changed
23:48laurusWell do it man! :) You sound like you figured something awesome out :)
23:48hugodI remember changing a couple of things, but it was a while ago
23:48laurusOh, well if you're too busy or don't have time, don't worry about it :)
23:50hugodlaurus: http://gist.github.com/589154 is my org-babel-clojure.el
23:51tomojhugod: many thanks!
23:51laurushugod, you rock
23:51tomojI had hoped someone would remove the swank-clojure dependency
23:51laurusSo you commented out the swank-clojure line
23:52laurusAnd some other stuff that's too complicated for me to understand
23:52laurus:p
23:52tomojhugod: needs slime, right?
23:52tomojoh, yes..
23:52hugodyes - binds to a slime session
23:53laurushugod, so how do I use this?
23:53tomojlaurus: well looks like swank-clojure.el requires slime anyway
23:53hugodconnect to a repl with slime-connect
23:53tomojso unless you want to write your own org-babel-clojure.el, you need slime
23:53laurustomoj, it's ok :)
23:54laurusI'll just bite the bullet, it's probably better anyway
23:54laurusI'm always too much of a purist with these things
23:54hugodand then org-babel-clojure-bind-session-to-repl
23:54tomojdo you hate ELPA?
23:54laurustomoj, I've never used it
23:54laurushugod, you mean run that function?
23:54tomojwell if you don't mind it it gives you a working clojure-mode+slime setup very easily
23:54laurustomoj, yeah, I guess I find a lot of this Emacs stuff really crufty and weird
23:55tomojaccept cruftiness in return for power :)
23:56laurustomoj, take a look at this if you're interested: http://sardakcode.blogspot.com/2009/02/litterate-programming-in-clojure.html
23:58tomojhmm, org-babel-clojure.el is no more
23:58laurusI know, I just think it's neat that he made that :)
23:58tomojI 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:59laurusOh, I see