#clojure logs

2011-01-24

00:14Raynesmefesto: pong
00:25mefestohey
00:25mefestoi have some basics of an interactive tutorial in there.
00:26mefestoi can push to my fork or is there some other preferred method?
01:04Raynesmefesto: Damn it.
01:05Raynesmefesto: You ping me while I'm gone, I ping you while your gone, rinse, repeat.
01:05mefestoRaynes: still on?
01:06RaynesYessir.
01:06RaynesYou can push to your fork and then issue a pull request when you think it's ready to go into tryclj. If you just want me to take a look, I'll check it out in your fork.
01:07mefestook one sec.
01:11mefestook should be there: http://github.com/mefesto/tryclojure
01:11mefestoi changed the handler so that it would return the evaluation results as a json object.
01:12mefestothis way from the javascript side the tutorial can compare the expression and results then determine if the user should move on to the next page
01:15Raynesmefesto: Looks like you put quite a bit of work into this. :o
01:15brehautive forgotten how to use fnil again.
01:15mefestoRaynes: had some spare time today :)
01:19Raynesmefesto: This looks really cool.
01:20mefestoalong the lines of what you wanted?
01:20mefestojust as an example you can type 'back' if you got a page or two into the tutorial
01:20Raynesmefesto: Precisely. It would be nice to be able to see a list of the 'lessons' and be able to switch between them somehow. Other than that, this looks great.
01:20RaynesOh.
01:21RaynesSorry, I judged the Javascript merely on length. Didn't actually pay much attention to it. ;)
01:22mefestoheh. I _think_ the lesson setup (similar to tryhaskell's) should work. But I only got that 3 page thing going so far.
01:22Raynesmefesto: Could you make examples clickable like the old tutorial examples were?
01:23RaynesOne problem with jquery-console is that it doesn't allow pasting. Apparently, purposely, thus not likely to change any time soon.
01:23RaynesOther than that, this looks pretty solid.
01:23RaynesI like it.
01:23RaynesThis is the one thing that tryclojure is missing.
01:24mefestook that shouldn't be too hard. so clicking on a code block will add that to the console and eval it?
01:24RaynesJust add it, not eval it.
01:24Raynesmefesto: Also, /j #sexpbot
02:03brehauti wrote a special form to do a more general if-let with better error handling and its cleaned up the ugliest piece of code in my xml-rpc lib
02:03brehauthttps://github.com/brehaut/necessary-evil/commit/a225d2026c3e5b6e223597ab796a85768a6948a3#L0R23
02:06amalloybrehaut: just got caught up with the #clojure backlog. still care about fnil?
02:09amalloyif so, a semi-canonical example: ##(reduce #(update-in %1 (fnil inc 0) [%2]) {:a 1 :b 4} [:b :c])
02:09sexpbotjava.lang.UnsupportedOperationException: nth not supported on this type: core$fnil$fn__5593
02:11amalloy&(reduce #(update-in %1 [%2] (fnil inc 0)) {:a 1 :b 4} [:b :c])
02:11sexpbot⟹ {:c 1, :a 1, :b 5}
02:13brehautamalloy: sorted my self out, but cheers
02:13brehautclojuredocs saved me :)
02:16brehautamalloy: i spent a while trying to work out how to use it in an -> but in the end realised that a) i was using it wrong and b) 'or' worked better
02:16amalloyheh
02:23brehautwhere is -?> defined?
02:25amalloybrehaut: clojure.contrib.core
02:25brehautamalloy: cheers
02:38brehautamalloy: did anyone submit your macro writing macros page to hn?
02:38amalloybrehaut: no idea
02:38clojurebotCool story bro.
02:38amalloyi'm barely informed enough about social-y sites to know whether i've made it to twitter :P
02:39brehauthttp://www.backtype.com/page/hubpages.com%2Fhub%2FClojure-macro-writing-macros
02:39brehauttwo tweets and no HN :)
02:40amalloybrehaut: that
02:40amalloys handy
02:40brehautyeah
02:40brehautand clojure powered :)
02:41amalloyhubpages has something similar built in: we track referrer domains for you so i can see if twitter is getting me much traffic, but directly seeing if it's been mentioned at all is neat
02:42brehautthats pretty cool
02:42amalloybrehaut: wow, and i'm actually getting google traffic, apparently. what on earth are people searching for
02:42brehauti used to use google analytics on my site but it doesnt really give me much useful info
02:42brehautpeople search for the strangest things
02:43amalloyyeah, if i get interested enough i'll hijack the corporate GA account to see how my hubs are doing :P
02:44amalloybrehaut: ah, apparently it's my first hub getting more "reputable" over time
02:44brehautcurious. is that a feature of hubpages?
02:45amalloybrehaut: an artifact of google's pageranking, i think
02:45brehautoh right
02:54xkbhi
02:55xkbIs it possible to mock out a static Java method call using clojure.contrib.mock?
02:55xkbtrying it gives me lookup errors
02:55xkb"unable to resolve var"
03:00amalloyxkb: i don't think so. i don't use mock, but i think it's basically changing the var root, which won't work if there's no var
03:01amalloyyou can instead write a pure-clojure function that calls out to that static method, and mock/stub the function
03:03xkbah.. I thought so. The error was indeed a lookup to a var
03:03xkbno binding possible without one
03:03xkbamalloy: thanks
03:12amalloyblugh, night all. why am i even still awake
03:12brehautnight
03:48Licensermorning
03:50brehautevening +1300
03:52LauJensenclojurebot: UGT?
03:52clojurebotugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html
03:52brehautthats awesome
03:53brehauti particularly like the note at the end
03:55LicenserUGT is hard to explain
03:55LauJensenLicenser: You're the only guy we've ever had problems explaining it to :)
03:55brehautLicenser: clearly you understand it well enough to use it correctly
03:55LicenserLauJensen: that is because i'm special!
03:56LauJensenLicenser: Thats right, like your momma always told you :)
03:56Licenserexactly and my momma is the best!
03:57LicenserLauJensen: btw, awesome article on the clojure redit clone
03:57LauJensenLicenser: Thanks!
03:58LicenserSo you could put in a warning that putting a reload hook on the core file is a bad idea :P
03:59LicenserThen again I'm propably the only person having trouble with that
03:59LauJensenhaha... Yea I hope so :)
04:00sandGorgonLauJensen, same sentiment here: awesome articlt - please keep on adding to it (like Sandbar support). I think its now the go-to place for web app development with clojure
04:00LauJensensandGorgon: I'll never use Sandbar, but I'd be happy to extend it further
04:00sandGorgonLauJensen, oh.. any reason why ? or is there an alternative ?
04:01LauJensensandGorgon: Firstly, sandbar seemed custom made for Compojure and secondly I just wasnt happy with the design when I went over it. I think I might release my own 'dunebar' which is more in tune with Moustache
04:02brehautthere needs to be a library called Dali that works with moustache
04:02sandGorgonLauJensen, awesome. I think auth was one of the critiques about your article .
04:02LauJensensandGorgon: Why the hate though? I showed how to build your own security middleware, thats much more valuable than seeing me pull in sandbar
04:04sandGorgonLauJensen, not so much as hate - I think people (which includes me) are wary of anything that touches security. I mean given the choice between writing raw SQL and rolling my own auth, I would take SQL anyday. I know that I am naive enough that I want to seek out and build upon other people's efforts.
04:05LauJensenIn most cases I agree. In this case, I think I should just hurry up and write Candybar
04:06sandGorgondunebar or candybar - choices, choices .. )
04:07LauJensenOr Twinky
04:09Licenserhmm is there a way to tell ring to allow path's like /edit/42 where 42 is a ID?
04:10brehautLicenser: thats higher level than ring is concerned with isnt it??
04:11Licensernot sure
04:11brehautLicenser: im only a noob, but that sounds like routing (ie moustache or compojure) to me
04:11LicenserI'd not have a problem to pick the stuff apart myself, but I didn't even managed to make a edit/* thingy
04:12LauJensenLicenser: I think I demo that in the post you just mentioned actually
04:12LauJensenBut its a quality of Moustache or Compojure, not Ring
04:13Licenserhmm might have missed it
04:14Licenserah yes true :) missed that grrrrr evil me
04:14LauJensen(app ["user" id] (delegate do-user id)) ... (defn do-user [req id] ..)
04:14brehautLicenser: ring is really simple from a code consumer point of view; it worries about different http servers and converting an incoming request into a map, calling your handler with that map as an argument, and taking the map you return and converting it back into the stuff that particular server wants for a response
04:15Licenser*nods*
04:15brehautLicenser: your handler function is a black box to ring
04:16brehautmoustache is basicly a (excuse the term) DSL for bundling a bunch of handlers together as a single handler
04:16brehautwith routing and middleware rules
04:17brehauti cant speak for what compojure does these days because i havent used it since 0.3
04:19brehautbah. apparently i have a brain disease. im wondering if moustache is a monad
04:22brehauti think it is
04:24brehautthats a sure sign i need to go to bed
04:24brehautgnite
04:41LauJensenSince nobody really knows what a monad is, I guess it could be a monad :)
04:44Licenserfor nobody knowing what it is there is many talks about monads
04:44ejacksonmorning all :)
04:45Licensermorning ejackson
04:49mduerksengreetings. monads were discussed on HN not long ago (i haven't invested the time to digest it): http://news.ycombinator.com/item?id=1997341
05:14ejacksonI just put up a blog post with the word 'monad' in it :) Feeling very manly.
05:31LauJensen:(
05:34ejacksonDon't be sad Lau, its Monday.
05:35LauJensenGood job on the post though
05:37ejacksonthanks, you were right that i'd been a bit lazy on that front
05:39LauJensen(doall ejackson)
05:39ejacksonwell, I spent last week trying to snowboard on ice, so, not really.
05:43TobiasRaedermorning :)
05:44TobiasRaederanybody using a tweaked zenburn around here?
05:47LauJensenTobiasRaeder: I was, then I inevitably went back to charcoal-black
05:49TobiasRaeder@LauJensen interesting, never heard of it. were the tweaks in your blog? i thought so wasn't able to find them with a quick google tho
05:51LauJensenNo I never commented on zenburn, didnt use it long, didnt like it too much
05:51LauJensen;(setq zenburn-bg "#1f1f1f")
05:51LauJensenThat was the tweak
05:53LauJensenTobiasRaeder: ^
05:53TobiasRaeder@LauJensen ah, thanks
05:54TobiasRaeder@LauJensen but ill checkout charcoal-black i guess
05:54LauJensenIts in the standard color-theme library, M-x color-theme-charcoal-black
05:55LauJensenTobiasRaeder: http://bestinclass.dk/index.clj/2009/09/layout-emacs-etc.html
05:58TobiasRaederill give it a try, thanks :)
06:00raekin addition, this is awesome: http://alexpogosyan.com/color-theme-creator/
06:06LauJensenwow, that is pretty epic
07:19TobiasRaederyeah, that is really awesome, thanks
07:19TobiasRaederand lau, the charcoal doesn't look bad at all :D
08:35timvisherhi all
08:36timvisheris anyone using elein?
08:37TobiasRaedernever actually heard of it
08:37TobiasRaederwhat exactly is it?
08:38timvisherit's a set of emacs wrappers around lein so that you can interact with lein via M-x commands
08:38timvisherhttps://github.com/remvee/elein
08:38TobiasRaederah nice
08:39timvisherit does indeed look quite nice
08:39TobiasRaederi just tried durendal a bit which seems to do the same on first glance
08:39timvisheralthough i'm not quite clear as to what advantages it offers me over just executing lein commands via M-!
08:40TobiasRaederautocompletion i guess?
08:40TobiasRaederapart from that im not sure either
08:40timvisherproblem is that I'm having trouble getting it to work on my mac
08:40timvisheri was hoping for a guru to magically appar in the ether. ;)
08:41TobiasRaederhehe what problems exactly?
08:41timvisherI can't get the swank server to run
08:41TobiasRaederill give it a try real quick
08:41TobiasRaedernot using os x tho
08:41timvisherin the source I read that 'elein-standalone-swank-command "~/.lein/bin/swank-clojure"' is how it tries to execute swank, maybe
08:42timvisherbut I'm not sure how to set that up
08:42timvisherI'm fairly new to both lein and elein so I don't really grok it's structure yet
08:42TobiasRaederinteresting, i dont even have a bin folder in ~/.lein
08:43timvisherexactly
08:43timvisherI don't either
08:43TobiasRaederso it's probably something custom the author wrote (would be my guess atleast)
08:43timvisherand the post I was reading about getting it set up (http://blog.gaz-jones.com/post/2486737162/setting-up-clojure-development-on-osx-using-emacs-and) doesn't mention anything about creating it.
08:44timvisherI'm assuming the same
08:45timvisheraha
08:45TobiasRaedermhm?
08:46timvisherinterestingly, I had forgotten to include swank-clojure in the project.el file
08:46TobiasRaederoh you need a project.el for elein aswell?
08:46TobiasRaedermhm
08:46timvisherdoing that and then running lein deps (via M-!) and then running elein-swank leaves me with 'error in process filter: Symbol's function definition is void: slime-set-inferior-process'
08:47TobiasRaederdo you have slime and slime-repl setup?
08:47timvisheryeah
08:47timvisherthat all works fine
08:47timvisherat least as far as I've been able to tell
08:47timvisherI was mostly doing dev with inferior lisp until about a week ago
08:47TobiasRaederwell if you can do lein swank in a shell and slime-connect it should be alright ;)
08:48timvisherthat's true. I'm just intrigued by elein and I'm trying to follow this tutorial just for fun (http://blog.gaz-jones.com/post/2501842155/interactive-clojure-development-in-emacs-with-leiningen)
08:49TobiasRaederyeah
08:49TobiasRaederwell what seems a bit 'weird' to me right now is that you apparently have to create and maintain a project.el aswell?
08:49TobiasRaederwhich seems a bit unneeded atleast for me right now
08:50timvisherthe idea at the moment seems to be that once you're in a lein project, created via `lein new` I suppose, you can use elein to transparently communicate with it.
08:50timvisherseems to be being more trouble than it's worth at this point.
08:50TobiasRaederyeah
08:50TobiasRaederright now it does
08:50TobiasRaederyou might wanna try durendal tho, no support yet for most lein commands but starting a swank server, connecting to it etc works just fine
08:51TobiasRaederand the deps etc should be fairly easy to implement yourself really
08:51TobiasRaederand it doesn't require you to keep track of project.el etc
08:51TobiasRaederhttps://github.com/technomancy/durendal/ if you care
08:51timvisheri've actually installed that via elpa
08:51timvisherhaven't messed with it yet thouugh
08:52timvisherthe only reason I'm checking out elein is because of the tutorial
08:52TobiasRaederah okay :)
08:52timvisherI'm used to switching to the Terminal to interact with my build tool so the rest would just be icing
08:52TobiasRaederwhats really nice (atleast i like it) is the durendal-sort-ns
08:52timvisherannoying icing at this point. ;)
08:52TobiasRaeder;)
08:53timvisherthat does read like a nice addition
08:53timvisherwell we shall continue to explore... ^_^
08:56TobiasRaeder:D
08:57TobiasRaederif you wanna have something like elein-deps https://gist.github.com/793238
08:57TobiasRaederit's really badly hacked together but it works for now ;)
09:14AWizzArdhttp://www.skuro.tk/2011/01/24/performance-boost-in-clojure-1-3/
09:16tonylthanks for the share, I'll take a look
09:20LauJensentonyl: It was like 2 minutes ago. AWizzArd posted on in here, old chap
09:23tonylLauJensen: hehe yes, thanks for the logic, I guess I meant before AWizzArd posting it. Brings back memories
09:26LauJensenI know - Was making a joke :(
09:29tonylI am poor at understanding jokes by text :S something I haven't get used to
09:40LauJensentonyl: Its a common thing. Usually when I make a joke in one of my blogposts, HackerNews is consumed by rage for about 12 hours at a time because they dont see the humor in it :)
09:40LauJensenI cant be annoyed though, since its just more hits for me :)
09:41fliebelLauJensen: I missed the first bit. You said something controversial again? :)
09:42LauJensenfliebel: I just said that its a common thing that people dont get my jokes
09:42fliebelOh, right.
09:49jweiss_looking for a little advice writing an error handling lib similar to clojure.contrib.condition - i want to avoid any unnecessary overhead of setting up error handling when no error is actually thrown. would it be more efficient to just store the handler function *forms* at the start, and only evaluate them if an error occurs?
09:50jweiss_i somehow envision getting bitten by that
09:50Chousukethat sounds complicated
09:51jweiss_you think the performance boost might not be worth it?
09:51ChousukeCan't you just have the handlers be functions and call them only when an error occurs?
09:52jweiss_Chousuke: yes, that's what i am doing now. but since my with-handlers macro doesn't HAVE to even create those function objects at the start, i thougt maybe it shouldn't.
09:52Chousukejweiss_: the function objects are created at compile time, they're pretty much free.
09:53jweiss_ah that's right
09:53Chousukeprobably more memory-efficient than storing the forms, too.
09:54jweiss_ok good then i am done :) thanks Chousuke
09:58fogus`Have I lost my mind, or are these needed/missing from Clojure? https://gist.github.com/790187
10:00opqdonutyeah they're missing
10:01fogus`Maybe there is an obvious way to get the same that I am missing?
10:03chouserfogus`: I suspect they're missing more because they've not been needed much rather than because there's a tidy way to write them when they are needed.
10:05fogus`chouser: Do you know of a tidier way in any case?
10:06chouserhaven't thought of one in the last 5 minutes. :-)
10:07fogus`I'll take that as a win. ;-)
10:07timvisherIn Java, i'm used to declaring pretty much all of my functions as private and then bumping their visibility when that becomes a problem. I like how my public contract sort of emerges that way. Is it non-idiomatic to do similar things in clojure i.e. declaring all of my functions with defn- and only bumping them to def when I need access to them outside the namespace?
10:08fogus`chouser: Think it's worth pitching as inclusions to 1.3?
10:08chouserfogus`: the normal route used to be to put such things in contrib first and let demand build from there.
10:09chouserI dunno if that's still the best route or not, with new contrib.
10:09fogus`chouser: Hmmm. I'm a little foggy on how to get things into the new contrib :-(
10:10fogus`Although, I assume the pitch is the same, but with contrib as the target (duh)
10:10arkhif anybody has time to glance at this, I've been unable to get this exception handling to work : / https://gist.github.com/793340
10:11chouseryeah. certainly worth a pitch somewhere. I don't see even an old contrib namespace that looks terribly appropriate, though.
10:11chouserseq-utils might be the closest, except of course there are no seqs involved so it's a pretty poor fit. :-P
10:13fogus`Maybe wherever things like curry/uncurry go? Actually, I am not sure if they even exist in contrib either. :-(
10:13LauJensenWhy was http.agent deprecated from contrib?
10:15LauJensenWas it because chouser tried to stuff it in seq-utils again?
10:17chouser(and (every? pos? coll) (every? even? coll)) meh
10:20shortlordI quite often have the problem that I need to manipulate certain vars in through methods and don't want to pass these vars (e.g. I have defined a board and want to perform actions on this board from other namespaces without always having to pass the board as an argument). But that would mean that I'd constrain function reusability, right?
10:20shortlordis there any good way to do this or do I have to define 2 functions every time, one generic and one who wraps the other and passes some predefined arguments?
10:25LauJensenCould we please get some more votes on http://dev.clojure.org/jira/browse/CLJ-714 ?
10:29Fossishortlord: how did you define your vars? globally?
10:29chouseris there a way to un-vote?
10:32fogus`hear hear
10:34shortlordFossi: yes, they are globally defined in one namespace (the board namespace), not I'd like to call something like 'change-board' from another namespace without always specifying the board
10:35LauJensenfogus`: ?
10:36Fossisounds like it's breaking the functional programming idea quite a bit and will be ugly in testing etc anyway
10:37Fossibut, yeah, i guess defining 2 functions would be the way to go
10:37Fossiat least you can at least write a with-board or such for testing
10:37Fossi-at least
10:39shortlordFossi: how would I write the whole thing without breaking functional paradigms?
10:40devnmaybe im missing something, but why are you averse to passing around a var?
10:44mefestodoes leiningen have a :repl-init-script but for lein swank ?
10:44shortlorddevn: that would mean that every single time I want to place something on the board, I'd need to pass the board as an argument
10:45shortlorddevn: worse, the board is only one of the things that need to be passed as arguments, there is also a list of buildings, a placement of a special token, the inventory of players. there are methods who need all of these as arguments, it would be quite clunky to call them always directly with all the arguments
10:46chousershortlord: you might consider putting all those things together in a single value, such as a map or record.
10:46shortlorddevn: but I guess the right way to do it would be to turn all these functions into closures and pass them the value once and then use the closure to avoid passing these things again, right?
10:46chouserthen it's easy to pass them as a single arg, and as a bonus you have a single value that descibes the state of your system.
10:47Fossiyeah, generally, you *want* to pass all those all the time, so that your code is stateless/functional
10:47shortlordchouser: the board is already a rather complicated map, the same is true for the player inventory and the list of buildings. I had planned to use the namespace as some sort of capsulation for these things instead of putting them all into an even bigger map
10:48Fossiif you have to pass all the stuff all the time chances are that your design is flawed somewhere
10:48fogus`LauJensen: I don't care too much for #| ... |#
10:48LauJensenfogus`: why not?
10:49Fossifor example for a game loop i have written, i don't modify the data directly, but create an array of modification operations
10:49fogus`I think it goes about solving that problem in the wrong way
10:50LauJensenfogus`: What would be the right way ?
10:51fogus`We already have #_ so might it be better to modify that to completely ignore the internal form?
10:51fogus`(btw, I don't know the right answer... I'm soliciting advice)
10:51shortlordFossi: well, this kind of "modify indirectly" could be done through closures, right? So that I have a generic build function and then generate a more specific build function that is bound to a specific board, that is passed exactly once
10:52LauJensenfogus`: Thats a good idea
10:53Fossiwell, most of the time you want to avoid to carry around state somewhere where it's not so visible
10:54Fossistateful global vars are gonna bite you in the behind sooner or later
10:55Fossii tried to keep the modifying of state out of the 'business logic' by passing in an immutable state and the 'events' and returning said modifying operations
10:55Fossithen in another pass i go over the objects and apply those
10:56wjlroeI have a problem using clojure.string/replace and running a test against it. When I test equality in the repl using (= ... it works, but using a deftest, I get this error:
10:56wjlroeexpected: (= "faxes" (apply-sxz ["fax"]))
10:56Fossimakes for easy debugging
10:56wjlroe actual: (not (= "faxes" "[\"fax\"]es"))
10:56fogus`LauJensen: Great... I'm glad to know that I'm not totally out of my mind. Think it would help if I added a similar comment to the case?
10:56shortlordFossi: wow, that's quite a nice idea
10:56LauJensenfogus`: I think so, yes
10:59shortlordis it not possible to use 'nil' as a test-statement in a case expr?
11:02fogus`LauJensen: Added
11:05mrBlissshortlord: http://dev.clojure.org/jira/browse/CLJ-702
11:06jweiss_anyone have an opinion on this - i have a macro where in practical use, the first arg will be the same 99% of the time (the kw :type) I could create another tiny macro for convenience but giving it a meaningful name would end up as more typing for the programmer than just specifying the argument every time. on the other hand, an extra macro seems like better documented code.
11:10ordnungswidrig1hi, how can I empty (truncate) the simple repl buffer?
11:10robonobojweiss: make the macro without the :type kw the one with the longer name?
11:10robonoboordnungswidrig: do you mean clear it? put the prompt at the top?
11:11ordnungswidrigrobonobo: yes, there a currently 78k lines which make my emacs slow
11:12robonoboah, in emacs
11:14robonoboi've been looking to do that as well, not because it makes emacs faster, but because i'm ocd about having my prompt at the top
11:15robonobowith the lein repl it's just Ctrl-L, like in bash
11:16ordnungswidrigI forgot how to do that. I know there was a command
11:17robonobothe trouble is that in slime, C-l doesn't do what you'd expect.
11:18mrBlissordnungswidrig: try C-c M-o or C-c C-o for the last output
11:19ordnungswidrigmrBliss: ah, nice. thank you!
11:22LauJensenAm I correct in saying that the Apache Commons Http Client PUT method can only send a file OR a string but not both as POST can ?
11:29robonobomrBliss: yes! finally!
11:32AWizzArdDoes Clojure use Red-Black trees to implement sorted sets and maps? Are these "ordinary" RBTs or are they left-leaning RBTs?
11:33chouserAWizzArd: yes. I don't know.
11:33leafwAWizzArd: the source code would tell you right?
11:33AWizzArdLauJensen: while we are at it: how can I add a body for DELETEs?
11:33AWizzArdchouser: oki thanks, so they are RBTs.
11:35AWizzArdLauJensen: for HttpPut/HttpPost 'm' I can do a .setEntity. Example: (.setEntity ^HttpEntityEnclosingRequestBase m (StringEntity. body "UTF-8"))
11:36robonoboshould a JPanel agent that is sent messages to have it draw something on itself behave like normal? the draw-function calls fillRect on the graphics of the panel and then returns panel unchanged.
11:47LauJensenAWizzArd: I think (hope) that both PostMethod and PutMethod can accept an array of parameters, which can be both FilePart and StringPart
11:47LauJensenIt works well for PostMethod
11:56technomancymefesto: :repl-init-script works for swank too in recent versions
11:56ordnungswidrigAWizzArd: I don't think a DELETE request body is encouraged by the spec
11:59ordnungswidrigAWizzArd: "The DELETE method requests that the origin server delete the resource identified by the Request-URI." says RFC2616. I don't see what a request body can add to this
12:00shortlordcan you recommend any books that teach functional programming principles? It doesn't need to be for any particular language (although clojure/lisp/haskell would be fine), but it should contain a detailed description of the ideads behind functional programming like closures and currying and so forth
12:00mefestotechnomancy: i'm keeping my init.clj script under test, is that not good?
12:01mefestotechnomancy: in project.clj i have :repl-init-script "test/init.clj"
12:01technomancymefesto: yeah, that makes sense
12:01mefestotechnomancy: lein repl works find but when i do a lein swank and connect from emacs it doesn't seem to load
12:01mefestowork *fine
12:01Rayneschouser: Aw, you don't support the multiline comment proposal. :<
12:01technomancymefesto: maybe an old swank?
12:02mefestotechnomancy: swank-clojure 1.2.1
12:03technomancytry 1.3.0-SNAPSHOT
12:04robonoboRaynes: where might i find this proposal?
12:04Raynes http://dev.clojure.org/jira/browse/CLJ-714
12:04mefestotechnomancy: that was it. thanks.
12:06RaynesThe only reason not having them feels reasonable is if #_ works like fogus proposed in comments. I know this adds complexity, but it's a comment form. I'm not sure how complex you can get with that.
12:09robonobowhy not stick with the common list syntax for comments?
12:10RaynesI'm not sure I follow.
12:10robonobos/list/lisp
12:10sexpbot<robonobo> why not stick with the common lisp syntax for comments?
12:10RaynesThe syntax that patch adds *is* the Common Lisp syntax for comments, I believe.
12:14robonoboRaynes: I think I got the names in Jira vs irc mixed up
12:14RaynesI don't really expect it to be accepted. #_ is 'close', it's just that 'close' but no cigar irks the hell out of me.
12:16robonoboI don't really get the syntax complexity argument, when it's been in CL since the dawn of man
12:17Raynesrobonobo: Admittedly, CL isn't the pinnacle of marginal complexity. ;)
12:18robonoboyes, of course
12:18robonobobut it would be a nice addition for those coming from there
12:20robonobois it a stated goal of clojure's to adhere to the lisp syntax as much as possible?
12:21devnRaynes: I like your comment on the literate programming tools
12:21RaynesNot really. Clojure tries to relieve itself of painful Lisp syntax in a lot of cases.
12:21Raynesdevn: I'm not sure if this would actually be helpful, but it feels like it would.
12:22technomancyrobonobo: if you are talking about Common Lisp you should use its full name. calling it "lisp" is confusing.
12:22devnReading down the comment list, I agree with chouser && fogus
12:22devnThe additional syntax is unecessary
12:22RaynesI don't think it's the syntax that is the problem here as much as it is the *addition* of syntax, and I can understand the desire to keep such things out. But it is a missing feature.
12:23RaynesIt's a free country.
12:23msapplerhey is there some automated way of renaming a namespace across multiple files
12:23amalloymsappler: perl :P
12:23RaynesPerl.
12:23Raynesamalloy: o/
12:23devnmsappler: someone wrote something like that, his github handle starts with a b
12:23devnthat's all the info I have :D
12:24Raynesamalloy and I actually did use perl to do that in sexpbot once.
12:24RaynesIt worked surprisingly well.
12:24amalloymsappler: $ find . | xargs perl -pi -e 's/foo\.bar/foo.baz/g', but don't quote me on it
12:24devnI think I have a script lying around somewhere that does it actually
12:24amalloywon't work if, eg, you're doing stuff like (use (foo bar sam))
12:25msappleror is there a way to do that in clojure? Edit files on the form-level not string level maybe?
12:25Raynesdevn: I'm tempted to agree with fogus as well. If #_ worked the way he proposed, it would be fine.
12:25amalloyRaynes: i just added a comment replying to fogus; i don't think that's possible really
12:25ohpauleezFor simple find and replace/rename, I'd just use sed
12:26msapplerwell its not simple ... because it depends on the package
12:26Raynesamalloy: Regardless, *if* it worked that way, I wouldn't mind.
12:26amalloyRaynes: that's probably fair
12:26msappleri want to reuse my game.utils.misc to game.utils.core and there are other namespaces called misc
12:26msappler*reuse -> rename
12:27amalloymsappler: try my perl thingy at the bash prompt?
12:27msapplernope I have no perl ;) and dont understand it ^^
12:28ohpauleezmsappler: sed should easily do that for you
12:28msapplerwhat is sed?
12:28ohpauleezare you on a *nix OS?
12:28msapplernope windows ^^
12:28ohpauleezhmm, nvm then
12:28ohpauleezsed is a stream editor
12:29ohpauleezit performs a macro edit on all files you pass to it as a stream
12:29ohpauleezmuch like how the perl was working up above
12:30msappleri read a lot of developers use linux instead of windows ... someone can explain the advantages ?
12:30msapplersomething i missed maybe ? ^^
12:31ohpauleezmsappler: Unix and unix-like operating systems are basically just a big ol' tool chest for developers
12:31robonobomsappler: lots of devtools (like sed)
12:32fliebelmsappler: You don't have sed, nor GCC. and I heard emacs is a pain on Windows.
12:32ohpauleezthe philosophy of how tools can be linked together, piped, combined, is a very similar philosophy to how functions are written and applied in Clojure
12:32robonobomake, gcc, all major scriping languages out of the box, emacs,
12:33ohpauleezadditionally, accessing and monitoring the raw resources and interfaces on your computer are much easier
12:33msappleris there some place where I can start reading about linux and the advantages/tools that is gives me as a developer
12:33ohpauleezfor example, I can "cat" (read) the stream of data from my mouse to the console/command-line
12:35amalloyohpauleez: i could probably use a lot less perl in my life if i knew how to use sed
12:36ohpauleezmsappler: I'd just thumb through the RSS streams for Linux Journal and Linux Magazine. If you like books, there's an older book called The Practice of programming by Rob Pike
12:36fliebelamalloy: have you tried 'cake filter'?
12:36ohpauleezamalloy: Yeah, sed rocks pretty hard. I rarely use perl for substitutions like that
12:37robonoboamalloy: sed is nice for onliners, but a complete pain to use for anything complicated
12:37tonylawk
12:37ohpauleezamalloy: This is very true ^
12:37robonobotonyl: yes. much better
12:37fliebeltonyl: Thanks! I was lookign for the name...
12:37amalloyohpauleez: tbh though i'm pretty comfortable with perl and don't care about the extra...what, 20 characters it takes over sed?
12:37amalloyfliebel: cake filter is neat. i forgot all about it
12:38ohpauleezI have yet to really get any sort of mastery with awk. If it's more than a one-liner, I fall back to Python or Perl
12:38tonylalthough I don't use it that often, but oh it saves me precious time when needed
12:38ohpauleezmsappler: Also take a look at Rob Pike's "The Unix Programming Environment"
12:39Raynesohpauleez: I wrote a shell script in Clojure to compile the sources of my book to a PDF for me.
12:39ohpauleezagain, these books are dated, but the philosophy is still there
12:39Raynes:D
12:39ohpauleezRaynes: Out. of. control.
12:39ohpauleezhaha
12:39msapplerthanks very much i will look into that
12:40ohpauleezmsappler: I'm happy to help
12:43fogus`amalloy: I responded to your comment, but as a summary I would just say "so be it." ;-)
12:48devnsed + awk, the original
12:48ohpauleezyes
12:48ohpauleezthe combo really is the trick
12:52RaynesDoes anyone know if *current* swt jars are kept in any maven repository somewhere?
12:53jweiss_anyone have any experience publishing to their own (on a corporate network) maven repo? afaict, leiningen doesn't seem to do this
12:54jweiss_i know a maven repo is just a filesystem, but it's not exactly trivial to create the right directory structure.
12:54amalloyjweiss_: lein install
12:55amalloyinstalls it locally, then you can just tar/untar in the other repo
12:56jweiss_amalloy: yeah, but i don't want to tar/untar the entire repo, just the thing i just installed
12:56jweiss_how can i even tell where it went?
12:56jweiss_i mean, i could browse the repo myself, but i want to grab it programmatically
12:57amalloyjweiss_: you could check out the source of cake's "release" task
12:57amalloywhich pushes to clojars specifically, i think
12:58technomancyjweiss_: 1.5.0-SNAPSHOT has a lein deploy task for pushing to archiva and friends.
12:59amalloyand it looks like cake deploy is designed to push to whatever server that supports ssh, if you pass it the right options. i'm not sure how hard it would be to supply those options
13:00jweiss_clojars lets you push with scp without having to specify where everything needs to go
13:00jweiss_maybe i should just run clojars myself
13:01jweiss_i was trying to avoid adding another piece of software
13:01technomancyjweiss_: archiva is a lot easier to set up than clojars, plus it does proxy caching
13:03jweiss_hm, i guess i can't get away with just a plain filesystem
13:03jweiss_i'll have to add tomcat to the mix
13:04jweiss_technomancy: you mentioned somewhere a while back that it wasn't that hard to get hudson to publish to my own maven repo - i looked around but i couldn't figure it out
13:05jweiss_http://stackoverflow.com/questions/3468461/push-to-nexus-using-leiningen
13:06jweiss_i already have a hudson server running
13:07technomancysure, you can just have your hudson task execute "lein install" as the last step, then use nginx or whatever to serve hudson's ~/.m2/repository over static HTTP. archiva is nice for other reasons, but hudson+static is simplest.
13:07jweiss_technomancy: the problem with that is, ~/.m2 is on the hudson slave, not on the master hudson server.
13:08jweiss_and we have many slaves, it's nondeterministic which one will do the build
13:08technomancyok, in that case you'll need to use lein deploy.
13:08jweiss_technomancy: ok thanks
13:14mattmitchellcould someone point me in the right direction for simply connecting to mysql and selecting etc.?
13:15LauJensenmattmitchell: http://clojureql.org
13:15LauJensen(use 'clojureql.core) @(table db :users) will run SELECT * FROM users on the connection 'db'
13:15mattmitchellLauJensen: you prefer that over clojure.contrib.sql ?
13:15LauJensenmattmitchell: definitely
13:15mattmitchellLauJensen: ok i'll have a look. thanks!
13:16LauJensennp :)
13:31meliponewhat does DSL mean in the context of clojure? I read about building DSL but I don't know what that means
13:31semperosDomain Specific Language, more than likely
13:32semperosbuilding in abstractions unique to your problem that make coding the application feel more "domain specific" than default Clojure
13:32meliponesemperos: thanks
13:32semperosnp
13:32meliponeok, I guess that's what Lisp and now Clojure do well
13:33semperostechnically, Clojure is a Lisp, and yep, Lisp's facilitate it very well
13:40mattmitchellLauJensen: OK trying clojureql now, but keep getting this error: java.sql.SQLException: No suitable driver found for jdbc:mysql://127.0.0.1:3306/providence_development (db.clj:15)
13:40amalloymattmitchell: you need to install a jdbc driver. i think clojureql tells you how to do that somewhere
13:41amalloybut basically it's just a one-line addition to project.clj
13:41mattmitchellamalloy: ok great thanks!
13:43LauJensenmattmitchell: Use this for MySQL [mysql/mysql-connector-java "5.1.6"]
13:43LauJensenI think its the most recent
13:43mattmitchellLauJensen: excellent thank you
13:44mattmitchellLauJensen: awesome, working :)
13:45LauJensenGreat - If you have any questions feel free to shoot here or join us in #clojureql
13:46mattmitchellLauJensen: cool just getting ready to go there now
13:46LauJensenBut as you can see, ClojureQL is so elegantly designed that even amalloy can figure out how to use it
13:48LauJensenamalloy: still waiting for the PHP version? :)
13:57amalloyLauJensen: you bet
14:03Scriptora PHP version of clojureql, you say?
14:04amalloyScriptor: yeah, php has HOFs and parentheses, it should be a trivial port
14:04amalloyfor someone of LauJensen's calibre
14:05LauJensenScriptor: I was just messing with amalloy who's a leading authority on PHP
14:06ScriptorI figured :) I should look more into relational algebra anyway
14:08LauJensenYea its pretty sweet
14:24Licenseraloa
14:48devnaloha
14:49raekIntroducing my new blog: http://blog.raek.se/2011/01/24/executors-in-clojure/
14:51LauJensenlooks a little boring, especially I find the blogroll lacking ... :(
14:52fliebelraek: At least it's not twentyten...
14:57fliebelraek: Do you mind if I steal the read eval blog loop for a command line blogging client? :) But I think I will use another reading function. (are you blogging Clojure forms?)
14:57chouserraek: I like the clean presentation.
14:57chouserraek: typo: taks
14:57fliebelchouser: It's Automattic.
14:58raekLauJensen: lacking a certain blog from Scandinavia? ;-)
14:58raekdon't worry. I added you.
14:58LauJensenraek: oh yea now that you mention it :)
15:00raekchouser: thanks!
15:01raekto bad WP-Footnote does not support nested footnotes...
15:01LauJensenraek: Nice read - Look forward to seeing more from you
15:03fliebelhttp://blog.raek.se/wp-content/themes/thematic/readme.html doh, I should stop doing that...
15:05fliebelraek: You should consider this to spice up your blogroll :) http://wordpress.org/extend/plugins/rss-blogroll/
15:33timvisherSorry for the stupid easy question, but how can I turn `(:width
15:33timvisher "1024" :height "1024")` into `{:width "1024" :height "1024"}`?
15:33timvisherI've tried `(into {}...` and `(apply map...` but I'm missing
15:33timvisher something obvious
15:33technomancyapply hash-map
15:34timvishertechnomancy: brilliant. :)
15:34timvisherwow
15:34timvisherI was about to ask "is there even a map function" and just realized that I was trying to use map i.e. map/reduce...
15:34timvisherI'm an idiot...
15:34timvisher^_^
15:35timvisherah well, all in the name of project
15:35timvisherprogress*
15:35technomancythere are only so many English words out there
15:43RaynesLauJensen: ping
15:48meliponeokay, now I have my functions working in a .clj file. I put (myfunction args) at the end of the file. How do I execute that now in batch?
15:49raekmelipone: with or without cake/lein?
15:50technomancymelipone: move (myfunction args) into the -main function, then use "lein run" or create an uberjar depending on how you want to launch it.
15:51technomancytop-level forms that don't start with "(def ..." are almost always not what you want
15:51meliponeIs it possible to run it without lein?
15:52technomancypossible but probably not worth the effort
15:52meliponeI don't understand what "move (myfunction args) into the -main function" means
15:52technomancyunless you're talking about distributing to users; that's what uberjar is for
15:52tonylhttp://www.glenstampoultzis.net/blog/2010/06/01/self-running-clojure-batch-file/
15:55meliponedoes that mean that I give my .clj as an argument to clojure.main?
15:56tonylmoving it to main like (defn main [args] (myfunction my-args)) has the same special case as the main function in a java class
15:57meliponeI didn't know that, thanks.
15:57tonylif you want to keep it simple use lein or cake or a similar program to run the clojure code
15:57raekaren't the args passed as separate parameters? i.e. (defn -main [& args] ...)
15:57tonylor java -cp clojure.jar clojure.main myfunction.clj
15:58tonylraek: you might be right
15:58tonyldouble checked and raek is right on that one
15:58Raynestonyl: It's -main, with the hyphen, and there aren't any special cases. it just so happens that if you name a function -main and then gen-class it, a Java class with a main method corresponding to your -main function is created.
15:59tonylthank Raynes for clarifying :)
16:00technomancythere is a special case actually: java -cp [...] clojure.main -m my.namespace targets my.namespace/-main without AOT involved
16:00meliponedo i still need to do that when passing it as an argument to clojure.main?
16:00Raynestechnomancy: In what version of Clojure?
16:00meliponetechnomancy: that answered my question
16:00melipone1.2.0
16:01technomancyRaynes: new in 1.3.0
16:01Raynestechnomancy: So your patch got accepted? Cool.
16:01technomancyeven though the patch was written aaaages ago =\
16:01Raynestechnomancy: Shhhh, or this will end up on Hacker News. ;)
16:04fliebeltonyl: The hyphen is the prefix for AOT'ing methods, by the way. So It's just main compiled to a method, nothing special on the Clojure side.
16:05tonylso instead of creating a class out of -myfun it compiles to a java method?
16:05amalloyanyone have suggested syntax-highlighting colors for clojure?
16:07amalloyfliebel: i'm adding clojure-oriented css to something and my colors are always ugly
16:07LauJensenRaynes: pong
16:07RaynesLauJensen: Never mind.
16:08fliebelamalloy: I like browns, greens and purples, not to bright. What is the CSS for?
16:08LauJensenamalloy: Just follow the lead of charcoal black
16:08fliebelLauJensen: Does ClojureQL do transactions?
16:08LauJensenfliebel: Right now you can use contribs transaction macro, but Im putting in my own soon
16:09amalloyfliebel: i've started writing bloggish things like http://hubpages.com/hub/What-is-Clojure, and the syntax-highlighting module doesn't have any lispy-languages yet
16:09LauJensenThats a problem most people run in to. One solution is htmlize
16:10fliebel… or Gist
16:10amalloyfliebel: would if i could
16:10fliebelamalloy: what prevents you?
16:10amalloyhubpages only gives authors limited control over the html
16:10fliebelah, no JS and stuff...
16:10amalloyright
16:10Raynesfliebel: I used gist once, and about 5 seconds after I hit 'publish', Github had a major database catastrophe.
16:11amalloyi work there so i can add some backend highlighting support for any code marked as "clojure"
16:11RaynesNever again.
16:11amalloybut i can't let users in general do it
16:11fliebelRaynes: I'm on Posterous, and they do horrible things to your code if you paste it in an email.
16:12Raynesfliebel: So does Wordpress if you use the visual editor. Which is why I wish Raynes would get off his ass and write that offline blogging client he talks about so much.
16:12fliebelBut the stupid thing is that they do horrible things to your whole post if you try to export and go to Wordpress, or something else...
16:13fliebelRaynes: I havn't heard you about it. Tell me more :)
16:13tonylfliebel: don't you just post the link to the gist and posterous formats it for you?
16:13Raynesfliebel: All blogging clients suck. My wont. Explanation complete.
16:14fliebeltonyl: They just embed the gist basically, but for feeds, they do render a static version, which never looks like it is supposed to, with tables and missaligning line numbers...
16:14RaynesMine*
16:15fliebelRaynes: But is it a baker?
16:15RaynesBaker?
16:15fliebelStatic site generator. Basically Markdown in, HTML out, end of story.
16:16RaynesI haven't actually figured out how I plan to do it. In any case, there wont be a 'visual editor', because those things are nothing but trouble. Markdown is a nice idea.
16:16fliebelI attempted one with devn… twice. It still lives at https://github.com/pepijndevos/utterson
16:19fliebelIt work much like an automated version of me, maintaining a static website. When I edit the Markdown, it uses Enlive to *edit* the website. So editing the HTML structure can be done on the site itself, and using Enlive to replicate the changes to the other files.
16:20fliebelIt would be cool to make it based on the lenses principle, so that editing the content updates the markdown files as well :)
16:20fliebelRaynes: I think there are Markdown editors for Wordpress around...
16:22fliebelhttp://michelf.com/projects/php-markdown/
16:26LauJensenfliebel: There's also an extended PHP markdown, which is much better
16:52brehautmorning (UGT)
16:53tonylgreetings
16:58tibbeAnyone have insight why PersistentHashMap2 is better than PersistentHashMap? My guess is that it's either faster, smaller or both but I'd be curious about the insights that led to the new design. Anyone knows?
17:01chousertibbe: where are you seeing that?
17:01hiredmancgrand has a clojure fork with a leafless branch
17:01chouserah
17:01tibbechouser: in the GitHub repo e.g. https://github.com/clojure/clojure/commit/eedcf35479737ab1136e3b8a00b2759190a73fdb
17:02tibbehiredman: the current version looks leafless to me. do you have a link to that particular repo, maybe the commit messages have more info
17:02nickiki guess is black magic
17:02hiredmanpossibly I am confused
17:03chouserwow, a lot less code
17:04fliebelWhat is new about this second coming of the PersistentHashmap?
17:04chouseroh, nm, I misread the patch
17:04chouserthis is from 2009
17:04tibbe@seen cgrand
17:05hiredmanthe license change from bsd back to epl
17:05tibbefliebel: it might not be that new
17:05chouserthat sounds like it was circa transients
17:05tonyl$seen cgrand
17:05sexpbotcgrand was last seen quitting 1 week and 2 days ago.
17:05chouserhm, maybe not that either.
17:06hiredmaninteresting to look at the history of a single file
17:06hiredmanI wasn't aware it was ever bsd licensed
17:09chouserthat may have been done to allow the standalone java project and/or porting to use with Scala
17:09tibbeseems like the leafless version is a bit faster, especially in the transient case
17:09hiredmanright, but then the change back?
17:13fliebelhiredman: That change was reverted? Or do you mean the license?
17:15chouserI think I saw someone ask if the license change back to EPL was intentional and if it would stay that way, and Rich said "yes"
17:15chouserthough I'm not finding that now.
17:16chouserah, here it is: http://groups.google.com/group/clojure-dev/msg/92e068cd2c5bbed7
17:21mattmitchellwhat's the recommended json library for clojure?
17:21mattmitchelli've seen clj-json
17:22mattmitchelloh i guess there's one in contrib
17:22ohpauleezmattmitchell: I'd use clj-json
17:22ohpauleezit's much faster than the contrib lib
17:22mattmitchellohpauleez: oh really? cool thanks.
17:22ohpauleezit uses Jackson under the hood
17:39djpowellanyone online with clojure-dev@googlegroups admin abilities?
17:42phenom_can someone help me out with this error when binding a function to something new? http://pastie.org/1494322
17:43amalloyphenom_: you must be using clojure 1.3
17:43amalloyvars aren't automatically rebindable as of 1.3; you want (defn ^:dynamic with-log [...] ...), i believe
18:19shortlordwhen should '!' be used in function names? whenever they have side effects?
18:21ohpauleezshortlord: Yes
18:22ohpauleezanytime manipulation/descruction happens (ie: there are side effects), you should append a ! to the function name
18:22ohpauleezdestruction*
18:23shortlordohpauleez: so why have so few of clojures built-in functions the exclamation mark? ref-set or println for example
18:24ohpauleezshortlord: those happen in a transaction
18:24ohpauleezso the do-sync is sort of liek one big !
18:24ohpauleezdosync*
18:26shortlordohpauleez: ah, makes sense (except for the println ;)) thx :)
18:26ohpauleezshortlord: np, glad I could help
19:03shortlordwhat are good books to get a deeper understanding of functional programming? On Lisp? (does not necessarily have to be about Lisps)
19:06brehautshortlord: The Little Schemer, Real World Haskell, SICP
19:07brehautthe second two are available on the net for free
19:10shortlordbrehaut: thx :)
19:14brehautwhenever i see the 'fs' library mentioned, i expect it to contain (def fs (repeat \f))
19:14brehauti have no idea what it really is
19:15pdkfile system?
19:15peregrine81this may be off-topic but does anyone have experience using screen over ssh and screen is black and white but the term is colored?
19:15brehautoh. of course
19:16brehautperegrine81: ssh has options to send terminal settings to the host machine, maybe the wrong ones are getting sent (or not sent)
19:17brehauti cant tell you waht they are because ive completely forgotten it all
19:18peregrine81brehaut: i'm using my cr-48. when I ssh in the base ubuntu terminal is colored. but when I use screen its black and white. Everything within screen is greyscale everything detached is colored
19:19brehautperegrine81: im out of my depth sorry
19:20peregrine81brehaut: ha, thanks, more help then i got from #ubuntu... most of that channel is "my youtube doesn't work"
19:21brehautperegrine81: thats depressing
19:21brehaut#screen perhaps?
19:21peregrine81good idea!
19:34chouser!who
19:34chouserer, sorry
20:17devnperegrine81: i'd make sure your TERM and TERMCAP are correct
20:52Scriptorin Clojure/other functional languages, how common is it that you have to iterate through a map, as opposed to just fetching items?
20:55amalloyScriptor: pretty common, i should think
20:56tomojsurely common in clojure
20:58Scriptorthought so, trying to figure out how clojure optimizes it now
20:59brehautthey just implement seq like everything else
21:00tomojfor hash maps, order doesn't matter, so the seq can just wrap over internal arrays
21:01amalloyand sorted maps are pretty easy to iterate over too
21:01tomojhuh, that doesn't look very optimized though
21:01Scriptorhmm, going through the source and it doesn't seem like Persistentmap implements Seq, though I'm probably just not finding it
21:01Scriptorit does implement Iterable
21:02amalloy&(supers (class {}))
21:02tomojISeq
21:02sexpbot⟹ #{clojure.lang.IPersistentCollection java.lang.Object clojure.lang.IFn java.lang.Runnable java.io.Serializable clojure.lang.AFn clojure.lang.Associative clojure.lang.IMeta clojure.lang.IObj java.lang.Iterable clojure.lang.MapEquivalence clojure.lang.IPersistentMap cl... http://gist.github.com/794381
21:02tomojignore Iterable
21:02tomojsee the seq() implementation
21:02amalloytomoj: it doesn't implement ISeq either
21:02amalloyit implements Seqable
21:03tomojoh, yes, ISeq is the return value
21:04amalloyright
21:04Scriptorthat just means it can be converted to a Seq, but it's not how iteration is done, right?
21:04tomojthe ISeq implementation is also in PersistentHashMap.java
21:04amalloyScriptor: that is how iteration is done, yeah
21:05amalloy&(for [[k v] {1 2 3 4}] (+ k v))
21:05sexpbot⟹ (3 7)
21:05amalloy&(for [[k v] (seq {1 2 3 4})] (+ k v))
21:05sexpbot⟹ (3 7)
21:06amalloymany, many of clojure.core's functions turn their argument into a seq and then iterate over that; anything Seqable can be worked with
21:06chouserAnd even some things that are not Seqable, such as Java arrays, Strings, etc.
21:06tomojseqs from maps don't appear to be chunked
21:06Scriptorah, so it's still converting it, but it's just done without you directly noticing it
21:06amalloyit's just often implicit; the seq call itself is hidden within some macro (like for) or function
21:07Scriptorright, that makes sense
21:07tomojor are they, somewhere else? hmm
21:07chousertomoj: no, none of the map seqs are chunked
21:07amalloytomoj: there would be no point
21:08tomojreally?
21:08chousertomoj: vectors and range are -- I'm not sure if anything else is currently.
21:08amalloyyou can't "realize" an element of a seq that comes from a map, because maps are not lazy and all the data is in memory already
21:09tomojwhy would vectors be chunked, then?
21:09chouseramalloy: I'm not sure it would be pointless.
21:09amalloytomoj: that's a good point. maybe it's not pointless
21:09tomojmy intuition was that for large maps it would speed up iteration
21:09tomojavoiding creating a new NodeSeq every step
21:10tomojor at least unfolding some of the loop onto the internal arrays somehow.. not sure how it would actually work
21:10chouserbut I think there's still the possibility that pods may obviate chunked seqs
21:10tomojI still have no clue what pods are :1
21:11chousernah, I go nuthin'
21:11chousergot
21:11amalloychouser: boooo. okay, ta-ta then
21:12tomojI know that when the idea is ready it will be easy to learn about
21:12semperoswasn't there a brief mention?
21:12semperoshttp://p.hagelb.org/pod.jpg
21:12semperosor is this something different?
21:12Scriptoris a chunked seq simply when it lazily gets the values for several items at a time, instead of one at a time?
21:13semperosand this http://www.infoq.com/interviews/hickey-clojure-protocols
21:14hiredmanmore or less
21:14semperosthere's a link that jumps to the part about pods
21:15Scriptorah, nvm, found a pdf about chunked seqs
21:28arkhScriptor: could you share the link to the pdf?
21:29Scriptorarkh: http://goo.gl/nISD7 is the PDF, though http://www.infoq.com/news/2009/12/clojure-11-rc1-transients has more text
21:33arkhScriptor: thank you
21:33Scriptorno problem
22:03mefestoRaynes: ping
22:03Raynesmefesto: pong
22:04mefestoRaynes: hey, i added that clickable code block thing as well as a little fading effect on page transition
22:04RaynesNice!
22:04mefestoRaynes: i forget was there something else on the list?
22:05RaynesBeing able to jump to 'lessons' and a way to view a list of all the lessons is all that I can think of.
22:06mefestoOk, well I think that'll be doable with how it is now. Do you have some pre-written lessons somewhere?
22:07Raynesmefesto: The ones in tutorial.clj are all that's been written. Once this is done, I'm going to start from scratch.
22:07mefestoRaynes: ok well i'll check that out
22:10mefestoRaynes: good stuff. i'll put all this in the javascript thing and commit later tonight (hopefully).
22:16accelis there a variant of clojure that provides compile time type checking?
22:16accel(pehraps written as a macro system or something)
22:17amalloyaccel: that would be a huge effort
22:18amalloy(map str [1 4 6])
22:18amalloyeven that simple example will be hard to do "right" with static typing. what are the return and argument types of map?
22:19tomojin the case where the collection type is mixed, you're screwed I guess
22:19tomojbut str is tagged with String
22:19accelwell, haskell can do mixed types
22:19accelas can ocaml
22:19tomojbut this isn't haskell or ocaml :)
22:20tomojhuh
22:20accelyeah; but clojure is powerful
22:20tomojmap doesn't look particularly easy to analyze, anyway
22:20acceland i'm trying to figure out what can easily be done in clojure
22:21brehautaccel: what do you mean by 'easily be done in clojure'
22:22tomojthat would maybe be easier after there is a clojure compiler written in clojure?
22:22accelwell, it'd be a clojure DSL
22:22accelthat had milner typing
22:22accelit wouldn't be hacked into clojure's compiler,
22:22amalloytomoj, accel: this quickly turns into just ugly java: public <In,Out> List<Out> map(List<In> coll, Function<In,Out> f) {...}
22:22accelit'd be a DSL on top of clojure
22:22amalloyand that's ignoring the multiple arities of map
22:22accelamalloy: I don't understand what your example proves
22:22accelplus, map exists in haskell & ocaml
22:22brehautaccel: subtypes make one hell of a mess of HM typing
22:23tomojoh, you mean you'd have to infect (if you will) _all_ the clojure you want type-checked with this new typed language?
22:23amalloytomoj: either that or not gain anything
22:23amalloyif you have to cast all the time to go back and forth from "real" clojure to "typed" clojure...
22:24Scriptoraccel: what would the DSL look like, a macro that goes through everything and tries to typecheck it?
22:24tomojwell, a clojure program could certainly look at normal clojure code and detect _some_ type errors
22:24accelnot necessairly a macro
22:24accelyou'd write sexps still
22:24tomojbut you wouldn't gain much, sure
22:24accelerr the macro/DSl would then take the sexp, type check it
22:25acceland then report potential errors
22:25Scriptorso like (type-check (map str [1 2 3])) ?
22:27amalloytomoj: sure. (map (comp inc str) [1 2 3]) you could probably catch with just the existing type-hints
22:27accelScriptor: why not?
22:28Scriptoraccel: cool, just wanted to make sure I understood clearly
22:29amalloyactually i guess not. comp would have to be parameterized<In, Out> for that to work
22:31amalloyi guess i should learn haskell. static-typed functional languages seem like a tremendous pain, but i understand it's not an issue there
22:32ScriptorI've only briefly looked at it, but it's pretty nice
22:32brehautamalloy: the static typing in haskell is actually pretty managable 90% of the time
22:32Scriptortypeclasses and type variables (or whatever they're called in the signatures) make things very nice
22:32brehauti think the hardest part of haskell is the terminology
22:33brehautand the heavy use of operators
22:43brehautamalloy: if you do look at haskell, real world haskell and the typeclassopedia are good sources of information
22:44Scriptorlearn you a haskell isn't bad either, but it's especially helpful in teaching the mindset of functional programming
22:44Scriptorwhich probably isn't necessary here :)
22:46brehautScriptor: the additional text around some of the more abstract abstraction still wouldnt go amiss
23:02Scriptoramalloy: so since we were joking about clojureql in PHP earlier, I thought this might be relevant
23:03ScriptorI'm working on a lisp to php compiler, it's kinda like clojure, so maybe its possible to implement it there?
23:05amalloyScriptor: an interesting project
23:06amalloyi think clojure would be an excellent language for that, even if what you want to translate is actually CL
23:07amalloyi'm not sure it's worthwhile though since you'd have a terrible time trying to get halfway legible/idiomatic php
23:07amalloyso it's not useful for humans; and computers can do just fine with clojure
23:07Scriptorit's more similar to clojure actually, at least in the sense that I know it better
23:09Scriptortrue, the PHP emitted is more or less legible, or at least tries to be, and things might be better with some debugging support added
23:26brehauthas anyone here submitted the contributor aggrement?
23:27replacaI have, why?
23:27brehautwhat happens once you put it in the mail?
23:27replacathe postman takes it to rich, assuming you've put a stamp on it :)
23:28brehautyeah thats the theory
23:28Raynesbrehaut: Once it's been Richified, you'll be added to the contributor list.
23:28brehautdoes he email you or anything
23:28hiredmanpost person
23:28brehautok cool
23:28replacathen the government puts you on a list of potential subversives who are undermining the capitalist system by making free software
23:28brehauthaha
23:29brehautyour government or mine?
23:29replacait's all really a trick - before you know it, you're packed off to the gulag
23:29brehautcrap
23:29replacaprobably mine. They seem to be most everywhere
23:29neilcjthis explains my lack of productivity: survival instinct
23:29replacayou didn't really send it in, did you?
23:30brehautbetter hope the international mail system is as bad as its reputation
23:30replaca:)
23:30Scriptoryep, only the procrastinating programmers have survived the generations
23:30replacano really, he just puts your name up on the list on the site
23:30replacaand that's how you know
23:30brehautok cool
23:31replacayou can just annotate your first patch submission or whatever with the "I've sent my CA in and Rich should have it"
23:31replacaif he hasn't gotten around to it
23:32brehautthats good to know
23:32brehautassuming he can read my chicken scratch handwriting :/
23:33replacawell, if it never got there, I assume you can just do it again
23:33brehautcheers for the info anyway
23:33replacathough, I notice that this is a hurdle that cause a lot of people real problems
23:35brehautthe hand writing bit?
23:35amalloysubmitting a CA and waiting, i would assume
23:35brehautsure
23:37replacaamalloy: something about snail mail and the written document rubs some folks the wrong way. Too high a bar.
23:37amalloyreplaca: i didn't like it either
23:38Scriptorisn't the signature required for some legal purposee?
23:38brehautScriptor: yes; ensures rich has certain controls over your contributions
23:39brehautfor example he can relicense without requiring he tracks down everyone who has contributed
23:39brehautthe part i dont like is having to trust at least two mail services
23:44rtAnyone mind recommending one of the Clojure books for someone with previous lisp experience?
23:45rtno previous lisp experience*
23:46dnolenrt: Funtional Programming experience?
23:46rtSome, yes, just not any lisps
23:46amalloy(nb: Functional Programming doesn't mean programming with functions, like C. i thought it did for a long time)
23:46rtNo, I've worked with scala (as a fp) and some erlang
23:47brehautrt ive found joy of clojure (pdf beta thing) to be a good book
23:49rtThanks for the advice, I'll check it out
23:51dnolenrt: if you know/like Scala and Erlang, you should feel at home in Clojure. Clojure is an interesting dynamic lang - it's dynamic type classes are really a killer feature IMO.
23:53rtI'm def. intrigued. Having never worked with lisp, it's a little intimidating, hence the desire for a good book to help me understand how to wrap my head around it.
23:54brehautrt, what are you finding intimidating?
23:54rthmm, hard to say honestly. For starters, it's just hard to read for me. I'm sure that will go away with experience, but initially it's a challenge
23:55brehautrt what editor are you using?
23:56rtbasic vi right now…might look for a clojure bundle for textmate or look at getting vi more configured for it
23:56brehauttextmate's clojure story is lagging behind the other major editors
23:56brehauti use textmate for everything but clojure
23:57brehauti understand that the vi mode is good though
23:57brehautdnolen (i think) might be able to give you a better status on textmate support
23:58rtHonestly, I've more been playing with the repl than working with an editor to this point
23:58dnolenbrehaut: sweet! I've totally dropped the ball on that, busy with work, and in my free time, Logos.
23:58brehautdnolen, sweet?
23:58dnolenbrehaut: I interpreted you as saying that you might be working on textmate stuff :)
23:59brehautno sorry
23:59brehauti have been dabbling with logos though ;)
23:59dnolenbrehaut: cool! :D