#clojure logs

2010-10-19

00:07amalloyjkkramer: since you have the power to make dreams come true, is there a variant of if-let that allows multiple bindings, treating the first as the test? then you wouldn't have to write (if-let [x blah] (let [y foo] body))
00:09jkkramerthe unicorn says no
00:10amalloyaww. well, it wouldn't be too hard to write one, of course. does anyone else find this boilerplate annoying?
00:10jkkrameri've wished for an if-let that lets you bind multiple locals, but tests them all
00:10amalloyheh
00:10technomancyI think that ambiguity is why if-let doesn't already support that
00:11technomancyis it an "and" or an "or"?
00:11jkkrameri would think it would be an "and"
00:13jkkramerbut it's not so much of a pain that i'd write a macro. it could just be an indicator that the code is getting smelly
00:18amalloyjkkramer: i agree that or doesn't make any sense. i think it's a question of every? or first
00:19leifwpersonally, I don't really like if-let, I'd rather split it up for readability's sake. I vote for the stink
00:20leifwand jkkramer, visualvm is fantastic, thanks
00:22jkkramerleifw: np. i hear yourkit is also good, but costs $$
00:24leifwyeah I read that too
00:24leifwI am not spending money on an art class :(
00:24leifwactually, I already have because we have to buy all our own supplies, but that's beside the point
00:28jkkramerleifw: going to post your code somewhere? it's always fun to see pretty visualizations done in clojure
00:31maravillashas clojars changed ips?
00:31maravillasIPs/host key
00:33technomancymaravillas: yes
00:34maravillasah, thanks
00:39technomancymmm... new lein-multi release; nice. =)
00:40technomancymaravillas: did you have to work around some changes to leiningen.core functions?
00:40maravillasjust a couple things...I noticed the undocumented atom I relied on was gone in lein 1.3
00:41technomancyI realized I might be a little premature in making a few things private, so let me know if that's causing you trouble
00:41maravillasi did replicate project-needed?
00:41technomancyI will be a lot more careful about minimizing the public API in 2.0
00:41maravillasotherwise there weren't any issues
00:41technomancythe semantics are a bit different; mine works on a single arity while yours works on the full arglists
00:42technomancycool
00:42LauJensenGood morning all
00:45maravillasmorning LauJensen
00:50amalloythe docs for ns/use/require et al are confusing. how do i, in an (ns) form, use only a particular symbol from some namespace?
00:51notsonerdysunnyI saw there was a function called persistent! .. takes a transient collection and returns a persistent one ... and was wondering how would one end up with a transient collection in clojure?
00:51notsonerdysunnyGood morning LauJensen
00:51notsonerdysunnygood morning all
00:52Kruppenotsonerdysunny: (transient []) for example
00:52notsonerdysunnyamalloy: (ns somens
00:53notsonerdysunnyKruppe: why would I create a transient one in the first place .. for performance?
00:54Kruppenotsonerdysunny: exactly that
00:54Kruppenotsonerdysunny: http://clojure.org/transients for more details
00:55amalloyi just split my project into three or four namespaces, since it's sorta outgrown the simple core.clj. now it takes ten seconds to compile with C-c C-k instead of ~one second. anyone know why?
00:55amalloynm, i guess it's just that it takes longer to compile the first time you move a bunch of stuff
00:56notsonerdysunnyKruppe: thanks
00:56Kruppenotsonerdysunny: no problem, glad i could help
01:08amalloyi see defn- defines private functions - is there no def- for private constants/globals?
01:10Deranderso, inspired by amalloy, I decided to compile my project for fun with C-c C-k in emacs. http://gist.github.com/633647 is the namespace declaration. it works fine in the repl. I get the error in the gist, though
01:10Deranderthe strange thing is that the error persists even if the ns call is just (ns desktop.core)
01:10Deranderthat's the only clojure file in the project
01:10Deranderanyone know wtf is going on?
01:11tomojDerander: had you use'd clojure.contrib.string earlier?
01:11Deranderin the repl, yes
01:11amalloyDerander: restart your swank server? it might not like the :use being declared in the ns form as well as from the repl
01:11Deranderooooooh
01:11tomojor just (ns-unmap *ns* 'repeat)
01:11DeranderI thought the compilation process was something completely different
01:11tomojthen C-c C-k again
01:12tomojthe core binding will fall in
01:12amalloyDerander: compilation is just passing all the forms in the file to the repl, more or less
01:12Deranderrestarting swank
01:13tomojDerander: is it just me or have you returned from a long absence?
01:13Derandertomoj: I think it's just you
01:13Derandermaybe I wasn't here last night, but it's not as if I'm a pillar of the community anyway
01:14tomojI mean I don't remember seeing you around in months, but my memory sucks
01:14amalloyyeah, i don't think Derander's been around that long. a week or two, am i right?
01:14Derandertomoj: were you involved in the ruby community at all?
01:14tomojohh
01:14Deranderyour name is familiar, but it might just be from lurking here
01:14tomojreally, shit
01:14tomojmy memory doesn't suck as much as I thought, I guess
01:15tomojsurprised I remember anyone's name from back then
01:15Deranderhah. :P
01:15DeranderI am vocal over there
01:15tomojwere you a bridger?
01:15Derandermmhmm
01:15tomojthat's it
01:15amalloyeh? bridger?
01:16Deranderamalloy: #railsbridge
01:16Deranderwas started to help ruby/rails newbies
01:16Deranderbecause #rubyonrails got kind of hostile
01:16tomojI never use ruby these days :(
01:16tomojwell, I make an exception for chef...
01:16tomoj... and there's this one legacy project.. oi
01:17Deranderit's still my day job
01:17tomojit was my dayjob (hence the legacy project), but then our new CTO happened to love clojure :D
01:17Deranderawesome
01:17Deranderokay, so restarting the swank server changed the error
01:17Deranderprogress
01:17tomojmakes me happy to see rubyists showing up here :)
01:18Deranderclojure is fun
01:18Deranderit's cryptic error messages make me feel right at home
01:18tomojhaha
01:18Deranderits*
01:18tomojyou get used to them
01:18tomoj..well, I'm still stumped every once in a while
01:19Deranderever seen "lib names inside prefix lists must not contain periods"?
01:19tomojrepaste your ns
01:19Deranderhttp://gist.github.com/633647
01:19Deranderwasn't quite fast enough to beat your request :-)
01:19Deranderoh
01:19tomojfirst, don't quite inside ns
01:19tomojer, don't quote
01:20Deranderah. dropping those pops over t4o "Don't know how to create ISeq from: clojure.lang.Keyword"
01:21Deranderoh
01:21DeranderI think I found it
01:21Deranderclojure.contrib string vs clojure.contrib.string
01:21Derandercompiling
01:22Derandernope, same error.
01:22amalloyDerander: repaste the new one?
01:23amalloyi was under the impression you only got one :use and :import per ns, though i wouldn't be surprised to be wrong
01:23Deranderhttp://gist.github.com/633647
01:23Deranderoh, I have no idea
01:23amalloysomnium congomongo - no .
01:23Deranderthat one I ripped off of their readme
01:23Derandertrying
01:24tomojhttps://gist.github.com/1f2f4649056962610bcb
01:25Derandertomoj: testing
01:25tomojyou will probably need to (ns-unmap *ns* 'repeat) or restart swank again
01:25Derandersorry to make you guys sweat so much
01:25tomojbecause your (:use [clojure.contrib.string :as st]) will have brought clojure.contrib.string/repeat into the namespace, which conflicts with the repeat in core
01:26Deranderthat seems to work
01:26Deranderright
01:26leifwwouldn't the ":as st" fix that?
01:26leifw*shouldn't
01:26tomojI don't think so, testing
01:26Deranderleifw: it seems cumulative
01:26leifwweird
01:26tomojyes, use is like require+refer
01:27leifwoh
01:27leifwbah
01:27leifw:use
01:27tomojso it gives you the st alias but also refers
01:27Deranderand bam
01:27Deranderit compiled
01:27Deranderthanks folks. I understand ns much better now
01:27tomojI had to reread the docs on all the ns functions many times..
01:28Deranderthat is a frustrating macro/function pile
01:43amalloyDerander: your problem seems to have caused them both to timeout
01:56Deranderamalloy: victory :-)
02:41coldheadthanks, clojurebot
03:39mrSpecHello, I'd like to use clj-doc in my project. Could you tell me what should I put in my project.clj, to download this lib with "lein deps"?
03:53TobiasRaedermorning everybody :)
03:59AWizzArdMoin Tobi.
04:03esjMorning guys
04:04TobiasRaedermorning
04:05LauJensenMorning everyone
04:08sthuebnergood morning *
05:06zkimHah, cool, paul graham credits clojure for making lisp fashionable again: http://news.ycombinator.com/item?id=1803351
05:08noidinow that seqs can be poured into maps (fn [& {:keys ...}]), is there something like :as that would bind the original seq to a name?
05:09noidiI have a function that uses some of its keyword arguments itself, and passes the rest on to another function
05:09xkb Is it possible to add a random .jar as a dependency in Lein?
05:10noidibut the other function expects a seq of keywords and values, and not a map, so I can't use :as to capture the seq to be passed on using apply
05:12TobiasRaeder@xkb you just need to access it from the project? just put it into the lib folder
05:12noidiideally I'd like to do something like this (defn first-fn [& {:as options, :keys [foo bar]}], (do-something foo bar), (apply second-fn options))
05:16noidiah, got it
05:16noidiI can do (apply second-fn (apply concat options))
05:20xkbTobiasRaeder: jup, thanks. That works
05:20xkbTobiasRaeder: should remember not to use lein clean ;)
05:23TobiasRaeder@xkb yeah thats kind of annoying, might wanna check those libs into your project (if you use git and git lib in .gitignore use git add -f lib/mylib.jar
05:23TobiasRaeder@xkb then u can always use git checkout lib/mylib.jar if you accidentially lein clean
05:23TobiasRaeder@xkb *(if you use git and got lib in your .gitignore use git add -f lib/mylib.jar to track it anyway)
05:25LauJensen,(letfn [(t [& {:keys [x y z ] :as w}] w)] (t 1 2 3 4))
05:25clojurebot{1 2, 3 4}
05:25LauJensennoidi: like that you mean ?
05:35esjxkb: or use maven to deploy the jar to your local repository so that lein will fetch it automatically for you and save you the heartache.
05:36mrSpecCould you tell me how to make function public?
05:37esjmrSpec: it is by default
05:37esjyou have to use (defn- to make it private
05:39noidiLauJensen, I was trying to do something like (letfn [(bar [& {:keys [bar-1 bar-2]}] ...), (foo [& {:keys [foo-1 foo-2], :as options}] (apply bar options))])
05:40noidiand of course it didn't work, because I can't call apply directly on a map (its seq is ([key value] [key value]) instead of (key value key value))
05:40noidibut (apply bar (apply concat options)) worked
05:40mrSpecesj: ah thanks
05:41xkbesj: so how you declare the dependency
05:41xkbpretty much a maven noob here ;)
05:42mrSpecah, but I have still some problem with this public functions. I'm trying use autodoc, and it cant see any public functions in my package :(
05:43esjxkb: The jar must have an address, something like org.xkb.fancything. Make a pom.xml file describing this, then use mvn install, which will put it into your .m2 directory.
05:44esjmrSpec: I had a similar problem... trying to remember how I got around it.
05:44xkbesj: hmm that's pretty simple
05:44raekmrSpec: it doesn't list functions without dosctrings, I think
05:44esjxkb: it probably wont turn out to be simple.... maven has that habit :P
05:44esjraek: GENIUS !
05:44mrSpecraek: I have doc strings :)
05:45mrSpecbtw. how should I "add" files to my project? Maybe here is the problem.
05:46mrSpecIn project.clj, I have :main MyProject.core
05:46raekautodoc has an option for selecting which namespaces docs should be generated for
05:47mrSpecbut what if I have 2 files, where should I put name of the second one?
05:47mrSpecraek: ok, I'll read about this
05:47raeki think the value gor that key was a vector
05:49lypanovah crap, netsplits again? dang
05:49freakazoidheh yeah that's a pretty big chunk to bite off
05:50lypanovfreakazoid: mind wise its fine. but apparently i reach a muscle memory limit at that point.
05:51lypanovrepeated mind warp experiences every time i tried to use a keyboard seq.
05:51freakazoidyeah, that makes sense
05:51freakazoidI wonder why viper isn't more popular
05:51lypanovthink its the lack of consistency when you attempt to use both emacs and vim keybindings at the same time
05:51freakazoidmodal makes a lot more sense to me
05:51lypanovits really jarring to attempt to use slime while navigating with vi bindings
05:52freakazoidI only use emacs because vim isn't nearly as extensible and because the people who use it don't see to value extensibility as much I don't get so many cool extensions to support it
05:52freakazoidI can imagine
05:52lypanovgot myself up and running and productive already in vimclojure
05:52freakazoidcool
05:52lypanovjust missing a few minor things that i really liked about slime
05:52lypanoveg, i'm too dumb to remember what i just typed sometimes
05:52lypanovand with vimclojure when i send shit to the clojure instance i don't see what i sent. just the output of it
05:52freakazoidI managed to get vim working as a debugger with C++
05:53freakazoidbut then switched to emacs because the erlang stuff wasn't very good
05:53freakazoidoh that's strang
05:53lypanovvim blows frankly. but yeah.. i just love the keybindings for general editing.
05:53freakazoidyeah, modal makes much more sense to me
05:53lypanova few years back i wrote a partial vim in ruby
05:53freakazoidemacs's key combinations are just horrible
05:54lypanovbut quit half way through as ruby wasn't fast enough for sane syntax highlighting
05:54freakazoidusing vim all these years is probably waht's kept me from ahving any wrist problems
05:54lypanovmy syntax highlighter became its own little phd level research project
05:54freakazoidheh
05:54lypanovfreakazoid: i actually quit vim a few years back
05:55lypanovback to it due to clojure
05:55lypanovi quit because i moved to dvorak for the above reason
05:55freakazoidif you ask me, I think it's goofy that we have to have all these different specifications for language grammars to get proper highlighting and error detection
05:55freakazoidall because we insist on using an ancient format for storing our source code
05:55lypanovbut got one of those little alum keyboards from apple with the arrow keys that are semi close to the rest of the keys so dvorak + that was enough to stop my wrists falling apart
05:55freakazoidoh yeah I love those keyboards
05:55freakazoidI used one at Linden
05:56freakazoidfell in love with it immediately
05:56freakazoidI just use a macbook pro keyboard where I'm at now
05:56esjlypanov: I use exactly that setup
05:56lypanovyeah, modern laptop ones are great also.
05:56lypanovits actually good.
05:57lypanovusing a mice kills me.
05:57lypanovmouse*
05:57freakazoidyeah my dad switched to a left-handed mouse
05:58freakazoidI should have shown him how to swap the buttons
05:58lypanovfreakazoid: on the topic of syn hl. my greatest love atm is the rainbow parens
05:58lypanovlol
05:58freakazoidI used to use a logitech trackball that I loved
05:58freakazoidbut after a while it would get gummed up every single day
05:58lypanovjarpiain: you switched from qwerty?
05:58jarpiainI have hjkl where qwerty has wvrs
05:58freakazoidrainbow parens sounds awesome
05:58lypanovjarpiain: i had to take a break. i just couldn't do it.
05:58freakazoidI can imagine exactly what that looks like from teh description
05:58jarpiaindidn't get longer to get used to it than switching qwerty->dvorak in general
05:58esjlypanov: the best ever were the ThinkPad's with the little nipple thing. It was pure genius.
05:59freakazoidoh yeah, I used to ahve one of thos
05:59freakazoidI wonder where it went
05:59lypanovnever had enough money for one of those :P
05:59freakazoidI think my ex wife's roommate ended up with it
05:59esjlypanov: i bought a series of them 2nd hand, and well out of date, from ebay.
05:59lypanovesj: .nl here. ebay basically doesn't exist.
06:00lypanovor you mean recently?
06:00esjlypanov: ongelukkig !
06:00lypanovhehe
06:01lypanovjarpiain: i was primarily coding java back then in intellij with a vim extension thing and couldn't get my head around either the switch, or the remapping.
06:01raekI have a thinkpad. It is awesome.
06:01freakazoidI've since converted to mac
06:01freakazoid(from Linux)
06:02esjraek: pretty jealous, they're top notch kit.
06:02LauJensenZzzzz
06:02lypanovi was wondering where lau was.
06:02lypanovLauJensen: vimclojure really isn't that bad fwiw.
06:02esjLauJensen: I thought you were all about the best tools ?
06:02lypanovhe's doing that for the mac stuff.
06:02LauJensenMan this Apple/Vim worship is like being in a mental institution for boys that want to be pretty and have pretty things. Luckily C-x b, will fix that, later suckers
06:02lypanovor he just woke.
06:03esjlol
06:03lypanovlol, says the emacs user...
06:03esji say again - seduced by the power of the dark screen he has become !
06:03esjlypanov: fall of trucks do they ?
06:03LauJensenSeriously. If somebody gave me a Mac I'd sell it the same day
06:03lypanov(just not the next one, currently unemployed)
06:04lypanovesj: second one (first gen mbp) i got from apple for my work on safari.
06:04lypanovesj: second my last employer bought me.
06:04lypanovthird*
06:04freakazoidall my macs have been employer-purchased
06:05lypanovmy company went bust and never collected it.
06:05lypanovso didn't have to return it.
06:05lypanov:D
06:05esjsweet
06:05lypanovdownside, they owe me enough to buy 2 new ones...
06:08LauJensenhehe, lypanov its insane how you categorize everything as the number of macs it will buy you
06:09lypanovLauJensen: just making the point that the free mac due to bankruptcy would much rather be the 2 months of missing pay :(
06:09LauJensenesj: yea, its a nightmare
06:09esjits a bit sprawly
06:09LauJensenlypanov: and Im just making the point that you need a cold shower, slap across the face and a cookie
06:10lypanovi'd go for just the last one and a cup of tea.
06:11LauJensenand a little rainbow colored sweather to get all nice and cozy? Come on now! :)
06:11lypanovsweater
06:12LauJensenhehe
06:12LauJensenyea
06:12lypanovsweather has 350'000 google hits tho :/
06:12lypanovah, for "sweat her" mainly :P
06:17fliebelMorning
06:18LauJensenMorn'
06:18fliebelCan I do if-let inside of cond?
06:19LauJensen,(cond (odd? 3) (if-let [x nil] (println "yes")))
06:19clojurebotnil
06:19esjello
06:20fliebelRight… *tries to read some code*
06:21LauJensenesj: Did you get a new job as a Clojure cons?
06:21esjLauJensen: I'm trying very hard to give myself a job :)
06:21LauJensenah :)
06:22esjmy motivation has a lot to do with wanting to code Clojure.
06:22esjbut i'm not good enough to be a cons yet: i'll leave that to you and cgrand :)
06:24LauJensenAlright, we'll take it from here :)
06:25fliebelWhat is a Clojure cons? I don't assume you mean clojure.core/cons?
06:25esjconsultant, i'm guessing
06:25esj:)
06:25LauJensenfliebel: I just meant Consultant
06:25fliebelright :)
06:25LauJensenBut it would certainly be ambitous for esj to transform himself into clojure.core/cons
06:25esjit would be a striking metamorphosis
06:25fliebelHe would be kind of lazy though....
06:26LauJensenof epic proportions
06:26esj(into clojure.cons/cons esj)
06:26esjeasy.
06:26LauJensenthrows ClassCast Exception: Too Lazy
06:27fliebelHe could be lazy-esj… (lazy-esj [1 2 3])
06:27esjrotfl !
06:28fliebelGood irc handle for mondays as well
06:28mfexfliebel, perhaps you are looking for c.c.cond/cond-let as a combination of cond and if-let
06:30fliebelmfex: I think I just misread the cond. I was thinking he was using if-let as a clause and an expression at the same time, but the code had some parens mixed, so it's alright now…. Except tht it doesn;t work :)
06:34lypanovesj: would like the same - to be doing clojure.
06:35esjlypanov: too right !
06:36lypanov(that even Lau would like to use...)
06:36esjoh that's easy !
06:36esjtake away the ipad, and replace with anything else running emacs :)
06:37lypanov:P
06:37LauJensenHAHA.. Clojure for the Ipad.. you crack me up lypanov
06:38LauJensenIf you do decide to go awol for a year for that reason, please dont come back :)
06:38esjso mean !
06:38LauJensenSorry, it was written with a smile on my face
06:38lypanovthats why i said "that even lau would like"
06:38lypanovi wouldn't bother if it would suck
06:38lypanovi don't believe it would suck
06:38lypanovso either 1 year later i'd return knowing its impossible and just plain sucks
06:38lypanovor, lau would like it.
06:39fliebelGood iPad is multitouch for all emacs finger twisting.
06:39LauJensenhaha
06:40esji used to play the pipe organ, so I figure it would be easy
06:40lypanovesj: set up a webcam and use your eyelids.
06:40LauJensenpedals would be great
06:40bOR_"Parameter declaration intern should be a vector"
06:40fliebelesj: you could craft them yourself if you really want to :)
06:40esjfliebel: the thought has actually crossed my mind
06:40bOR_does anyone know why that happens when I try to embed an intern in a function?
06:40lypanovyou can already get usb pedals.
06:40lypanovdunno if they last / feel good.
06:41fliebellypanov: I'd modify a keyboard pedal to fit in my mic plug and go form there.
06:41bOR_nevermind
06:41bOR_:)
06:42bOR_forgot to specify function name
06:42lypanovhttp://www.instructables.com/id/USB-Foot-Pedal/
06:42lypanovneat.
06:42fliebel*is playing with midi*
06:42bOR_dumb :-).
06:45lypanovcemerick: are you looking for eg vimclojure to also use your remote repl stuff?
06:59LauJensenlypanov: If its not a 4.6 Gb install which requires 1200+ lines of XML config, cemerick doesnt care about it. Its simply not a tool in his world.
06:59LauJensenOn the other hand, he loves netbeans :)
07:00lypanovonly 4.6? you could fit 5 copies on a single bluray. who cares?
07:01lypanovobviously you don't need to do anything difficult like print for example or you'd completely grok 4.6 as being a minimal install set for any given piece of softwar
07:02lypanov(half joking..)
07:04cemericklypanov: yes, I've been working with Meikel from the beginning to make sure his requirements are met
07:04lypanovcemerick: awesome!
07:04cemerickLauJensen: I've not used netbeans for some time now.
07:05LauJensencemerick: really? Im surprised, CCW?
07:05cemerickYes.
07:05LauJensencemerick: how are you liking it ?
07:05LauJensencompared to netbeans I mean
07:05lypanovccw?
07:05clojurebotccw is http://github.com/laurentpetit/ccw
07:06cemerickNetBeans failed me. Occasional segfaults. I couldn't take it anymore.
07:06lypanovah, eclipse. pure evil.
07:06cemerickI don't know how they managed it, since it doesn't use any native libs.
07:07octehow would i make a multimethod with the dispatch function being if the argument map has a specifi key?
07:07octedon't know if i'm expressing the question well
07:07LauJensencemerick: So its just the occasional segfaults, not big diffs in how they support clojure dev?
07:07cemerickI wonder what people around here are going to do when Clojure begins its eternal september, and the vast majority of devs are using eclipse or netbeans.
07:08lypanovgive them free copies of intellij and pray they see the One True Light?
07:08lypanovccw looks nice.
07:08LauJensencemerick: So its just the occasional segfaults, not big diffs in how they support clojure dev?
07:08cemerickLauJensen: Enclojure has better workflows, but ccw is more capable, strictly speaking. The former will no longer be true, once Laurent and I finish up the new REPL.
07:09cemerickocte: (defmulti foobar :the-key-you-want-to-check)
07:09LauJensencemerick: looking forward to the screencast
07:10octecemerick, cemerick that's for checking one key
07:10octecemerick, i want it dispatched to one function if :foo is in there, another if :bar is in there
07:11octefor example
07:11raekocte: so that there will only be two possible method implementation? (one of true and one for false)
07:12lypanovmaybe if i get that new 27" imac and have 8gb finally i'll dig back into an ide
07:12lypanovwhile i'm stuck with the now minute quantity of 4gb of memory i'll use vim
07:13cemerickvim needs 4GB? :-P
07:13lypanovno but osx sure does ;)
07:13cemerickI've never grokked that. I run eclipse with 768MB of heap with very good results.
07:13octeraek, not sure what you mean
07:13lypanovsafari + spotlight + a few other random apps are you're already in the 2gb range.
07:14lypanovcemerick: ditto. but 1gb is an insane env when you have a bunch of other stuff running also.
07:14lypanovfine on linux with a sane desktop. but hell on a mac.
07:14cemerickYeah, 'cause linux is so different?
07:15lypanovaye.
07:15cemerickRight-o. :-P
07:15fliebellypanov: I'm on 2GB and doing fine.
07:15lypanovnot when its running the same sort of stuff, but you can afford to be more minimal.
07:15fliebel(mac)
07:15lypanovfliebel: you obviously have a different work load to me then :)
07:16raek(defmulti foobar #(contains? m :the-key)) (defmethod foobar true [m] ...code...) (defmethod foobar false [m] ...code...)
07:16lypanovcemerick: safari alone is using 1gb on my box currently.
07:16lypanov(wave *kills*)
07:16raekif the disptach value can only be 'true' and 'false', there can only be two defmethods
07:17lypanov(love it tho..)
07:17tomojhow should I sink the output of an external process? (Runtime/exec)
07:17cemerickocte, raek: could try (defmulti foobar (juxt :key1 :key2)), and dispatch on vectors.
07:17raekand in that case is seems simpler to just do a (defn foobar [m] (if (contains? m :the-key) ...code... ...code...))
07:17fliebelraek: Then why is there a prefer function, or something similar of name?
07:17octeraek, i'm not explaining correctly
07:17octecemerick, alright, yeah,. that's one way
07:19raekprefer is useful for situations where the dispatch value consists of multiple parts (e.g. when it is a vector)
07:19raekall elements of the vector are checked pair-wise with 'isa?', which can lead to multiple solutions
07:20cemerickprefer-method is useful for any case where there's ambiguity, which can happen without vector dispatches.
07:20octecemerick, it's quite a list of keys
07:20octei'm considering if it'd be better to use condp
07:21cemerickocte: In that case, it sounds like you've got quite the combinatorial issue on your hands, esp. if key presence isn't exclusive in each case.
07:21raekhrm. I see.
07:22octecemerick, they're exclusive. it'm translating old code from another languagenad it's basically handled with a big switch
07:22octehttp://paste.lisp.org/display/115689
07:22octeshouldnt that work?
07:22cemerickIf they're exclusive, then perhaps dispatching on sets of keys would work.
07:23LauJensenocte: (case data :one 1 :two 2 :default)
07:23LauJensenoh, contains?, missed that sorry
07:23cemerickLauJensen: data is a map, not a kw
07:23LauJensenyea thanks big guy
07:23LauJensencheck in, try to help, immediately punished! yea! :)
07:23octehaha :)
07:26cemerickocte: condp may be the simplest route; depending on how many keys you're tracking, I'd bite the bullet and use a set of the privileged keys to produce those keys as dispatch values.
07:27octecemerick, any idea what's wrong with the condp-code i pasted?
07:28raekocte: in the end, (contains? :foo data) is called
07:29octeoh
07:29octehm
07:29raekreplacing contains? with #(contains? %2 %1) should work, I think
07:29raekbut as cemerick said, you could perhaps dispatch on (set (keys data))
07:30raekor maybe (clojure.set.intersection #{...interesting keys...} (set (keys data)))
07:31raek*clojure.set/intersection
07:32cemerickocte: If they keys in question really are exclusive, then dispatching on sets is unnecessary: http://paste.lisp.org/display/115689#1
07:33cemerick(if you go for multimethods, then the body of the case value there is essentially your dispatch fn)
07:36lypanovah. bummer with cake + vimclojure
07:36lypanovvimclojure doesn't do sync dump of buffer output to console
07:36lypanovit instead goes to the cake console
07:36lypanovbut cake doesn't print it unless you manually hit return repeatedly... so didn't realize it went there
07:36lypanovdoes so with lein
07:55edoloughlinIs there an idiomatic way to remove elements from a map? (remove) turns my map into a collection of vectors: http://pastebin.com/SL6uGrxX
07:55fliebellypanov: You have vimclojure working with cake?
07:56fliebeledoloughlin: dissoc?
07:56edoloughlinWill check it out. Thanks.
08:02fliebelAnyone else who can get me started with vimclojure and cake? I have vimclojure working, but without the nailgun part.
08:13lypanovfliebel: aye working. can help. gimme a bit tho, just eating lunch :)
08:13fliebelsure
08:13lypanovin summary, add [vimclojure/server "2.2.0"]
08:13lypanovto dev deps in cake global project
08:13lypanovthen run (require 'vimclojure.nails)
08:13lypanov(vimclojure.nails/start-server-thread)
08:13lypanovfrom cake repl
08:14fliebel*googles cake global project*
08:21fliebellypanov: That seemed to work. Now, where do I find the keyboard shortcuts to use it?
08:29lpetitHello everybody, everybody hello
08:30fliebellpetit: Een voor allen, allen voor een!
08:30lpetit"Un pour tous, tous pour un" !
08:37LauJensen"En for alle, alle for en" !
08:42lpetitIs there an english idiom for this maxim ?
08:43lpetit(of course I know its origin are rooted into a french not-so-historical book)
08:44TobiasRaederi think its "all for one, one for all"
08:44TobiasRaederaltho it's reversed
08:44lpetitok.
08:45lpetitMe, OT ? nahhhh :)
08:45TobiasRaeder;)
08:46LauJensenTobiasRaeder: I think its "One for all and all for one"
08:47TobiasRaederyeah i thought so too atleast wikipedia states it otherwise but i guess that doesn't mean anything really
08:49LauJensenTobiasRaeder: Well, you mustn't confuse the frenchmen, you know how they get
08:50TobiasRaeder:D
08:52LauJensenlpetit: Did you catch that little Laurent? :)
08:52lpetitLauJensen: now what is this urban legend about french men ? :-)
08:53lpetitLauJensen: yeah, he's near the tall Christophe ! :-D
08:53LauJensenlpetit: I think its that you're incredibly arrogant and humor-forsaken. Though I must admit I've never met a frenchmen who acted like that. Except the police perhaps. But even the french police cant beat Officer Bubbles
08:54fliebelDoes anyone happen to know how to get <localleader> in MacVim? I thought it was set to \ but it just gives me a *punk* when I press it.
08:54lpetitHmm, so I don't feel french (but I recognize that saying so somehow makes me arrogant and humor-forsaken, so it's a vicious circle you've locked me in :-) )
08:54LauJensenhaha
08:59fliebelStrange, can someone explain me vicious?
09:00fliebelI don't think my dictionary contains the implied meaning, although Google translate gives me vicious for the Dutch equivalent of that.
09:00fliebel"deliberately cruel or violent"
09:01cemerickfliebel: "vicious cycle" = inescapable repetition of behaviour
09:01LauJensenThat aligns with my understanding as well
09:01lpetitfliebel: not in that meaning in the above context. But rather "pernicious", if you will. The more you try to escape, the more you're locked. Like if there was "sadistic pleasure"
09:02esjquick sand !
09:02LauJensenGoing Counter Clockwise is a vicious cycle, invented by a vicious man, from a vicious land
09:02lpetitcemerick: more like a spiral = the more you try to get out, the more you go inside
09:02lpetit:)
09:03lpetitLauJensen: so that's what we all are in the clojure community: vicious men going Counter clockwise, wanting to bring lisp its lost powers back :-)
09:04fliebelRight, so my dictionary is just wrong, or at least… (lost another word there…)
09:04LauJensenyea.. Maybe we should consider throwing in the towel, just go back to Java. Be more mainstream and conformant. How about it guys? #java?
09:04RaynesMorning!
09:05LauJensenMorning Raynes
09:05esjHey Raynes
09:05fliebelMorning :)
09:05RaynesWith the help of an alarm clock, I'm slightly able to maintain my relatively average sleep schedule in anticipation of the Conj. Of course, it's more difficult when it takes some 3 hours to get to sleep every night.
09:09lypanovfliebel: vicious is just mean / gemeen.
09:09lypanovfliebel: found kbd shortcuts already?
09:09lypanovfliebel: set your localleader. i use ,
09:10lypanovexample : let maplocalleader = ","
09:10fliebellypanov: but the circle isn't just gemeen.
09:10fliebellypanov: It has no default?
09:10lypanov,sr and ,et are the most interesting ones
09:10clojurebotjava.lang.Exception: Unable to resolve symbol: sr in this context
09:10lypanovdon't think so
09:10lypanovsr -> start repl
09:10lypanovet -> evaluate top level expression
09:11lypanovi start a nailgun thingy. then use ,et a bunch of times
09:11notsonerdysunnywhat is the difference btw ancestors and supers
09:11fliebelI found the help ;) Now, let's see...
09:11lypanovit magically understands current file etc. so you can randomly ,et in other files and it automatically does the ns stuff etc
09:12lypanovfliebel: yeah, vicious circle is just an expression.
09:12fliebellypanov: Still the punk sound when I press ,
09:13lypanovfliebel: um. i dont have any punk sounds anyway so wouldn't know
09:13lypanovwhat happens if you type ,et?
09:13fliebelIt's just the *boink* sound a Mac gives when nothing is happening, and nothing is ever going to happen with that key in this situation.
09:14lypanovand you did the local header thing?
09:14lypanovlocal leader sorry
09:14lypanovand the non local normal leader?
09:14fliebelwhat's that?
09:14fliebelIs htere any way to read those values?
09:15lypanovwell i have let mapleader = "," also
09:16fliebelNothing but boink sounds
09:16lypanovjust "let localleader"
09:16lypanovshows me ,
09:17lypanov(on the : prompt whatever thats called)
09:17lypanovorry i meant maplocalleader, or mapleader
09:17lypanovs
09:18fliebelI get "maplocaloeader ,)
09:18fliebelwell, something like that anyway.
09:19lypanovin what mode are you typing ,? insert mode right?
09:19lypanover sorry, non insert mode. whatever thats called.
09:19LauJensenLets give the man a round of applause!
09:20fliebellypanov: I can't hit comma in insetr mode without typing it, right?
09:20lypanovLauJensen: i was using textmate.
09:20LauJensenhehe :)
09:20fliebelyea, I'm in… that normal mode
09:21lypanovthen i don't get it. for me it just magically works
09:21lypanovdid you try other such shortcuts?
09:21lypanovyou sure vimclojure / nailgun is all getting started correctly?
09:21lypanovwhen you open a .clj file do you see a new window pop up if nailgun isn't started?
09:22fliebelnothing, just the file
09:23bartjlypanov, are you trying to setup the Clojure REPL on vim ?
09:23notsonerdysunnywhat does with-loading-context form clojure.core do?
09:23lypanovfliebel is yes.
09:24notsonerdysunny,(clojure.repl/source with-loading-context)
09:24clojurebotSource not found
09:25notsonerdysunny,(doc with-loading-context)
09:25clojurebot"([& body]); "
09:25notsonerdysunny,*clojure-version*
09:25clojurebot{:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}
09:28LauJensen,(clojure-version)
09:28clojurebot"1.2.0-master-SNAPSHOT"
09:35fliebellypanov: They don't even know in #vim :(
09:36lypanovum.
10:11@rhickeyhttp://groups.google.com/group/clojure/browse_frm/thread/c40ff3e876b4b370
10:12esjthat's great news
10:12@rhickeyhas anyone tried yesterday's stable var caching?
10:14esji recently chose jira&friends for inhouse stuff, so I'm pretty glad you guys came to the same decision.
10:16fliebelrhickey: Nice :)
10:20@chouserrhickey: nicely worded announcement.
10:21@rhickeychouser: sorry it took so long - thanks for getting the repo up
10:21@chouserbut I've got no time to try out new clojure versions
10:21@chouseryou do know you've got a 1.5-hour keynote in 3 days?
10:22@chousergoodness, no need to apologize for delay. I started writing finger trees over a year ago(!)
10:23@rhickeychouser: yeah, need to work on keynote but am on a roll with Clojure atm
10:24LauJensencemerick: You're still famous on my blog :)
10:28G0SUBCan someone help me with this binding/map related issue? http://paste.lisp.org/display/115699
10:29G0SUBbasically binding doesn't work as intended if any of the functions are using map underneath.
10:29G0SUBso to use dynamic bindings, I have to change a lot of things
10:30G0SUBI thought this was only the case with pmap.
10:30Raynesrhickey: Awesome announcement. I can't wait for all the new toys.
10:31AWizzArdG0SUB: could it be that map doesn't work because it is lazy? Did you try to put a doall around your map?
10:32G0SUBAWizzArd: possible. let me check.
10:32kryftWhen I was young, maps were eager to work.
10:32G0SUBAWizzArd: you are right. I forgot the doall.
10:33@rhickeycemerick: no worries
10:36fliebelrhickey: Where do/did you learn to make and design programming languages?
10:36don333a Java method expecting a boolean doesn't accept 'nil' and I used (nil? x) to get it run
10:37don333but somehow it feels not right
10:37@rhickeyfliebel: I'm still learning
10:37@rhickey,(boolean nil)
10:37clojurebotfalse
10:38TobiasRaeder@don333 since boolean is the type and Boolean is the object nil cant be passed (as you cant pass null to a boolean parameter in a function)
10:38cemerickrhickey: I pushed what I've got into the new repo, just so people won't get a quasi-404. Namespace mods and such will flow tomorrow or thursday afternoon.
10:39fliebelrhickey: Sure, never stop learning :) But where and what do you need o learn to make compilers and stuff?
10:39@rhickeycemerick: ok thanks
10:39don333so I am doing the right thing after all, using it like (.setEnabled some-button (nil? some-choice)) ?
10:40fliebeldon333: As rhickey said, boolean is better because (nil? false) is false.
10:40@chouserdon333: 'nil?' will reverse your meaning, 'boolean' won't.
10:41lpetitfliebel: because (nil? true) is false
10:41don333chouser: I just realised that and put (not (nil? some-choice)) that looks even worse
10:41fliebellpetit: Right...
10:42@rhickeyfliebel: http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH is a start
10:43don333that makes me wonder if a refactoring to have a boolean value instead of that nil wouldn't be better
10:43@chouserdon333: right, when you have to use 'not', reconsider. it may be best, but there should at least be another option that ought to be considered.
10:44fliebelrhickey: Second time in a week I encounter "The Art of the Metaobject Protocol"
10:44lypanovfliebel: after you've read them all pls go port clojure to llvm
10:45@chouserdon333: casting with 'boolean' for the sake of a Java method call feels to might like a straight-up interop cost. I wouldn't assume that means you're doing anything else wrong.
10:46AWizzArd,(boolean 0)
10:46clojurebottrue
10:46fliebellypanov: Nice idea, but probably not going to happen by me. I'm more interested in making my own toy language for now.
10:46don333so perhaps I'll explain my problem - I'd like to enable a JButton when a LazySeq contains an element and disable the button otherwise
10:47mbufare there any available benchmarks that people here have done between java 6 and clojure?
10:47don333now I got to (not (not-any? #{:element} collection)) and again it doesn't look right :/
10:48don333because I feed it to (.setEnabled some-button ...)
10:48fliebeldon333: Why the double not?
10:48@chouser(some #{:element} coll)
10:48G0SUBmbuf: check the shootout results on alioth, but take them with a bag full of salt.
10:49don333yes, I tried (.setEnabled some-button (some #{:element} collection))
10:49mbufG0SUB, okay
10:49don333but some returns nil or :element and .setEnabled doesn't like that
10:49AWizzArdI think this is the only interesting difference to Javas (boolean)0
10:50@chouser(boolean (some #{:element} collection))
10:50AWizzArdcasting to bool of null, false or a primitive zero leads to ==> false
10:50lpetit(.setEnabled theJButton (if (seq coll) true false))
10:50@chouserthe (some ...) is good idiomatic Clojure, and wrapping in (boolean ...) is clean interop
10:50lpetitdon333: ^^^ stick to basics
10:51don333:)
10:51lpetitreally
10:51AWizzArdlpetit: why the if?
10:51AWizzArdCan one not simply say (seq coll)?
10:52lpetitAWizzArd: have you read don333's problem ? he wants a true true or a true false :) for java interoperability.
10:53lpetitwoops
10:53AWizzArdSo, implicit casting won't solve this.
10:53lpetitdon333: it's just (.setEnabled theJButton (true? (seq coll))) you're after
10:53micahmartinHow does one change a field of a deftype after it's been created?
10:53lpetit,(true? nil)
10:53clojurebotfalse
10:54lpetit,(true? false)
10:54clojurebotfalse
10:54lpetit,(true? ())
10:54clojurebotfalse
10:54lpetit,(true? (seq ()))
10:54clojurebotfalse
10:54don333thanks lpetit, that looks like a winner
10:54lpetitno, it's a looser
10:54AWizzArd,(map true? [nil false () (seq ()) (seq [1 2 3])])
10:54clojurebot(false false false false false)
10:54lpetit(true? [:a])
10:54lpetit,(true? [:a])
10:54clojurebotfalse
10:54AWizzArd,(map boolean [nil false () (seq ()) (seq [1 2 3])])
10:54clojurebot(false false true false true)
10:55lpetitdon333: sorry
10:55don333aww, right
10:55lpetitdon333: so back to Rich's suggestion. In your case:
10:55don333seems like chouser and his boolean solution wins
10:55lpetit,(boolean [:a])
10:55clojurebottrue
10:55lpetit,(boolean (seq [:a]))
10:55clojurebottrue
10:55lpetit,(boolean (seq []))
10:55clojurebotfalse
10:56don333yeah, rhickey suggested boolean first ;)
10:56lpetitdon333: place a call to seq
10:57lpetitdon333: (boolean (seq yourcoll)) <- the coll to seq will ensure that empty colls like [] will be nullified and not get the call to boolean get true
10:59AWizzArd,[(boolean 0) (Boolean. "0")]
10:59clojurebot[true false]
10:59don333@lpetit, @chouser - thanks
11:05micahmartin(deftype Foo [foo])
11:05micahmartin(def f (Foo. :foo))
11:05micahmartin(set! (. f foo) :bar)
11:05micahmartinjava.lang.IllegalAccessException: Can not set final java.lang.Object field user.Foo.foo to clojure.lang.Keyword
11:05micahmartinDoes anyone know what I'm doing wrong here?
11:06AWizzArdmicahmartin: seems you try to modify an object.
11:06AWizzArdFoos are immutable.
11:06AWizzArdinstead try (assoc f :foo :bar)
11:06micahmartinAccording to documentation, deftypes are muttable.
11:07AWizzArdAh, deftype. Well, no. You can declare fields mutable.
11:07AWizzArd:volatile-mutable or :unsynchronized-mutable
11:08micahmartinWhat's the syntax to do that?
11:08lpetitmicahrmartin: you're trying to use CL generalized setters in clojure. It's not working like that ;-)
11:09Freenkis there a faster way to call java than .
11:09lpetitmicahrmartin: oh, sorry for the too fast answer.
11:09Kototamahi, is there a way to generate dynamically a java object with a static method? for instance with proxy
11:10AWizzArdmicahmartin: ^{:unsynchronized-mutable true}
11:10notsonerdysunnyI just came across with-loading-context .. can somebody help me understand that..
11:10micahmartinlpetit: Here's the root problem. I need to implement two interfaces that reference eachother. (deftype Foo [bar]) (deftype Bar [foo])
11:10AWizzArd(deftype Foo [^{:unsynchronized-mutable true} foo])
11:10notsonerdysunnyIt seems to have no documentation
11:11micahmartinAWizzArd: cool, thanks.
11:11AWizzArdYou should decide if you need volatile or unsychronized
11:11lpetitmicahmartin: of course you know you're not in clojure pasturages at all by doing so ? No controlled mutation via refs, etc. ..
11:12AWizzArdBut then again: very fast mutation.
11:12Freenk(.getContentPane frame) works about 400 times slower than java equivalent
11:12Freenkhow do I fix this?
11:13AWizzArd(.getContentPane ^JFrame frame)
11:13micahmartinlpetit: I rather stay in clojure pasturages, but how it it possible with cyclic dependencies?
11:13lpetitKototama: static methods are held by classes, not objects
11:13AWizzArdmicahmartin: for those you will have to use the mutable field feature of deftype.
11:14Kototamathen i need to use gen-class because of a stupid java api :-(
11:15lpetitmicahmartin: atoms or refs, I'd say. "refs as values" are possible. The semantics being that you hold the identity of the other object, not a value of this object at a particular time.
11:16lpetitKototama: ?
11:16lpetitKototama: which stupid java api ?
11:17Kototamathis one https://wizard.dev.java.net/
11:17AWizzArdlpetit: sometimes it is indeed a bit unfortunate. Say you want to implement your own IO stream. java.io.OutputStream is an abstract class. Not an interface. This means you can't use deftype. gen-class is possible, but its :state slot will only contain an atom or ref or something like that, and thus not give you maximum speed.
11:18Kototamahttps://wizard.dev.java.net/nonav/javadoc/index.html
11:18Kototama"Have a static method with the following signature: ... public static String getDescription()"
11:19Kototama(on the WizardPage class)
11:20AWizzArdlpetit: if you want to use (deftype LpetitOutputStream ...) then your deftype will not be a java.io.Outputstream.
11:20lpetitKototama: the first possibility is really not an option for you ? "Pass an array of already instantiated WizardPages to createWizard(). Note that for large wizards, it is preferable to construct the panels on demand rather than at construction time."
11:20AWizzArdSo, for issues like that, or like Kototama's it is sometimes required to do Java.
11:23Kototamalpetit: well maybe, i need to test
11:23lpetitAWizzard: sorry,maybe I didn't make my point clear. It was about whether micahmartin wanted (or not) to create datastructures that could play by clojure datastructure rules, so that they can be composed as other datastructures fearlessly.
11:23Kototamathanks
11:24replaca_rhickey: shall we look at autodoc for the new libraries?
11:24defnSo I just read about the new contrib style
11:25defnHow will people with signed CAs be migrated over to the new system?
11:25micahmartinlpetit: I'd like very much to stick to clojure idioms. It seems to me that the atom/ref idea fits... I'm going do that path right now.
11:26lpetitautodoc ! autodoc !
11:26Freenkwow
11:26replaca_the masses demand it! :)
11:26defnriot!
11:27Freenkgiving a typehint in function call made the call 3000 times faster
11:28Freenk(defn f [#^String s] (println s)) <- do I also need to hint in the call to println?
11:31G0SUBFreenk: hints are only for Java method calls.
11:32Freenkreally?
11:32Freenkdon't think so
11:32FreenkI saw an example otherwise somewhere
11:32G0SUBFreenk: any counter-examples?
11:33G0SUBFreenk: in general, you shouldn't need hints if you are dealing with Clojure data structures and clojure functions.
11:33Freenkhttp://clj-me.cgrand.net/2010/06/10/primitive-types-support-for-fns-coming-to-a-clojure-branch-near-you/
11:33Freenkbut then I'm stuck with this huge performance gap
11:33G0SUBFreenk: that's for functions to return primitives.
11:33Freenkit's really really reall really really bad
11:34Freenkhere's another example
11:34G0SUBFreenk: right now, Clojure functions can't return primitives since they get boxed automatically.
11:36Freenk(time (dotimes [n 1000000] (.get #^rec rec1 :ll)))
11:36Freenk"Elapsed time: 28.454599 msecs"
11:36Freenk(time (dotimes [n 1000000] (.get rec1 :ll)))
11:36Freenk"Elapsed time: 3290.01511 msecs"
11:36G0SUBFreenk: what's that .get method call?
11:36Freenkyeah well rec generate java
11:36Freenkdefrecord
11:37G0SUBFreenk: you can use (:ll rec1)
11:37lpetitreplaca_: masses, masses, I'm not *that* big ! :)
11:37Freenkinteresting
11:38Freenk(time (dotimes [n 1000000] (. #^rec rec1 :ll)))
11:38Freenk"Elapsed time: 6.527401 msecs"
11:38Freenkeven faster
11:38G0SUBFreenk: what about (:ll rec1) ?
11:38jk_Freenk: what about without the type hint?
11:39Freenk27 msec
11:39Freenkfor (:ll rec1)
11:39Freenkso thats still 4 times faster
11:39Freenkwithout type hint it's 5000 msecs
11:39AWizzArdThat is understandable.
11:40Freenkit narrows down the use of language somewhat
11:40AWizzArdAnd hiredman mentioned some days ago, when I talked about this, that HotSpot may translate (:foo rec) to (.foo rec).
11:40defnhaha LauJensen : Your "taking uncle bob to school" post is unparalleled.
11:41AWizzArdFreenk: but (.foo ^Rec rec) should be the same as (.get ^Rec rec :foo), yes?
11:41Freenk(:foo rec) <=> (.get :foo rec with typehint)
11:41Freenklet's see
11:42Freenknope
11:42G0SUBFreenk: what kind of software do you want to build with Clojure?
11:42lpetitdefn: well, at least Uncle Bob's version is working correctly :-p
11:42Freenkactually the .foo version with typehind is the same as (. ^Rec rec foo)
11:42Freenk6 msec
11:43defnlpetit: oh he broke it? :)
11:43lpetit,(macroexpand-1 '(.toString ""))
11:43clojurebot(. "" toString)
11:43lpetitFreenk: ^^
11:43Freenkclearly
11:43Freenkmacros take time
11:43Freenk:P
11:44AWizzArdFreenk: yes, this is what I meant. The (.field ^Type obj) accessor is the most efficient.
11:44G0SUBFreenk: nope. macros are expanded once at compile time.
11:44Freenkwhat kind of software? I was evaluating it
11:44Freenkseems to be like perl or Ruby
11:44Freenksorry not perl
11:44G0SUBFreenk: really? Interesting.
11:44Freenkpython
11:45Freenkand by that I mean mostly useful for IO and DB bound software
11:45lpetitdefn: well, Lau was too smart in some areas ... : replaced (defn- plus-key? [c] (or (= \+ c) (= \= c))) by #(= \+ %) for example
11:45Raynesdefn: Seems like he got a lot of heat for it though.
11:45G0SUBFreenk: what about concurrency?
11:45RaynesOf course, I agree. Excellent post.
11:45Freenkif you use IO and databases you can usually take the performance hit on the order of a few dozens
11:46lpetitFreenk: "take time" as in "time to learn" ? If not, then G0SUB is right, macros take no runtime time !
11:46Freenkyou'll need concurrency because the java app outpaces you on singlecore
11:47defnRaynes: for what?
11:47G0SUBFreenk: what about correctness of your code?
11:47Raynesdefn: That blog post.
11:47Freenkjava got generally useful when they got the performance down below the factor of 2 compared to C
11:48Freenkand it's still not used for performance critical things like games
11:48defnRaynes: oh geez -- Uncle Bob's ego is massive. I was happy to see the post.
11:48AWizzArdFreenk: Java is not used for games?
11:48Raynesdefn: No, it wasn't Uncle Bob.
11:48fliebelFreenk: Minecraft :D
11:48Freenkdynamically typed languages never seriously got past the "I can do websites and DB queries" apps
11:49Raynesdefn: I don't think Lau disclosed who he got heat from.
11:49Raynesdefn: Uncle Bob was apparently happy about it.
11:49defnRaynes: oh... *shrug*
11:49defnyeah it's good to have dialog
11:49Freenklol yeah I don't think I've ever played a single java game
11:49defnlearn from mistakes and all of that
11:49Freenkminecraft has some leet graphics
11:49defnit's like remote pair programming or something
11:49G0SUBFreenk: what about Erlang?
11:49Freenkdon't know about Erlang
11:49defntime lapse remote pair programming
11:49defnaka feedback
11:49AWizzArdFreenk: what about Poisonvill? http://www.youtube.com/watch?v=XSfR5Q6KBBw&amp;fmt=22
11:50AWizzArdThis is written in Java, but could in principle be done with Clojure.
11:50djpowellinteresting experiment: hack LockingTransaction to always retry transactions 5 times before continuing, then try to run the tests.
11:51Freenkdoubt it AWizzArd
11:51djpowell(hint: it fails)
11:51Freenkonly if you type hinted every call
11:51Freenkand even then
11:51Freenkask game developers
11:51Freenknobody seems to pick java for some reason, they all pick C++
11:52Freenkthey must have their reasons
11:52AWizzArdFreenk: they typically prefer C++ as this still offers the best speed.
11:52AWizzArdFor many it does not matter that Java is fast enough. They want the fastest.
11:52Freenkright...as I said
11:52djpowellthere is an interesting presentation about alternative languages for gamedev, hang on...
11:52Freenk40% is 40%
11:53steven_tscala vs clojure.. go!
11:53Freenkdynamically typed languages with their 3x to 500x slowdowns stand no chance at all
11:53AWizzArdhttp://bytonic.de/html/benchmarks.html looks more like 20%
11:53djpowellhttp://groups.csail.mit.edu/cag/crg/papers/sweeney06games.pdf
11:54lpetitI found Lau's article a little bit unfair: more a matter of style than anything else. Letting closing parens not together, really, who cares ? Using refs before atoms ? Better than premature optimization with atoms and then subtle problems. Using condp over cond. Why not, but not general enough for the problem, and introduced a bug just to make a point ...
11:54Rayneshttp://blog.acidrayne.net/?p=12 My first Clojure Conj blog post. Probably kicking off a short series documenting my trip.
11:54lpetitThe last point on dynamicity I liked, though, because I myself tend to not think like this, and it's refreshing to be reminded of that :-)
11:55AWizzArdFreenk: for game development with Java/Clojure have a look at http://www.jmonkeyengine.com/
11:57TobiasRaeder@Raynes is there an atom feed to the blog?
11:57RaynesUm, I'm not sure. I haven't had it long.
11:57TobiasRaederk :)
11:57RaynesProbably isn't hard to add one with a plugin or something. I'll check it out in a few.
11:58lrennTobiasRaeder: http://blog.acidrayne.net/?feed=atom
11:58RaynesOh really? Hrm.
11:58RaynesProtip: Learn about wordpress before using wordpress. ;)
11:58TobiasRaederthx
11:59hugodwould anyone have a stable-sort?
11:59lrennRaynes: rhickey's hair _is_ pretty amazing...
11:59djpowell(summary of that gamedev link, it suggested that constantly manipulating mutable object graphs pretty much confines them to single threading, as multithreading would be a deadlock-fest - so the author suggests STM as an alternative; and for heavy mathematical calculations suggests a more functional language would lead to less bugs)
11:59RaynesIt certainly is.
11:59KruppeRaynes: heh, learning by doing is also a pro technique though
12:00LauJensendefn: Unparalleled?
12:00LauJensenlpetit: honestly you dont know what you're talking about
12:01lpetitLauJensen: maybe, those things happen :)
12:01LauJensenThough it seems like Uncle Bob was the only one who liked that post
12:01lpetitLauJensen: I'm trying to be arrogant, today ... seems like I've been unsubconscioulsy influenced by some sentences :-p
12:02lpetitLauJensen: oh really ? Why the only one ?
12:02LauJensenlpetit: keep it up and I'll award you a fist fight
12:03LauJensenlpetit: Well. Uncle Bob thanked me for it and liked the tips. A lot of other people started crying that public code reviews where poor style and that Bob deserved more respect. They must have missed the fact that he publicly asked for it
12:03defnLauJensen: exceptional
12:03esjLauJensen, lpetit: are you two brothers or something ?
12:03LauJensenhaha
12:03RaynesLauJensen: For what it's worth, I enjoyed the post.
12:03Raynes<3
12:03LauJensenRaynes: Thats nice, my one loyal fan :)
12:03defnyeah i liked it, not sure what people are whining about
12:04lpetitLauJensen: I was not aware of the heat. And I've honestly said how I feeled when I read the post. That's all. And I'm not responsible for the "heat".
12:04defnit's a good post demonstrating clojure idioms
12:04LauJensenThanks
12:04LauJensenGotta go eat now, have a good evening everyone :)
12:04defnyou too lau, cheers
12:04lpetitcu
12:04lpetitbro ;)
12:07Freenkdjpowell I read it
12:08Freenkbut know this...while mutating object confines them to single thread
12:08Freenkchanging non-mutable objects creates strong slowdowns
12:08Freenkand I'm not just talking about pure cost of copy
12:08Freenkbut also in object alocations
12:09BahmanHi all!
12:09Freenkyou need to alocate tree nodes to wrap the objects you insert into lists
12:09Freenkwith ArrayList, you only insert reference into array
12:10@rhickeyreplaca_: yes, we should get together a plan for that
12:19replaca_rhickey: ok, shouldn't be too hard. I'll need the github hooks, of course
12:20replaca_rhickey: probably, it's going to wait until after conj before it's operational - I'm still fine-tuning my preso.
12:21@rhickeyreplaca_: sounds sensible
12:35iveyAny google group admins around that can approve my membership?
12:40@rhickeyivey: done
12:40iveyCool. Thanks!
12:43G0SUBrhickey: can you kindly approve my membership request to clojure dev group? my email is b.ghose at gmail.com
13:05iveyrhickey: how soon is the contrib assembla -> something else change?
13:18reburgwrapping up a java lib that takes a byte[] as a parameter... is there a more idiomatic clojure thing that should be wrapped in?
13:21cemerickreburg: nope, byte arrays are what they are :-)
13:21cemerickunless the data involved is *actually* a string or someting
13:21cemerickBut that's pretty rare.
13:21reburgcemerick: figured. it's the payload for an http request, so it makes sense.
13:22@chouseror a vector of bytes, perhaps
13:36Drakesonis *out* not dynamic?
13:37AWizzArd:)
13:37AWizzArdDrakeson: do you use a fresh clojure.jar?
13:38DrakesonAWizzArd: would I care otherwise? ;)
13:38RaynesMayDaniel: That ->_ macro is neat.
13:39RaynesIt reminds me of frying (I think) in Factor.
13:40AWizzArdDrakeson: it is possible that some vars are not defdynamics yet.
13:40leifw,(doc ->_)
13:40clojurebotIt's greek to me.
13:41Raynesleifw: http://github.com/MayDaniel/cljandbox/blob/master/src/cljandbox.clj#L7
13:41leifwsexy
13:42cemerickThere's a much more common name for macros like ->_, but I can't think of it.
13:43leifwthat's how I always wanted -> to work :)
13:45cemerickThere's a lot of history around people pushing for such a thing. It's never gotten much traction.
13:47raekwhat is this defdynamic I hear people mention?
13:48AWizzArdraek: like def, but it allows a var to be bound in a (binding [your-deftynamic-here 123] ...)
13:49RaynesWhoa, you have to explicitly make vars dynamic now?
13:50pieterbreedHi everyone, sorry for barging in like this, I'm looking for help with clojure-couchdb, specifically (attachment-create). Is this a good place to ask for help?
13:50ohpauleezRaynes: yeah, but it's a good idea
13:50ohpauleezbecause more often than not, you don't want them dynamic, and these changes setup for huge optimizations
13:51Raynesohpauleez: I think it's neat. But still: whoachanges
13:51raekI could live with that.
13:51ohpauleezfor sure
13:51raekthe mock people will cry
13:51cemerickraek: they've been mollified, so I hear
13:51ohpauleezraek: There's already a plan for that
13:52cemerickpieterbreed: don't know anything about clojure-couchdb. I could help if you were using clutch. *shrug* :-)
13:52AWizzArdIn principle it should not be a too big change when the compiler tells us where the problems are. Only thing is that a few vars might have been forgotten in those first versions of it :)
13:52raekbut for me, I guess I'l just have to change all (def *var-with-earmuffs* ...)s into (defdynamic *var-with-earmuffs* ...)s
13:52raekso, since which version does this apply?
13:53pieterbreedcemerick: I'm taking the plunge with clojure and I have a hella lot to learn all at once for a project I'm tackling... I just don't know what I don't know that causes my stuff to fail
13:53AWizzArdWhat is this thing about earmuffs?
13:53AWizzArdI thought those are things that protect your ears from too loud sound.
13:54raekthe asterisks
13:54cemerickpieterbreed: Understood. Feel free to paste exceptions or whatever, but I don't know of any clojure-couchdb users here. Maybe yours is a purely clojure-related issue.
13:54@chouserindeed. and also protect your var from being static
13:54cemerickOr perhaps there's a clojure-couchdb list somewhere.
13:55cemerickpieterbreed: For full disclosure, I'm a committer on http://github.com/ashafa/clutch
13:55pieterbreedno exceptions, I'm just not seeing the data in the db as what I'm expecting... I'l look around some more, but thanks! :)
13:56tbatchelli_cemeric, my fault :(
13:56AWizzArdraek: but what vars, besides those in let and constants are *not* within asteriks?
13:56cemericktbatchelli_: Hey, that's the way it goes. :-)
13:57raekwell, functions
13:57cemericktbatchelli_: I think it's a phonetic tendency, rather than a simple familiarity with disclojure
13:57raekI got my view from here: http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards
13:57Yeannohi, I wonder about how to develop clojure applications. The only IDE that provides a standard compile-and-run is enclojure - which I've used up until now because of this. I understand how to use a repl but I don't understand how to develop a complete (swing-)application like this? what am I missing?
13:57raekit mentions the *earmuff* thingy
13:57AWizzArdFor one moment I thought there were vars that you def’ed which don’t have the *
13:58tbatchelli_cemerick, ah, then it is rhickey's fault :)
13:58raekAWizzArd: I guess you disregard defns from that?
13:58ohpauleezraek: There was talk about auto dynamisizing (I made that word up) when you see earmuffs, but I think that was abandoned
13:58ohpauleezand that change went in sometime in the past three days
13:58cemericktbatchelli_: sssshhh, that might be the straw that breaks rhickey's back ;-) ;-) ;-)
13:59cemerickauto dynamisizing is there AFAIK, but will be removed before release
14:00ohpauleezcemerick: Ahh, thanks for the correction
14:01tbatchelli_Is there a way to call a java method from the method name as a string? (. (symbol "toString") "hello world") doesn't work
14:01AWizzArdraek: yes the mention of “def” made me think you were talking about those, and not defns.
14:01raekoh, yeah. now I see.
14:01ohpauleeztbatchelli_: You can use standard java reflection
14:01cemerickwooby: hey, are we a go for having a "sign & submit your CA here" table at the conj?
14:01ohpauleezI don't know about built in clojure stuff
14:02raekI was thinking about vars in general, but what I wrote did non reflect that...
14:02cemericktbatchelli_: clojure.lang.Reflector is handy
14:02tbatchelli_ohpauleez: that was plan B. Wondering if there was a plan A
14:02AWizzArdraek: and why would you change all earmuffers to defdynamic vs. just those 2-3 that are realy supposed to be rebound?
14:02tbatchelli_ohpauleez, cemerick: reflection it is then!
14:03ohpauleezuse cemerick's suggestion, that's a good idea. Makes things feel much more natural
14:03raekI thought the convention was to only put earmuffs on the vars that was supposed to be rebound...
14:03RaynesSome people seem to use it for globals though.
14:04RaynesI'm not one of them.
14:04ohpauleeztbatchelli_: or else you end up with something like: (.getMethod Cassandra$Client method# (into-array Class (map type args#)))
14:04ohpauleezin a macro or fn
14:04raekI think the set of vars that are neither constants nor intendet to be rebound is very small, anyway
14:08raekAWizzArd: in my experience, those 2-3 vars were all the earmuffed... :-)
14:09AWizzArdI did not want to sound too critical, I was just curious.
14:10AWizzArdTypically I have 10% of all defs that need to become defdynamic
14:10ylandohello
14:10raekI understand... I just wanted to sound less ignorant
14:12raeknow back to studying LR parsing...
14:12Raynesraek: http://acidrayne.net/logs/irc.freenode.net/clojure/current.txt sexpbot can log now. Let that be motivation to complete timeouts in Irclj. :>
14:29tbatchelli_cemerick, ohpauleez: following up. this seems to work (defmacro method-call [object method-name & params] (let [method-symbol (symbol method-name)] `(. ~object ~method-symbol ~@params)))
14:30tbatchelli_e.g. (method-call "hello" "concat" " world!") -> "hello world!"
14:31klangI'll just let this http://gosu-lang.org/comparison.shtml sit here for a moment ..
14:31@chousertbatchelli_: only when you give a literal string in the macro form
14:32cemerickklang: You're just a rabble-rouser. :-)
14:32jkkramer"not lisp"...nice
14:32tbatchelli_chouser: you're right :(
14:33kotarakHmmm... Is "modifying existing types" called "monkey-patching"?
14:33cemericktbatchelli_: If you're in runtime land, reflection is your only friend -- or, eval, which may be more or less evil, depending on the case.
14:34@chousertbatchelli_: I wrote a longish stack overflow answer about this
14:35ohpauleeztbatchelli_: See my macro above, if you want to roll your own
14:35klangcemerick: .. fair enof. The "not lisp" just caught my eye there :-)
14:35ohpauleezbut I suggest you just use the clojure.lang.Reflector call
14:35ohpauleezit does exactly what you want
14:36_fogusklang: The Not Lisp column is the best part. :-)
14:36cemerickklang: indeed...quite funny :-D
14:36kryftNot lisp where?
14:37lrennI like how they say "solid tooling support" but none of the links, including the download work.
14:37cemerickThere's no not lisp here! Run!!
14:37cemericklrenn: I'm pretty sure it's all very tongue-in-cheek.
14:38cemericktalios linked to the author's slides from the jvm language conf, I presume it's real
14:39klang_fogus: I guess we have to welcome all new languages to the JVM .. makes the ecosystem stronger.
14:39technomancygosu was going to be presented at the emerging langs conf, but they couldn't make it
14:40cemerickBummer. That "not lisp" feature sounds killer.
14:41ohpauleezdnolen: I'm thinking the new contrib would be a good destination
14:41ohpauleezjump on it!
14:41dnolenohpauleez: haha I got a lot of reading to do.
14:42ohpauleez:)
14:43kryftOh, I guess I could read the backlog a bit further.
14:43kryftOr sleep at night, hmm.
14:44_fogusdnolen: The Qi book shows how to implement it (I think)
14:44@chousertbatchelli_: this is related and might help: http://stackoverflow.com/questions/3748559/clojure-creating-new-instance-from-string-class-name/3752276#3752276
14:44kryftI ended up reading "Lisp is not an acceptable lisp"
14:44kryfthttp://steve-yegge.blogspot.com/2006/04/lisp-is-not-acceptable-lisp.html
14:44tbatchelli_chouser: thanks, I couldn't find it!
14:45@chousertbatchelli_: yeah, me either. I ended up going through my profile :-/
14:57jweisstechnomancy: i am using the latest version of slime (2010-10-09) because it works better with sbcl, but now when i run slime-connect to a lein swank process, i get the user prompt, if i type "(+ 1 1)<enter>" nothing happens.
14:57jweissthe point goes to the next line and just sits there
14:58technomancyjweiss: yes, trunk slime breaks frequently
14:58jweisstechnomancy: what version of slime should i try?
14:58technomancyI don't have time to follow it closely myself
14:58technomancy20100404 is the supported one
14:59jweissah ok
14:59_foguskotarak: Try writing a book... it does wonders for your sense of humor. ;-)
15:00amalloybut you often catch some kind of footnote disease
15:01kotarak_fogus: I have a lot of humor at work: Galgenhumor. (roughly: gallows humour) I hope the book one would be different. :]
15:02_foguskotarak: Gallows humor helps a ton.
15:03cemerickamalloy: I've got the beginnings of that. It's not pretty. :-P
15:07_fogusamalloy: I suffering from massive footnote disease
15:07amalloy_fogus: i had you in mind when i said it :)
15:08_fogusamalloy: I make no apologies! I have a blog post in the works that is 5 words with a 7-page footnote. ;-)
15:08amalloyand i will enjoy reading it!
15:10Raynes_fogus: I aspire to be. Unfortunately, markdown doesn't have built in footnote syntax, so you have to drop to html to make psudofootnotes in stackoverflow.com answers.
15:19petrilli_fogus: That sounds like the average page of some of my college textbooks.
15:23petrilliThe web truly needs better footnoting and bibliographies
15:29jweissis there a functional way to take a seq and have some input rows map to multiple output rows?
15:29amalloyjweiss: rows?
15:29jweisss/rows/list items/
15:29sexpbot<jweiss> is there a functional way to take a seq and have some input list items map to multiple output list items?
15:29jweisssorry
15:29@chousermapcat
15:30amalloyyeah. make every list item map to a seq of items, and glue them together however you want
15:31raek(aaply concat (mapcat f coll)) ; seems to be a common pattern
15:31raek*apply
15:32raekof waut
15:32chouserreally?
15:32raek/facedesk
15:32chouser,(mapcat #(list % (inc %)) [2 4 6 8])
15:32clojurebot(2 3 4 5 6 7 8 9)
15:32raekmore like (defn mapcat [f coll] (apply concat (map f coll)))
15:32chouserraek: ah, that's better. ;-)
15:35amalloyfwiw raek, (apply concat (map f coll)) is a common antipattern i keep accidentally putting in my code
15:37raekI have had a similar experience with (map (fn [x] ...) coll) --> (for [x coll] ...)
15:37cemerick"store" is an actual project name?
15:38chouserraek: I tend to flip back and forth on that one
15:38chouserraek: and become vaguely annoyed the format of the code is so different between the two
15:39raekfor large function bodies, the latter tend to be a lot easier to indent in a pretty way
15:54zmyrgelhi, could someone point whats wrong with my ns definition, http://pastebin.com/jScdHnmQ
15:56amalloy(:use (tursas game move state0x88))
15:56amalloy() and [] have different semantics in (ns) forms and i don't really know what they are, but i think this form works
15:58raekzmyrgel: I think your code should work. I only got a "Could not locate tursas/game__init.class..." error, which suggests that the ns macro accepts the syntax. are you sure there error is not in another ns form?
15:59raekalso, you don't need them wrapped vectors if you don't pass any options
16:01raekI vagely recall that the error file and line number is for the first ns form evaled, and not for the ns form where the error actually happened
16:01zmyrgelnice
16:05astoddardThis may not even be a sensible question but is there anything like 'pfor' in place of "for in the same way "pmap" can be used in place of "map"?
16:05raekzmyrgel: maybe the original exception is in the cause of the one you see
16:05raekzmyrgel: if you use emacs with slime, you can press 1 in the exception buffer
16:06chouserastoddard: perfectly sensible question. the answer is "no"
16:07zmyrgelraek: I'm using emacs but I don't know how to trigger the error in it
16:08raekare you using slime?
16:08zmyrgelyeah
16:08zmyrgellein swank + M-x slime-connect
16:08raekgreat. do a C-c C-k in the buffer you wish to evaluate
16:08raekthat compiles the file
16:09raekthen a new buffer should pop up with the stack trace
16:09raek(well, actually "compile" means (require 'the-ns :reload) in this case)
16:10zmyrgelraek: just got slime-compile buffer with just the error message and it points to the ns form
16:10nickikStrg Alt X on something and you throw an error too
16:11raekzmyrgel: ok, then click on the cause line, or press 1
16:11raeknickik: german keyboard?
16:11nickikyes
16:12zmyrgelraek: 1 gives buffer read-only error and clicking the error line gives me the state:1 as in the pastebin
16:13astoddardchouser: Thanks. I have some expensive calculations over product of two sets of inputs. I'll try a pmap over the second variable inside a for over the first variable.
16:13astoddardover _the_ product.
16:15raekzmyrgel: sorry, the C-c C-k commands gives a different exception dialog that doing a M-C-x on the ns form...
16:16raekbut when I edited the ns form in b.clj to contain an error, and then doing C-k C-k in a.clj (which uses b.clj), the error is reported to happen in b.clj
16:30bartjhas anyone here used Mallet (Java MachineLearning library)?
16:59plathroplancepantz: you around?
16:59RaynesIs it a cake question?
17:00plathropNo, it's a yaml question. I've got to parse some yaml that is getting output by a ruby application and I can't figure out how to do it.
17:00plathropHis library is failing on me because the stuff is tagged as a ruby object
17:00RaynesOh
18:02defni have a hare-brained scheme
18:03chousercan't be worse that the one I just came up with. What's yours?
18:03defnI want to read in a file that looks like [(ns foo.bar (:require foo.xyz)) [:html [:body]]]
18:04defnand then eval everything at the front of the collection
18:04defnso a user can define a namespace for functions to exist in which apply to this specific template
18:04OnceI was thinking of something like that yesterday.
18:04defnam i missing some underlying complexity, or does this actually work?
18:04OnceUsing hiccup
18:05defnOnce: I beat you to it! wahahaha!
18:05OnceI didn't get around to trying it.
18:05OnceI was just thinking about it.
18:08defnI don't know if it's a Good Idea(tm)
18:09defnthe whole namespace changing thing is a little funky
18:10chouseryou want to change namespaces more than once in the same file?
18:11jjidohow do you expand a macro?
18:11Oncemacroexpand
18:11raekjjido: (macroexpand-1 '(code...)) or (macroexpand '(code...))
18:11jjidoaah there is no dash
18:12raek,(macroexpand-1 '(cond (even? x) :even (odd? x) :odd))
18:12clojurebot(if (even? x) :even (clojure.core/cond (odd? x) :odd))
18:15@rhickeyso, who would be crushed if you couldn't mix doubles and longs in primitive sigs?
18:15@rhickeyjust longs + objects or doubles + objects
18:17dnolenrhickey: it does seem like a weird limitation. hmm wonder if that would cause trouble in some kind of accumulation scenario.
18:21chouserI agree it feels weird. I'm guessing this is to support primitive args for closures?
18:22@rhickeyyeah, supporting 4 args with both is about 360 interfaces
18:22@rhickeyless than half that is discrete
18:22@rhickeyI still don't know yet what the cost is for the interfaces
18:23@rhickeyif discrete
18:24jjidodo you use Java to get a file Reader or is it in Clojure already?
18:25ossareh,(doc slurp)
18:25clojurebot"([f & opts]); Reads the file named by f using the encoding enc into a string and returns it."
18:25raekjjido: you can use clojure.java.io/reader
18:26jjidoossareh: I cannot use a String, or else I need a string reader
18:26raekrhickey: any ideas why all the docs on http://clojure.github.com/clojure/ seems to be for 1.1?
18:26ossarehjjido: my bad, I read "read a file"
18:26jjidoossareh: np
18:27raek...or maybe I should bug Tom Faulhaber about that instead...
18:29technomancythe slurp docstring needs updating; it takes more than just filename args now
18:32raekI love that new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8")) translates to (clojure.java.io/reader filename)...
18:42jjidohow can I tell the filenames passed to the program as arguments?
18:43jjido*command-line-args*
18:45raekjjido: if the program is started with a gen-class'ed main method, then the arguents are passed as the arguments to -main. if the program is started with clojure.main, they are put in *command-line-args*
18:47raekso it depends on whether you run it as a class (main method) or a script (clojure.main)
18:49gfrlogdoes anyone know if I can use the magical new type system to make (sort) respond to a seq of sets?
18:50gfrlog,(sort [#{1 3} #{3 2}])
18:50clojurebotjava.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.PersistentHashSet cannot be cast to java.lang.Comparable
18:51jjidoraek: thanks. I do not do ahead-of-time
18:51gfrlogooh, I can't sort maps either
18:52gfrlogI guess I spent too much time in erlang
18:53jjidoLooks like I need a single Reader that chains the files together
18:54hiredmanhttp://download.oracle.com/javase/1.4.2/docs/api/java/io/SequenceInputStream.html
18:59jjidohiredman: cool!
19:01jjido,(doc reduce)
19:01clojurebot"; "
19:02@rhickeyok, only 10k more jar for the ~360 interfaces needed for all L/D/O combinations to arity 4
19:03zkimrhickey: you getting a chuck norris thing going here? :)
19:04@rhickeyzkim: what does that mean?
19:05zkimrhickey: like "chuck norris turns off the sun at night" http://www.chucknorrisfacts.com/
19:05@rhickeyah
19:06@rhickeyno
19:09octehow do i access an inner class in clojure?
19:09octelike proxying java.lang.Thread.UncaughtExceptionHandler
19:10octeah, Thread$UncaughtExceptionHandler
19:16polypusadd-watch allows references to be mutated between the mutation that causes a watch to be called and the calling of that watch. is there a way of ensuring that some side effect inducing function is called iff a ref is succesfully mutated w/o allowing any "in between" mutations?
19:52clizzinHow can I run 'lein swank' but allocate more memory for the JVM?
19:53zkimclizzin: I believe lein picks up JAVA_OPTS
19:54clizzinzkim: ah, cool. thanks!
19:54zkimclizzin: np
19:56maravillasgary_poster: are you around?
19:56rickmodeAre there some good guidelines for using dynamic binding? I'm building some web form validation, and am trying to figure out where to put a keys to field name map (like {:username "Username, :password "Password"}). This name map would be used through many functions in a nested call tree
19:57hiredmandon't
19:57rickmodeSo I could have a *name-map* and use a binding... but... it feels odd
19:58rickmodehiredman: thanks... heh
19:58rickmodeIs there any other clever way to pass a chunk of data through many levels of a call tree short of ... actually passing it around?
20:00dnolenrickmode: that's what binding is for.
20:05hiredmanrickmode: they're called monads
20:07amalloyyeah, i was gonna volunteer monads except that i have no actual experience with them
20:09rickmodehiredman: trying to grok. I looked at monads over a year ago when I got into Scala. I'm reading up....
20:16amalloyrickmode: i've been trying on-and-off for a month or so. i think i get the idea but i haven't found an excuse to use any yet
20:17amalloyhttp://intensivesystems.net/tutorials/monads_101.html was the best description i could find
20:17rickmodeamalloy: i'm reading the on clojure version at the moment: http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/
20:18amalloyyeah, i read that but it was too short. i liked the painstaking detail in the other
20:18iveytechnomancy: i'm going to the beach for a few days, and have some hack time. you still have low-hanging lein fruit?
20:18rickmodewhen I was poking around with common lisp back in February or so (before I gave up on it and moved to Clojure), I was trying to wrap my head around continuations. I ... almost got it. But then I barely get the Y Combinator. Those are the sort of things that I have to learn and actively use a while before they sink in.
20:19amalloyheh, that's about when i was giving up on trying CL too
20:19technomancyivey: if you have any mixed java/clj projects you could test and document the new javac task
20:20iveysadly for you, and joyously for me, i do not.
20:20technomancyhehe
20:20technomancyivey: I'd like to get more eyes on http://github.com/trptcolin/lein-plugin and merge it into leiningen if it's ready
20:21dnolenrickmode: Little Schemer seems to be an excellent intro to Y so far. Seasoned Schemer covers call/cc. Fun books. Looking forward to digging into the Reasoned Schemer.
20:21iveythat i can do.
20:22technomancyivey: also (not sure how hard this would be) a way to enable offline mode would be nice. might take some diving into the maven-ant-tasks API. haven't looked into it much myself.
20:22technomancythanks!
20:22DeusExPikachuis clojure.java.* going to be added back into core? anyone know why it was removed?
20:22rlbTo answer my question from yesterday -- for large xml files, xml-picker-seq seems to work well (and lazy-xml doesn't).
20:24rickmodednolen: ya - read little schemer and have seasoned schemer on my "to read" shelf. I'm working through "on lisp" first though. I like how little schemer when from trivial to complicated to mind blowing in the last few chapters.
20:27dnolenrickmode: the chapter on continuations in On Lisp is good, there was an excellent PDF out on the web as well, but I can't find it anymore.
20:45yayitsweias a newbie I often accidently overwrite existing methods and get "WARNING: deref already refers to: #'clojure.core/deref in namespace: tracker.core, being replaced by: #'tracker.core/deref"
20:45yayitsweiis there a way to undo this? something like (def deref 'clojure.core/deref) ?
20:46rickmodeyayitswei: ns-unmap
20:46yayitswei,(doc ns-unmap)
20:46clojurebot"([ns sym]); Removes the mappings for the symbol from the namespace."
20:47yayitsweirickmode: perfect. thanks!
20:48rickmodeyayitswei: np... I had the same problem at first... when picking names these days I sometimes to put the name into the REPL and make sure it bombs. That at least makes sure is the collision isn't accidental.
20:49yayitsweithat makes sense
20:51yayitsweisomewhat unrelated, but I just found a way to get rid of the "Fontifying *SLIME Compilation*" message every time I run C-c C-k in SLIME, for the longest time I thought the compilation was slow (http://common-lisp.net/pipermail/slime-devel/2009-September/016717.html)
20:51yayitsweithis should go on the "tips for newbies" list
21:02rickmodeyayitswei: nice!
21:38_Vihttp://clojure.org/compilation says that "To speed up application startup".
21:38_ViWhy my application starts more that 2 seconds in both cases? I don't see any visible startup speed benefit.
21:39tomoj_Vi: do you see class files for your code in classes/ ?
21:39_Vitomoj, Yes. I start as "java -cp classes:/usr/share/java/jsch.jar:/usr/share/java/clojure.jar jscfi__init"
21:50_Vi[reposting due to netslits] tomoj, Yes. I start as "java -cp classes:/usr/share/java/jsch.jar:/usr/share/java/clojure.jar jscfi__init"
21:51chouseryou'd see the biggest difference if you had a large amount of .clj source code
21:51_Vichouser, Is there a way to speed up startup of little clojure applications?
21:52chouser_Vi: the only say to get anything close to "fast" that I know of is to have a JVM running already, and ask it to run your code
21:52chouserthere are a couple ways to do this. probably the easiest is to use cake
21:52_ViCan we keep a pool of pre-loaded JVMs with clojures?
21:53eslickAnyone online who has used clojure with Hadoop?
21:53chouserI think cake keeps one or two loaded for you
21:53_Vi(I've tried ng-sever, but applications misbehave there)
21:54chousereslick: I just learned about Cascalog last week. Sounds really interesting, but I haven't had a chance to play with it yet.
21:56_ViWhat is "cake"? Is it JVM thing or Clojure one?
21:56_Vi(google give many tasty cakes, but not one I want)
21:56_Vi*gives
22:02maravillas_Vi: clojure - see http://github.com/ninjudd/cake