#clojure logs

2010-08-20

00:00patrickdloganyeah, it doesn't complain to add the metadata to Foo but a java Class does not retain metadata.
00:02spewnI suppose that makes sense. Thanks.
00:11spewnShame that I can't carry over the docstrings from my defstructs though.
00:41technomancyLeiningen 1.3.0: http://tinyurl.com/2duzupg
00:41technomancyI was thinking I'd be releasing Lein 1.2.0 on the same day as Clojure 1.2.0, but alas; didn't work out like that. =)
00:56bortrebwhat's the idiomatic way to filter a map by it's keys xor values, and return the whole map?
00:56wwmorganbortreb: example input and output?
00:57bmhwhile where on the subject: is there a library function that will do [(filter f n) (remove f n)] in a single pass over n?
00:58bortreb(keys-filter even? {2 "two" 3 "three"}) would return {2 "two"}.
00:58bortreb(vals-filter even? {"two" 2 "three" 3}) would return {"two" 2}
00:59bortrebfight now I'm using zip-map akwardly but I was wondering if there was a better way?
01:04bortrebbecause, filter returns a lazy sequence....
01:05dnolen_technomancy: nice! I guess you can no longer start a REPL w/o a project.clj. Also lein repl puts you in clojure.core, shouldn't it put you in user ?
01:07wwmorganbortreb: here are two filter-keys implementations. I don't know if they're better- or worse-looking than what you have already :-p http://paste.lisp.org/display/113690
01:13bortrebwwmorgan: thanks for your help! of the two methods, the one that does not use threading seems to be slightly faster
01:14bortrebalthough, I figured there was some mega-hash-map library somewhere that already had this which I had overlooked
01:21bortrebwwmorgan: how about this one? http://paste.lisp.org/display/113690#1
01:23wwmorganbortreb: that looks pretty optimal to me
01:27bortreband I guess filter-vals looks prettiest as (defn filter-vals [fun m] (into {} (filter (comp fun last) m))) ? or can it be even prettier?
01:28wwmorganI'd use val instead of last to make it clearer
01:28bortrebwwmorgan: ooohhh that's a good one!
01:46LauJensenGood morning all
01:46itistodayLauJensen: Morning! and actually, good-night! I was just heading to sleep. :-)
01:47LauJensen,UGT
01:47clojurebotjava.lang.Exception: Unable to resolve symbol: UGT in this context
01:47LauJensenclojurebot: UGT
01:47clojurebotugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html
01:47LauJensenitistoday: sleep tight :)
01:47itistoday:-)
01:48RaynesMorning.
01:48LauJensenRaynes: pulling an all-nighter?
01:48RaynesLauJensen: I just woke up.
01:53LauJensenWhat time have you got ?
01:53LauJensen@ Raynes
01:54Raynes$time -5
01:54sexpbotRaynes: The time is now 2010-08-20T01:02:42Z
01:54LauJensenNice
02:09slyrustechnomancy: lein 1.2 or 1.3?
02:09rdsrI just noticed that there can be duplicate keys in literal maps
02:10hiredman,{:a 1 :a 2}
02:10clojurebotDuplicate key: :a
02:11rdsrhiredman, which version of clojure u are using?
02:12hiredman,*clojure-version*
02:12clojurebot{:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}
02:14rdsrthks
02:15hiredmanhttp://github.com/hiredman/Arkham/commit/f2dd23f554a676d2797da45929873a6a43068c73#L0L228 mmm
04:11lenwHi
04:11lenwis the following code safe : http://gist.github.com/539866
04:12lenwor would the stack build up
04:12lenw?
04:17AWizzArdlenw: no stack problem
04:18lenwAWizzArd: is that cause i am not passing anything through the recur ?
04:18lenwAWizzArd: just curious :)
04:19BjeringCan I use java objects as keys in clojure maps? What are the rules if I do?
04:19LauJensenlenw: yes. For the stack to blow you need to build the memory beyond what it can take
04:20LauJensen,{(make-array Integer/TYPE 5) "hi"}
04:20clojurebot{#<int[] [I@5f45f1> "hi"}
04:22LauJensenBjering: That means yes
04:24zmila,(clojure-version)
04:24clojurebot"1.2.0-master-SNAPSHOT"
04:24sparievBjering: re rules - from clojure.org/data_structures - Hash maps require keys that correctly support hashCode and equals
04:25LauJensenspariev: And I think also a 3.rd interface in the next release of Clojure, Rich mentioned that in here a couple of weeks ago
04:25LauJensenMapEqual or some such
04:27BjeringLauJensen and spariev, thank you. What if the java object changes values (and thus changes hash-code/equals) ?
04:28AWizzArdlenw: loop/recur is the plain old goto. There is no stack that can blow up.
04:29BjeringWell, my use-case is netty-channels as keys, they are not value-objects, they dont overload hashCode/equals, they are like the integer arrays LauJensen showed me works, id is their memory reference and isnt changing, seems it should be ok.
04:30lenwAWizzArd: that makes sense - and the "references" are rebound each time through
04:30AWizzArdyes
04:30lenwthanks
04:33sparievBjering: I think it will be ok, as long as keys' hashcodes won't change
04:36sparievLauJensen: interesting, I didn't know that. Do you have any links on this ? haven't managed to find anything relevant in irc logs ...
04:36LauJensenspariev: I'll grep my log, gimme 10 secs
04:37Rayneslenw: Also, you don't even need the loop there at all. Just plain ol' recur ought to do it.
04:38RaynesAnd I'm pretty sure you can't name something '1' ;)
04:38Raynes-> (def 1)
04:38sexpbotjava.lang.Exception: First argument to def must be a Symbol
04:39LauJensenAbout 20:53 CET, August 4 2010
04:39LauJensen<rhickey> got homemade IPersistentMaps? please try latest rev on github. Fixing
04:39LauJensen record equiality meant introducing a MapEquivalence marker class - you must
04:39LauJensen implement in order to be = to maps (APersistentMap does this)
04:39LauJensen
04:40sparievLauJensen: big thanks
04:40lenwRaynes: updated the gist - like that ?
04:40LauJensennp
04:41Rayneslenw: Yep. But like I said, you can't name it '1'.
04:42RaynesAnd, purely a style critique, you might consider setting tab width to 2 spaces.
04:42RaynesIt's usually two unless lining up function arguments.
04:42Rayness/function arguments/arguments/
04:43sexpbotIt's usually two unless lining up arguments.
04:43LauJensenRaynes: As far as I know, most people go with 4
04:44RaynesLauJensen: Since when? ._.
04:44LauJensenSince last time I googled it :)
04:44LauJensenI grabbed it from a larger tabs/spaces discussion in an Emacs forum
04:44RaynesLauJensen: clojure-mode indents two. Everything I've ever heard was "two" for Lisp.
04:45LauJensenReally? Interesting
04:46RaynesYup, that would be two.
04:48LauJensenOdd - My code does it as well, and Ive been staring a Clojure code for 3 years now and also remembered the number as '4' despite that fact thats its obviously 2 :)
04:48LauJensen(set! *memory-of-indentation* 2)
04:49Raynes:p
04:51RaynesOh cool. Clojure can destructure based on index now.
04:51LauJensenlink?
04:51clojurebotyour link is dead
04:52Raynes-> (let [{first-thing 0, last-thing 3} '[a b c d]] [first-thing last-thing])
04:52sexpbot=> [a d]
04:52RaynesLauJensen: http://fogus.me/static/preso/clj1.2+/ Slide 9
04:52LauJensennice
04:54RaynesA new clojure.java.browse namespace.
04:54RaynesI've been totally kept out of the loop.
04:54RaynesI'm pissed. ;)
04:55LauJensenbtw Raynes, there was a murder in your state the other day, did you hear about that, some 18 year old kid got shot in his own home?
04:55RaynesLauJensen: There are plenty of murders.
04:55LauJensenoh
04:55LauJensenI assumed there wasn't, since I actually heard about that one
04:55RaynesGo visit Detroit Michigan. ._.
04:58LauJensenRaynes: Michael Moore said that the US has 11.500 yearly homocides, vs 350 in Canada
04:58RaynesIndeed.
05:01sparievyou guys scare me. My gf have to visit Chicago in a couple of months
05:02Raynesspariev: Teach her to handle a .40.
05:02LauJensenspariev: Sorry
05:03sparievnevermind
05:04sparievRaynes: it's illegal to have firearm in Russia
05:04sparievyou can only buy gas pistols etc
05:05sparievbut we went way offtopic :)
05:43Ankouhi, is there a reason why http://clojure.org/downloads doesn't list clojure 1.1 under older releases anymore?
05:56LauJensenAnkou: I remember rhickey talking about wanting to see some downloads stats, which he could only do if the download was available from google code - I dont know if thats relevant to your question, but I haven't heard anything else
06:28__debaserhey, what is the best way to start a Clojure Repl with contrib and jline?
06:29__debaserlein repl works but you have to create a project in order to use it
06:29LauJensenjava -cp clojure.jar:jline.jar clojure.main ?
06:30__debaserthat does not include Clojure-contrib
06:31LauJensenjava -cp clojure.jar:jline.jar:contrib.jar clojure.main ?
06:31LauJensenSorry, its fixed now :)
06:32LauJensen__debaser: but personally what I do if Im just experiment, I hit M-x slime in Emacs, and that sets up a repl with contrib, penumbra, citerion and a host of other libs that I play with somewhat frequently
06:35__debaserLauJensen: strange, your version works just fine
06:35__debasertried the same yesterday and it didnt
06:35__debaserso thanks a lot
06:36LauJensennp
06:41__debaserI am just getting accustomed to Vim, so switsching to emacs is not an option
06:42__debaserand while the Clojure plugin for Vim is ver nice I find the repl in vim hard to use
06:44LauJensen__debaser: VimClojure?
06:45__debaseryes
06:45LauJensenYou could talk to kotarak, the author, about it. He hangs out in here most nights (CET)
06:53__debasernah, he did a good job on it, it's just not how I like to run it
06:53LauJensenok
06:53__debaserjava -cp ./clojure-1.2.0/clojure.jar:./jline-0.9.94/jline-0.9.94.jar:./clojure-contrib-1.2.0/target/clojure-contrib-1.2.0.jar jline.ConsoleRunner clojure.main works fine for me
06:54LauJensen__debaser: Thats crazy man, but different strokes for different folk I suppose
06:55__debaserhm, maybe i'll try it again, I never could figure out if I wanted to run the whole script or just the current line
06:56LauJensenIm just thinking, in Emacs you get tab completion, fuzzy completion, autodoc, code look up, object inspection, etc etc. With JLine you get zero. You're giving up 90% productivity to hang on to a fading editor. It just seems crazy to me
06:57ordnungswidrigyou can user viper with emacs
07:01ChousukeYou can, but it doesn't really work.
07:01__debaserwell I disagree that Vim is inferior to Emacs and it is definitely not fading but I understand that Clojure support is better
07:03Chousuke__debaser: Don't take LauJensen too seriously when he says things like that. He has a tendency to say flamebaitish things :P
07:04psykoticon this point, though, he happens to be 100% right. :)
07:04LauJensenIt wasn't a flamebait - I just felt bad for the guy sitting in a shell working with JLine, he's bound to have a tough time getting started
07:05kenshoHi. I'm looking for javadoc of the clojure API (on the java side, e.g. seqable interface etc.) but I can't find it?
07:05Chousukekensho: It doesn't exist :Ö
07:05Chousuke:P even
07:05kenshooh :(
07:05kenshoare there plans to make it available?
07:06Chousukeprobably not, as many of the interfaces are going to be replaced eventually anyway
07:06kenshoI see
07:06kenshoAre there any examples where I can see how to implement them then? :)
07:07Chousukein general though, if you need to implement the interfaces you should first see if you can extend any of the abstract base classes instead.
07:07Chousukesome of the interfaces (like IFn) are in fact generated code and implementing them fully manually is rather painful
07:08Chousukeso if you need to create a Clojure function from java, you should extend AFn instead
07:09ChousukeAt least, as far as I know. I haven't had to worry about the Java side of Clojure much.
07:09kenshoI see. Well I would like to make a w3c dom NodeList seqable, maybe something like that already exists?
07:09kenshoit's a pain to work with in clojure otherwise
07:10Chousukekensho: I think for now the easiest approach is to just make a function that returns a lazy seq made from the NodeList
07:11Chousukenot directly seqable but good enough most of the time.
07:11kenshoOh ok. I will try that then. Thanks
07:11ChousukeOf course you can go and look at ISeq and whatever other interfaces there are, but you'll pretty much need to figure them out the hard way :P
07:11cemerickthere's plenty of precedent, especially if NodeList is mutable, e.g. enumeration-seq and iterator-seq
07:12cemerickkensho: ^
07:13kenshoYeah well, maybe if performance is unacceptable I will look into it, I'll try the easy way for now :) thanks again
07:17LauJensenkensho: Dending on what you're doing with the w3m lib, you might want to check out Enlive
07:17AWizzArdthis is a classic, but I enjoy to see this language comparison each and every time *lol* http://i.imgur.com/1gF1j.jpg
07:23LauJensenWhat the way to do a cross table filter select in mysql? "select * from x where y is not in (select * from z)"? basically, all items from x where some field isnt equal to a value from a field in z ?
07:24bobo_dont think your allowed to do that?
07:25bobo_you have to specify column in z
07:26LauJensenbobo_: which is fine
07:26bobo_so select * from x where y not in (select w from z)
07:26LauJensenYea Im quite sure Ive seen it done/done it before
07:26bobo_i do way to much sql
07:26LauJensenyea something like that
07:29LauJensennice, that actually worked just as you would expect
07:32metagovThat notice about clonebots makes me think of replicants from Blade Runner. I wonder if they can even test for the Nexus 6 clonebots...
07:32LauJensenmetagov: they just inspect the meta data, its all there
07:37metagovLauJensen: Well, so long as clonebots still have a 4 year life span, I guess I won't worry too much ;-)
09:07adityonipra
09:09don333Raynes: *clojure-version* gives "java.lang.SecurityException: Code did not pass sandbox guidelines", could you perhaps whitelist it?
09:10don333I meant on try-clojure.org of course :)
09:10Raynesdon333: Indeed. (clojure-version) might work though.
09:10Raynesdon333: I'll do that in a little while. I need to update it to 1.2 and stuff anyway.
09:12don333should have checked the fn before whining...
09:12don333(clojure-version) works fine
09:12Raynes*clojure-version* should be whitelisted anyway. :p
09:13RaynesSo I very much appreciate your whining. :>
09:13LauJensenhehe
09:13don333heh
09:13don333good luck on 1.2 update then
09:16fbru02hey guys i have a question , before protocols when you wanted to emulate objects , there was only hashes right ?
09:17chouseror gen-class, but yeah hashes+metadata+(perhaps)multimethods
09:24fbru02chouser: thanks !!
09:25chouseroh, so people like defstruct but those are really just somewhat optomized hashes
09:25AWizzArdAlthough Clojure 1.2 is now officially here, I must admit that I will be happily using what will be 1.3 one day (:
09:26LauJensenStatics?
09:27AWizzArdLauJensen: you mean me?
09:27fbru02AWizzArd: is there a roadmap for 1.3?
09:27LauJensenyea
09:27AWizzArdLauJensen: for example! Maybe also Pods.
09:27LauJensenAWizzArd: How much info do you have on Pods ?
09:27AWizzArdAnd I am looking forward to marker interfaces for Records.
09:27AWizzArdLauJensen: mostly all info: Cells were renamed to Pods.
09:28AWizzArdI am probably the only user of Cells :)
09:28LauJensenk
09:28LauJensenWhat do you use them for ?
09:28AWizzArdLauJensen: for Transactions in my DB system
09:28LauJensenreally, got that public somewhere?
09:28AWizzArdUnfortunately I still can only say "soon".
09:29AWizzArdBut it will be available in source.
09:29AWizzArdAnd really soon I wish :)
09:29AWizzArdCurrently I am at lightweight and efficient serialization/deserialization. And for that a marker interface for records would be great.
09:30LauJensenAWizzArd: Which limitations in Clojure drove you to Cells?
09:31AWizzArdLauJensen: not in Clojure, but in refs and agents. I won't call them limitations however. The challenge is to atomically update a collection multiple times *and* writing data to disk *within* the transaction.
09:31AWizzArdrefs can't do that for the side effect "writing to disk" part.
09:32LauJensenso you wrote a ref which hands respins somehow?
09:32AWizzArdinstead of a ref I used a cell.
09:32AWizzArdNow I can update it in the (with-cells [] ...) block, which is equivalent to dosync.
09:32AWizzArdAnd still in the with-cells block I do IO.
09:32AWizzArdThis would not be allowed in refs.
09:33AWizzArdAnd agents would run in a different thread - it is awkward to learn about errors in transactions.
09:33AWizzArdI would have to pass in a promise into the agent and deref it outside.
09:34LauJensenHmm, that sounds like a super subject for a blogpost
09:35AWizzArdThose posts will all come.
09:35AWizzArdUntil now Cells were highly alpha.
09:35AWizzArdrhickey made a basic implementation and then concentrated on 1.2. But now he renamed them to Pods and will maybe change some aspects of them - we'll see.
09:37LauJensenVery interesting
09:37LauJensenWhat are your expectations for marker interfaces?
09:37AWizzArdThis is https://www.assembla.com/spaces/clojure/tickets/394-add-marker-interfaces-for-defrecords-and-deftypes-plus-boolean-test-fns
09:38AWizzArdFor any Object x I want to be able to ask (record? x)
09:38LauJensenAs yes I remember now
09:38LauJensenI think that has a pretty good chance of being implemented quite quickly
09:38AWizzArdThose can be serialized with a better strategy than unknown objects in general.
09:39AWizzArdLauJensen: yes, in principle I could imagine that this is more or less an empty interface plus 2-3 LOC in defrecord / deftype
09:40AWizzArdBtw, does the JVM support something such as "private interfaces"?
09:40AWizzArdSo that nobody could implement clojure.lang.Record in her classes, but only defrecord itself can do this?
09:41LauJensenIt supports private interfaces if nested
09:41AWizzArdsounds good, thx
09:45AWizzArdAnyone of the Maven experts here: does Maven support incremental builds? I have 30 .clj files in my build, and the produced .jar looks fine with the exception of small warts coming from 2 files. I change 5 LOS in two files. Do I now need to compile all 30 NS again or can it be done this time within a second (+ time for creating the .jar), cause only those two files will be recompiled?
09:46LauJensenAWizzArd: Im not sure cemerick or stuartsierra highlight on 'Maven expert' yet :)
09:47sparievAFAIK maven can sure do so with java files
09:47cemerickAWizzArd: That's a function of one's compiler, not the build tool.
09:47cemerickin any case, for both java and clojure, if you don't clean first, running mvn compile and/or jar will only compile the files that have changed.
09:48cemerickOr, more precisely, will only compile the files whose moddate is later than the corresponding classfile(s).
09:48rrc7czmy Monte Carlo calc of Pi isn't working too well (keeps returning ~3.6...) and I'm hoping somebody could help me spot the error: http://gist.github.com/540352
09:49AWizzArdcemerick: okay good, so this is implicitly present
09:49AWizzArdcemerick: I thought the build tool is doing that job of checking the timestamps. Thanks for that update.
09:50AWizzArdLauJensen: though those two may be some of the most experienced maven gurus in here (:
09:50cemerickAWizzArd: Neither ant nor maven handle that. I think make did? Totally not sure on that.
09:50AWizzArdk
09:51cemerickLauJensen: as long as you're johnny-on-the-spot with the mvn bat-signal, then I think myself or SS will be highlighted just fine ;-)
09:52LauJensenYea I know - I usually go to people directly if I know somebody is likely to have the answer
10:07slyruslet's see if the old "go to sleep with a tricky problem and wake up and see the obvious easy solution" trick works again
10:07RaynesIt works every time,.
10:07Raynestime.*
10:12LauJensenThat and a rubber plant
10:24Scala_Does clojure have any of those "get started" type packages that has a cli and an interpreter and everything you need to get going
10:24nachtalprrc7cz: try (float (* 4 (/ in (+ in out)))) instead of (float (/ in out))
10:25cemerickScala_: java -jar clojure.jar will get you a quick-n-dirty REPL.
10:25cemerickScala_: Note that clojure never interprets anything though -- everything is compiled.
10:26rrc7cznachtalp: that did it
10:26rrc7cznachtalp: thank you. I understand the * 4 since I am only sampling a single quadrant
10:27nachtalprrc7cz: see here: http://math.fullerton.edu/mathews/n2003/MonteCarloPiMod.html
10:28slyrus,(apply hash-map (map identity {1 2 3 4}))
10:28clojurebot{[1 2] [3 4]}
10:28slyrushow do I map over a map and get back a map?
10:28cemerickchouser: don't let the power go to your head, 'kay? ;-)
10:28dnolen_Scala_: cljr, cake are nice if you want a decent REPL. I prefer cake for REPL'ing. Note that Clojure has no interpreter. The REPL compiles on the fly.
10:29LauJensenslyrus: Usually reduce is a better fit
10:29Raynesdnolen: I like how cake does multi-line stuff.
10:29rrc7cznachtalp: that explains it, thanks
10:30slyrusLauJensen: yeah, I guess so...
10:30LauJensen,(reduce (fn [a [k v]] (assoc a k (inc v))) {} {:a 1 :b 2 :c 3})
10:30clojurebot{:c 4, :b 3, :a 2}
10:30LauJensenreplace inc with what you would have mapped for instance
10:31slyrusthanks
10:31slyrusor the trivial example I was looking for:
10:31slyrus(reduce conj {} {1 2 3 4})
10:31slyrus,(reduce conj {} {1 2 3 4})
10:31clojurebot{3 4, 1 2}
10:32slyrusI find myself wanting to conj map-entries into a map, instead of assoc'ing k/v pairs into a map. that's probably a mistake on my part.
10:33LauJensenWhy do you want that?
10:33slyrusit's not that I particularly want that, it's just two ways of thinking about doing the same thing
10:34slyrusand I'm thinking of the way that's a bit ... unnatural for clojure it seems
10:34slyrusprobably more CL-isms where cons is generally a lot easier to work with than make-hash-table, get-hash, etc...
10:35slyrusand most things in clojure seem to work as I expect them to. except of course when they don't, like my repeated unwarranted expectation that #[...] will be #(vector ...)
10:36LauJensenhehe
10:37chouserslyrus: also be aware of zipmap
10:37arkhLauJensen, could you provide a translation to a quote in JoC? : "Wer nicht von dreitausend Jahren. Sich wei Rechenschaft zu geben, bleib im
10:37arkhDunkeln unerfahren, mag von Tag zu Tag leben."
10:38chouser,(into {} {1 2 3 4})
10:38clojurebot{1 2, 3 4}
10:38chouser^^ more efficient than reduce
10:38LauJensenarkh: Sorry no, try AWizzArd :)
10:38nachtalprrc7cz: np :)
10:38slyruschouser: I want the three-arg function that takes a fn to call on the map entry before putting it in the map :)
10:38arkhk
10:39chouserslyrus: the whole entry? or each value?
10:39arkhAWizzArd: did you catch that?
10:39slyruschouser: [k v]
10:39chouser(into {} (map f m))
10:39slyrusbut, all of this is much nicer than (loop for x being the hash-keys of ...)
10:39slyrus:)
10:39LauJensenarkh: according to Google
10:39LauJensen"Who does not of three thousand years. To give further accountability, stay in
10:39LauJensenDark inexperienced, may live from day to day"
10:40slyrusor whatever the CL syntax for that is
10:40Chousukeslyrus: the CL loop macro is scary :P
10:40LauJensenarkh: And that matches how I read it (as a dane)
10:40chousercemerick: the #clojure power?
10:40cemerickindeed
10:40cemerick1. Gain op in #clojure.
10:40cemerick2. ???
10:40cemerick3. Profit!
10:40nachtalparkh: that's a strange sentence...
10:41LauJensennachtalp: probably something chouser wrote, americans love to show off their 'german' :)
10:41ChousukeI bet you could (loop through ideas in my head and select the best option)
10:41chousercemerick: ??? = fees to /join
10:41arkhLauJensen: I tried that too but was hoping for a better translation. Maybe there really isn't one
10:41LauJensenI think its quite accurate
10:41cemerickchouser: too draconian. Fees to get voice. Let the lurkers lurk. It's called "freemium"!
10:41chouserha!
10:41arkhnachtalp: page 278, JoC, author Johann Wolfgang von Goethe
10:42arkhLauJensen: sorry to confuse your dutch vs. german background, btw!
10:42LauJensenarkh: Dont be - You should be more sorry about confusing my Danish background with a dutch one
10:43mfexI too failed to understand the german quote in joc
10:43Chousuke:P
10:43nachtalparkh: ok, goethe, that explains why it sounds strange ;)
10:43arkhLauJensen: ... speaking to your language(s) background vs. your nationality :)
10:43LauJensen... makes no difference :)
10:44arkhLauJensen: oh :(
10:45arkhLauJensen: can I claim typical american ignorance for foreign issues? :)
10:45LauJensenSure
10:45arkhLauJensen: in all seriousness, I still with 'Danish'
10:45arkhs/still/stick
10:46LauJensenDanes are Danish and they speak Danish, People from Holland/Netherlands speak Dutch
10:46LauJensenAnd you guys owe us a lot of money. I think thats all you need to know about Europe
10:46arkhLauJensen: lol - thank you
10:46Scala_cemerick: Huh, surprising they don't have something readily-accessable like python/ruby where you install one thing and immediately can create/run/repl projects
10:47Scala_dnolen_: ^
10:47LauJensenScala_: Are you comfortable with Emacs and running a Linux system ?
10:47Scala_LauJensen: Personally vim, and yes
10:47cemerickScala_: not sure what you mean -- like scaffolding or something?
10:47LauJensenScala_: Okay, I dont think VimClojure is very easy to install, but the Emacs package is doable :)
10:48LauJensenAlso there is something called Clojure In A Box I think
10:48Scala_LauJensen: Ah, similar to lisp in a box?
10:48LauJensenYes
10:48cemerickScala_: FYI: http://www.assembla.com/wiki/show/clojure/Getting_Started
10:49Scala_cemerick: When you isntall python for example, you have access to an interpreter and a repl right off the bat, and you can essentially do everything you want to do (without outside packages) immediately
10:49cemerickScala_: not sure that's better than needing a single file and 'java -jar'ing it. *shrug*
10:50rrc7czScala_, LauJensen: Clojure Box does that. It was my first env. You literally run the installer and you're up and running, though it is Emacs so you might need to check up on key bindings
10:50LauJensenCool
10:50Scala_rrc7cz: Nifty, though emacs :'(
10:51Scala_cemerick: Maybe, but I've never used anything on the Java platform. I was hoping I could just "clojure helloworld.clj" and be ready to run
10:51rrc7czScala_: well, the easiest in the world would be: http://www.try-clojure.org/
10:51chouserA human translation of that Goethe quote: "He who cannot be farsighted / Nor three thousand years assay, / Inexperienced stays benighted
10:51chouser/Let him live from day to day"
10:52LauJensenrrc7cz: yea, though thats a little restricted and lacking a tutorial
10:52Scala_rrc7cz: That's neat, but you really can't do anything worthwhile there
10:52cemerickScala_: It's really a difference of just a few characters, or a shell script. cljr looks very promising in terms of upping the bar in a command-line setting. *shrug*
10:53cemericke.g. running a helloworld.clj file would be `java -cp clojure.jar helloworld.clj`
10:53LauJensenchouser: I dont think you can get a german speaking person to confirm that
10:53Scala_cemerick: That's all and good if you know how java works already
10:53dnolen_Scala_: this issue comes up again and again. It's known. Perhaps 1.3 will have a solution for every OS. But not today. Do you have Java installed?
10:53Scala_dnolen_: Yes.
10:54dnolen_Scala_: do you installing something via Ruby?
10:54dnolen_do you mind I mean.
10:54Scala_I should be clear though that I'm not having any issues getting clojure set up the 'normal' way, I was more just curious if there was strides being made (or made already) to getting all-in-one setups for people new to clojure
10:54chouserLauJensen: do you mean you think that transaltion I pasted is inaccurate?
10:55cemerickScala_: Clojure is a hosted language, so you'll have to be/become familiar with the host in question, whether that's the jvm or the CLR (js in the future and who knows what else).
10:55LauJensenchouser: Yes, I dont read it as such, I dont see the first sentence of yours in the german version at all
10:55dnolen_Scala_: cljr is pretty good. I 'sudo gem install cake', and I have a working setup immediately.
10:55LauJensenBut Im not german, so Im just saying I think you should speak with someone who is
10:55lightcatcheri'm new to clojure and functional languages in general, having some problems with a simple function i'm trying to write
10:55Scala_dnolen_: Nice. I'll give that a shot
10:56lightcatcherif someone could recommend a pastebin, i'll put it up, and it would be great if someone could help me
10:56Scala_dnolen: Funny that you can install clojure through a gem of all things though, hah
10:56Scala_I'd expect a deb or rpm :P
10:56jkkramerlightcatcher: a lot of people use gist.github.com
10:57cemerickjava libs are unfortunately not handled well by system package managers in general
10:57Chousukegist has good Clojure syntax highlighting
10:57lightcatcherthanks jkkramer, i didn't know of anywhere that has clojure hilighting
10:57chouserI'm not at all sure about "good", but it has some
10:57Chousukechouser: better than paste.lisp.org :P
10:57nachtalpLauJensen: i don't see the 'farsighted' part either
10:57chouser:-)
10:58lightcatcherhttp://gist.github.com/540490 is my snippet
10:58chouserlooks like that transaltion is trying hard to rhyme in English
10:58lightcatcherthe goal is defined pretty well in the docstring imo
10:59lightcatcherthe code is working to provide an int in proper range, but the if statement to prevent forbidden doesn't seem to be working
10:59nachtalpchouser: yeah :)
10:59chouserlightcatcher: looks like perhaps you've used or are learning from scheme
10:59Chousukelightcatcher: don't use def in functions. :)
10:59nachtalpchouser: but i'd say that the gist is the same in both the german version and the translation
10:59lightcatcherhow should i save the random value then?
10:59nachtalpchouser: at least as far as that's possible for poetry...
10:59Chousukelightcatcher: lightcatcher you'll need to use let
11:00Chousukeoops
11:00chousernachtalp: ok, thanks
11:00lightcatcherthanks Chousuke
11:00jkkramerlightcatcher: (let [rval ...] ...)
11:00Chousukelightcatcher: also use recur instead of calling the function recursively
11:00lightcatcheris the rest of the structure correct though?
11:00Chousukelightcatcher: so that it doesn't waste stack space
11:00lightcatcherChousuke, i also wanted to ask about that, it wasn't working when i did (recur lower upper forbid)
11:01Chousukeit should work just fine
11:01lightcatcherbut i need to look back at the docs for recur
11:01Chousukeyou're indenting a bit too much there btw.
11:01Chousuketwo spaces is the standard indentation :P
11:02Chousuke(except when aligning parameters)
11:05mrBlisshttp://gist.github.com/540504
11:05lightcatcherthanks again Chousuke, i'm used to 4 with python
11:06lightcatcherI completely forgot about the let statement. Functional programming is a bit of a paradigm shift
11:07Chousukelightcatcher: Lisp code tends to get deeply nested so two spaces is kind of necessary.
11:07Chousukeotherwise your code will be dominated by indentation :P
11:07lightcatcherI should probably read a style guide before i get into bad habits
11:08Chousukelightcatcher: There's no real Clojure style guide that I know of but a big chunk of this is applicable: http://mumble.net/~campbell/scheme/style.txt
11:09Chousukelightcatcher: http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards contains good advice too
11:09lightcatcherthanks
11:09lightcatcheri'm a notepad++ user (at least for just experimenting/learning), anyone know if there is a clojure plugin for that?
11:10lightcatchergoogle couldn't find me one :(
11:13LauJensenlightcatcher: never heard of one
11:13LauJensenlightcatcher: but fortunately, Emacs runs on Windows as well so you can use that
11:14lightcatcheri could, but i'd rather keep my editor
11:14LauJensenk
11:15lightcatcherthanks though. notepad++ will still hilight the pairs of parentheses, and that seems to be the only "must have" syntax highlighing i need at the moment
11:15LauJensenI suffered in notepad++ because I couldnt get the indenting to work right
11:29_fogus_Anyone know what happened to Jeffrey Straszheim? Haven't heard a peep in quite a while
11:32cemerick_fogus_: he works @ akamai I think. Last seen posting job ads?
11:32_fogus_So he's still involved with Clojure then?
11:34AWizzArdarkh: sorry no
11:35AWizzArdarkh: I will now scroll up and read what you wrote.
11:35cemerick_fogus_: AFAIK, yes
11:35_fogus_ok. Hopefully a flood of datalog changes are forthcoming now that 1.2 is out. :-)
11:38AWizzArdarkh: Hmm, that is german but is not exactly correct. One could translate it this way, and yeah, it looks very strange: "Who not from three thousand years. Oneself how to give account, stay in the dark, unexperienced, may live from day to day."
11:39chouserAWizzArd: is the first sentence perhaps just the second half of a correct sentence?
11:40AWizzArdchouser: I am not sure. This IS however the translation and probably matches the effect that I had when I read the german version. One understands the words, but some context and grammar is missing.
11:49dnolenrhickey: I'm curious. I know protocols are the new cool, but is there any interest in improving the performance of multimethods? I find that they're fantastic for coarse grained tasks, but being an more than an order of magnitude slower makes them less than ideal for certain things (even tho I would prefer to use them)
11:49dnolenslower than regular fns I mean
11:52ChousukeDo you have an idea for an improvement?
11:53dnolenChousuke: not immediately, but I was perusing the Chambers/Chen predicate dispatch stuff, and was curious if baking that in more directly could improve performance
11:54dnolenChousuke: reading over those papers also seems like predicate dispatch gives some of the guarantees people like about type systems.
11:55mattreplmaybe squashing all methods defined at compile time into a single function with conditional branches for implementations
11:56mattreplmaybe that's already done, I'm not familiar with the current impl
11:57dnolenmattrepl: there's a dispatch table of values that are matched against
11:58mattreplyes, so removing that lookup and have a sequence of conditional branches with the corresponding method implementation inlined in the branches
11:58mattreplno map lookup, no extra function invocation
11:59AWizzArdThough I am sceptical that it can gain a significant amount of extra performance.
12:00arkhAWizzArd: I know very little german but it still seemed odd to me, too.
12:00AWizzArdarkh: then you already have a good feeling/pattern matching for german texts.
12:01mfexdnolen: what kind of usages do you have for multimethods? what do you dispatch on?
12:01arkhAWizzArd: well, the first sentence is obviously only a sentence fragment. But then the rest ... I don't know. I probably don't know enough to comment :)
12:02mfexarkh, AWizzArd: I think there should be no period after jahren so the first two sentences are combined and there is no sz-as-B in my JoC version
12:03AWizzArdBtw, some german users in here might be interested that there is also a #Clojure.de channel, and a german google group.
12:04dnolenmfex: multimethods let you dispatch on things other than just type.
12:05dnolenmfex: they are also "open" other people can easily provide new dispatch possibilities.
12:05dnolenmfex: one problem I find tho is that the dispatch function is hard coded, that isn't open.
12:06mfexdnolen: yes, I was wondering what kind of dispatch function, ie a vector of keywords as a result may perhaps allow for a quicker lookup scheme for the lookup table
12:06AWizzArdThat seems to be more flexible that multimethods and will also typically be much more terse.
12:08mfexdnolen: when you need the openess of multimethods, a specialized lookup table will require the possibility of new lookup paths, a simple table allows for this but is not as optimized/quick as you would like?
12:10dnolenAWizzard: rhickey has said he doesn't like pattern matching because it is also closed and forces an ordering (?)
12:10AWizzArdYes, I know. Though the defpattern form could install its patterns and their respective body globally.
12:11AWizzArdOne could add pattern/body at runtime, or remove some.
12:12dnolenmfex: well I only have the current implementation to compare. To be honest it's plenty fast for things like modeling the usual DB record in a web application. But it would be nice if we could get you know with 2X of regular fns instead of >10X
12:18mfexdnolen: do you use multimethods with hierarchies/isa/derive?
12:18dnolenmfex: yes
12:19dnolenI suppose rchickey's interest in datalog could improve the perf of dispatching? avoid fn calls altogether and just using rules?
12:20LicenserI has the impression clojure 1.2 was supposed to be non breaking the old contrib libs did that change again?
12:54slyrusthis feels ... wrong: (defn replace-val [m old new] (reduce (fn [m [k v]] (if (= v old) (assoc m k new) (assoc m k v))) m m))
12:55slyruswell, I can get rid of the second assoc, but still..
12:57slyrusand with that bit of hackery I can properly compute the tetrahedral orientations of the neighbors of a chiral atom with a ring opening. yay.
12:59rhudsonslyrus: how is that different from (replace {old new} m) ?
13:01slyrus,(replace {'foo 'bar} {1 'foo 2 'moose})
13:01clojurebot([1 foo] [2 moose])
13:01slyrusI want {1 'bar 2 'moose}
13:01rhudsonah
13:10mebaran151I'm having trouble getting deftype definitions to reload in the repl. I'm trying to use the swank.core/break debugger, which is pretty convenient, but I can't seem to change type definitions in the repl
13:11tomojslyrus: what's wrong about it?
13:11slyrustomoj: it just feels a little dirty that's all... but I think it's ok.
13:11tomojis something like (defn replace-val [m old new] (into {} (for [[k v] m] (if (= v old) [k new] [k v])))) also dirty?
13:11mebaran151the methods stay with their original forms
13:11slyrusmore so :)
13:12rhudsonor (defn replace-val [m old new] (let [[ks vs] ((juxt keys values) m)] (zipmap ks (replace {old new} vs)))
13:13BahmanHi all!
13:17mebaran151any links about classloading issues and deftype that might be able to shine some light on my situation
13:19tomojI wish I better understood elegance
13:32chousertomoj: what an interesting thing to say!
13:34psykoticthe word doesn't mean anything objective. something so elusive cannot be understood. i once heard someone refer to axion (an rdbms written in java) as the most elegant program he'd seen.
13:36tomojI don't wish I had a program that would accept a program as input and output its elegance
13:36psykotichehe
13:37tomojmaybe s/understood/grok/
13:37tomojer, grokked
13:39psykoticone problem with common notions of elegance is that it is so constraining that no useful program can be elegantly written.
13:39psykoticso, if you make that your standard of excellence, you are making it harder for yourself to write useful programs.
13:39psykoticmost useful programs solve messy problems, in other words.
13:40technomancydid slurp* get renamed in clojure.java.io?
13:41technomancyI hope it didn't get dropped just because it had a bad name; it's really useful
13:48bpsmstuartsierra: clojure contrib: 4e5d98a broke the repl-utils build.
13:49bpsmfixed here: http://github.com/bpsm/clojure-contrib/commit/11ab6908882684e980640cfde0eb47efe3a8bd33
13:49stuartsierrabpsm: I reverted that, it broke too many things
13:50bpsmstuartsierra: ok. gotcha.
13:54technomancystuartsierra: I've got a couple ideas for clojure.test in 1.3
13:55stuartsierraclojure.test is dead, long live Lazytest
13:55technomancy0) have the testing macro print the string it's given when the tests are run based on a var
13:55technomancyuh dude...
13:55technomancyit has hundreds of users, and these are trivial additions
13:55stuartsierraI know, I'm kidding
13:55technomancygotcha
13:56technomancyI'm just a bit bummed out how long trivial additions can linger in the issue tracker =\
13:56stuartsierraStu H. has been working really hard on that
13:56technomancyadding more committers hasn't seemed to fix the problem, but I'm hoping that's just due to the feature freeze
13:56technomancyright-o
13:56stuartsierrathere actually are still only 3 committers to Clojure
13:57technomancyoh, still?
13:57technomancy=\
13:57stuartsierracontrib has more, but clojure.test isn't in contrib any more
13:59stuartsierrabut there are improvements to be made in clojure.test for sure
13:59technomancyI also monkeypatched it to spit out dots for each passing "is", which is nice for longer suites so you can tell that progress is happening
14:00technomancywould be nice to be able to do that without monkeying
14:00technomancyI meant to ask you before implementing and submitting them as patches, but I guess you still don't have any control or say in what goes in. =\
14:01stuartsierraI have a say, but no direct control
14:01stuartsierrapatches have to go through the mailing list and Assembla, like everything else
14:02technomancyof course
14:03technomancyI'd like to think patches that the original author of the lib thinks are a good idea could be fast-tracked.
14:04stuartsierrasomewhat
14:07stuartsierraproblem is, so many people have monkeypatched 'report' for different purposes that it can't change without breaking them
14:08technomancyyeah, I need to find a better way to do that.
14:09mebaran151is it possible to C-c C-k new method definitions with deftype
14:09tomojyeah
14:09mebaran151currently, I can't seem to edit my definitions, replace them etc.
14:11tomojhmm
14:11hiredmanchouser: how does most of syntax-quote live in clojure.core?
14:11hiredmanlast I checked it had a huge gnarly section in LispReader
14:12mebaran151my deftypes can only reflect the first definition
14:12mebaran151despite compiling and reloading
14:12mebaran151if it helps, I just tried moving to Clojure 1.2.0 final
14:14tomojmebaran151: are you AOT compiling?
14:14KirinDaveWow.
14:14KirinDaveI learned something valuable today.
14:14KirinDaveIf you are a lisper, you cannot work in banking. QED.
14:14KirinDaveLisp, I'm told, treats negative numbers as s-expressions.
14:14mebaran151tomoj, I'm just using swank server
14:14tomojhmm.. I only see that behavior when AOT compiling
14:15mfexKirinDave: lol
14:15KirinDaveYou may require proof: http://news.ycombinator.com/item?id=1619516
14:15mebaran151wrote a new file, trying to ctrl-c ctrl-k it
14:15KirinDaveThis is gonna be another one of those high profile gigs.
14:15stuartsierramebaran151: if you've AOT-compiled the file containing the deftype, the compiled version may take precedence
14:16mebaran151how would I know that?
14:16mebaran151should I try a lein clean I see if I avoid it?
14:16tomojlook in classes/ for YourType.class
14:18mebaran151hmmm
14:18mebaran151a lein clean seemed to fix it
14:18_fogus_"Persistence ... completely breaks when you leave the machine you’re running on."
14:18_fogus_Interesting perspective
14:18_fogus_:p
14:19mebaran151so everytime I kill swank, I have lein clean, or else deftype will just silently reuse the old class files, think they were statically compiled on purpose?
14:20mebaran151hmmm, seems to be working now
14:21mebaran151I should always clean before I go nuts
14:21tomojweird
14:21tomojI only get class files when aot compiling
14:21mebaran151oh I don't have classes now
14:21mebaran151maybe I ran a lein compile and forgot about it
14:25mebaran151oh this is interesting
14:25mebaran151I think deftype must make new class names under the hood on recompile or something, because the interface's changes are not propogated once I include my Java RPC library
14:26mebaran151(it takes the instance as an argument)
14:27mebaran151there must be some magic caching going on...
14:27stuartsierraonly AOT-compiled deftypes give you stable class names for Java interop
14:28mebaran151oh I see, that's good to know
14:28mebaran151it's a nice design for an RPC library, but a bad fit for clojure
14:29mebaran151essentially, you can pass the RPC Server an object, and it will use reflection to match up the methods
14:29mebaran151would be very easy to use in Java, but it's a little trickier from clojure
14:29chouserstuartsierra: I don't think that's true anymore
14:30chouserI think clojure now uses classloader trickery to create new classes with the same name when you redefine a type or record
14:31chouserbut it is actually a different class, so existing instances will remain instances of the old class
14:31stuartsierraoh ok
14:36mebaran151classloader stuff always makes my head spin; it feels like it shouldn't be that hard
14:38kensho_fogus_: are you referring to http://beust.com/weblog/2010/08/19/clojure-concurrency-and-silver-bullets/#comment-8475? That guy's either mind-boggling stupid or a troll imo. The blog post is pretty dumb as well imo. I would've expected better from the TestNG developer.
14:39_fogus_kensho: I'm sure there was something that the poster was trying to say, but I think he worded it poorly. The post itself is what it is -- Beust doesn't find locking difficult. That's great!
14:40kensho_fogus_: hehe. good for him
14:40ryanfI think I am misunderstanding reduce somehow. why doesn't this work? http://pastebin.com/sh9GFGVF
14:40technomancy"guys, it's not that hard. you just have to be awesome. like me."
14:41_fogus_technomancy: Something to strive for
14:42arkhis the best way to have optional, named arguments in a function to provide them with default values (zero?) and then test the value in the body of the function or is there a better way?
14:45tomoj-> ((fn [x y & {:keys [a b c] :or {b 5}}] [x y a b c]) 1 2 :c 3)
14:45sexpbot=> [1 2 nil 5 3]
14:45tomojdoes that help? didn't really understand the question
14:49ryanf(#(+ (Character/getNumericValue %1) %2) \7 1)
14:49ryanfwhoops wrong window
14:50ryanffor real though, does anyone know why (reduce #(+ (Character/getNumericValue %1) %2) 0 "1234") givse a cast error?
14:50ryanfisn't it supposed to start with 0 as the accumulator?
14:50ryanf*gives
14:50mebaran151arkh, do you mean named as in key value style arguments, or named arguments by position?
14:50chouserryanf: you just got your args swapped
14:51chouser,(reduce #(+ (Character/getNumericValue %2) %1) 0 "1234")
14:51clojurebot10
14:51ryanfshiiiit
14:51ryanfI was thinking it could be that a minute ago, but I thought it said the second arg was the accumulator
14:51ryanfthanks
14:52arkhtomoj: that's a good example of default values when arguments are not supplied, but I think I found the answer to my own question with just writing different implementations based on arity ... or something
14:53arkhmebaran151: key value style arguments with some of the keys being optional
14:56tomojI don't understand how your question is different
14:57tomojkv args are optional using map destructuring
14:57tomojyou mean that some of the kv args should be required?
14:59arkhtomoj: for the function I want to write most arguments (keys, in this case) are required but a couple aren't. Any recommendations? Sorry if my phrasing has been unclear.
15:01arkhI guess I should be saying "function parameters"; I don't see "arguments" used in clojure function terminology so far
15:03hiredmanargument and parameter have specific formal meanings which I always get reversed
15:03tomojwikipedia seems to suggest that the parameter is the variable, the argument the value
15:03hiredmanone is the value passed to a function and the other is more or less the name the value gets bound to
15:03hiredman"variable"
15:03hiredmanpah
15:04arkh"symbol" ;)
15:04arkher .. maybe not
15:04technomancyparameter has more to do with definition, argument has to do with the function actually running
15:05technomancybeing/becoming, etc
15:05tomojarkh: I can't think of any good way at all to require some kv args
15:06arkhtomoj: yeah, that's the thing - function dispatch can happen based on arity and multimethods can be dispatched based on type, but I can't see a way to require some key/value params and make others optional
15:06tomojthe way is to check in the function, I guess, but I didn't consider that "good" :)
15:06technomancy"bless me, it's all in Plato. what ever do they teach in schools these days?"</lewis>
15:07mebaran151I've become addicted to use the slime feature where it shows the function arguments in the bottom (minor?) bar. Is there anyway to extend this to tell me the functions for a Java constructor?
15:07tomojtechnomancy: heh, I assumed david lewis and was confused
15:09arkhtomoj: I don't think I'd normally need to write a function like that but it's for some java interop
15:12mebaran151arkh: is there anything wrong with just mergining in a hash-map of defaults?
15:15arkhmebaran151: I can do that - I wanted to make sure there wasn't a better way, though. Having a default value be special (even if it's nil) seems more cumbersome than what clojure could (should?) offer
15:16arkhwith clojure, when I find I'm writing something inelegant, I've usually been able to discover it's a lack of understanding on my part ;)
15:27rhudsonBasically you want to check that the set of required keys is a subset of the set of supplied keys
15:28kiemdoderwhat is the difference between "if" and "cond"?
15:30tomojoh, so maybe :as will help?
15:31tomojyeah, with :as you could check the keys and not have any magic values
15:32mefestokiemdoder: "if" has a form for the true condition and optional a form for the false. cond lets you perform any number of conditional tests
15:32mefesto"if" ... and an optional form for the false condition... is what i meant to say :)
15:33tomoj-> ((fn [x y & {:keys [a b c] :or {a 5} :as m}] (if (every? (set (keys m)) [:b :c]) [x y a b c m] "error")) 1 2 :c 3)
15:33sexpbot=> "error"
15:33tomoj-> ((fn [x y & {:keys [a b c] :or {a 5} :as m}] (if (every? (set (keys m)) [:b :c]) [x y a b c m] "error")) 1 2 :c 3 :b 6)
15:33sexpbot=> [1 2 5 6 3 {:c 3, :b 6}]
15:34Raynessexpbot is so adorable when he doesn't break. <3
15:36arkhrhudson: nice
15:38arkhthat wants to be a macro
15:39rhudsonyeah, I can't offhand think of a one-liner to do it
15:43kiemdodermefesto: what do you mean by "any number of conditional tests" for cond? Is it like "if cond1 and cond2 and cond3:" in python for instance?
15:43_fogus_,((fn [x y & {:keys [a b c] :or {a 5} :as m}] {:pre [(:b m) (:c m)]} [x y a b c m]) 1 2 :c 3)
15:43clojurebotjava.lang.AssertionError: Assert failed: (:b m)
15:43_fogus_arkh: ^^^
15:43arkh_fous_: is that a precondition?
15:44_fogus_yes
15:44Rayneskiemdoder: It's like a series of ifs, where each else is a new if.
15:44arkhsweet
15:44Raynes(cond (= 1 2) false (= 2 2) true) is like (if (= 1 2) false (if (= 2 2) true))
15:47arkh_fogus_: clojure elegance achieved. I love how a person knows they're going in the right direction with clojure if it's intuitively appealing
15:47kiemdoderthanks, Raynes
15:48kiemdoderand Mefesto
15:49holowaysometimes it seems like when I use for(), it winds up being executed in parallel - is that normal behavior? if it is, how can I get it to be in order?
15:49hiredman~for
15:49clojurebotfor is not used often enough.
15:49hiredman~for
15:49clojurebotfor is not a loop
15:51BrianForester,(map #(map (memfn toUpperCase) %) '(("and" "than" "day") ("plan" "minus" "divide"))))
15:51clojurebot(("AND" "THAN" "DAY") ("PLAN" "MINUS" "DIVIDE"))
15:52arkhholoway: for's comprehension is serial, in order "from right to left"
15:55BrianForesterraynes: what is the better option? looking for feedback here.
15:55arkh,(for [third [5] second (range 2) first (range 3)] (str third \. second \. first))
15:55clojurebot("5.0.0" "5.0.1" "5.0.2" "5.1.0" "5.1.1" "5.1.2")
15:58Raynes-> (map (fn [x] (map #(.toUpperCase %) x)) '(("and" "than" "day") ("plan" "minus" "divide")))
15:58sexpbot=> (("AND" "THAN" "DAY") ("PLAN" "MINUS" "DIVIDE"))
15:58RaynesBrianForester: ^
15:58RaynesUse an anonymous function instead. memfn was deprecated.
15:59RaynesBrianForester: Sorry about that. I didn't realize you were looking for feedback! :)
15:59wwmorgansince when has memfn been deprecated?
16:00BrianForesterraynes: thanks. ...is there a clojure opt to warn about deprecated functions?
16:01Rayneswwmorgan: memfn was before #(). It's been deprecated for quite a while.
16:02RaynesBrianForester: You shouldn't have to worry about that much. There aren't many deprecated functions to step on.
16:02RaynesBut I don't think there is an option for that in any case.
16:02BrianForesterraynes: K
16:02kiemdoderif I have a map m with that contains a key :a, (:a m) and (m :a) both give the the value at :a
16:02rhudsonright
16:02RaynesHowever, if something is deprecated, it'll have :deprecated true in it's metadata map.
16:02kiemdoderare these two forms equivalent?
16:03rhudsonA map is also defined to be a function of its keys
16:04RaynesKeywords are functions that look themselves up in a map, and maps are functions that look up whatever you pass it as a key inside itself.
16:04rhudsonYou should probably prefer the (:a m) form, if it's at all likely that you want to eventually have a record type for the map
16:04RaynesYou can't do ("a" m), for example, and expect the value at the key "a" in the map to be returned.
16:04_fogus_,(for [m '(("and" "than" "day") ("plan" "minus" "divide"))] (map #(.toUpperCase %) m))
16:04clojurebot(("AND" "THAN" "DAY") ("PLAN" "MINUS" "DIVIDE"))
16:14fusss"bordeaux-threads-test is broken because it uses FiveAM which depends on Arnesi which is broken on ABCL because the long form of DEFINE-METHOD-COMBINATION is not implemented" :-D
16:14fusssthat should be the easiest fix to bring ~5 packages to abcl
16:14fussssorry, wrong channel
16:14fussssheesh
16:15fussshey _fogus_ ; my HN buddy
16:16fusssactually, i am here to pick people's brains over java SSL libs and their proximity to OpenSSL. is it straightforward to wrap javax.net.SSL to give it a trivial libssl like interface, or am I in for a lot of pain?
16:17dmiles_afklol fusss, i kept trying to flip between #abcl and #lisp to find what you saird.. and it was in #clojure :)
16:18fusssyeah, painfully embarrassing there
16:21fusssdmiles_afk: i routinely find myself reading an Elisp manual by accident, thinking it was the hyperspec. GNU content is very google friendly, and often formatted in various ways, some resembling cltl
16:23dmiles_afkineed
16:23dmiles_afkmy Secondlife bots are scripted in DotLisp (aka Clojure) .. though i been creating smoothing libraries in ABCL.. using jcall/jstatic/jfield
16:24dmiles_afkbecasue clojres syntax for calling java is more elgant than allegros (that ABCL copied)
16:25fusssdmiles_afk: Hickey wrote a nice CL wrapper for interacting with java
16:25dmiles_afk*nod*
16:26dmiles_afkoh i wonder.. does ClojureCLR call events>
16:26dmiles_afkoh i wonder.. can ClojureCLR call events?
16:30dmiles_afkineed/indeed
16:55edbondany clutch users?
16:56edbondis it possible to emit several docs from :map function? clojure view server
17:40scottjIs there a builtin for renaming keys in a map?
17:41puredangerI need something that takes a function and a seq and returns N partitions of the seq based on the result of applying the function. does this exist?
17:41raekscottj: clojure.set/rename-keys
17:42raekoddly enough in clojure.set...
17:43scottjpuredanger: group-by?
17:43scottjraek: thanks, that's the name I gave the version I wrote! :)
17:43puredangerthat might work. returns a map but I can work with that probably
17:44puredangerscottj: many thanks...
17:44puredangerI'm hoping that the rate with which I learn the functions in core is greater than the rate at which they are being added :)
17:44scottjpuredanger: there might be something closer in seq_utils
17:46wwmorganpuredanger: partition-by will do what you want, if all the elements you want grouped together are contiguous
17:47puredangerwwmorgan: yeah, that occurred to me, but they're not (and can't be without applying the function)
17:48puredangerscottj: I think group-by + map destructuring on the result works
17:48wwmorganpuredanger: what about calling vals on the output of group-by?
17:49puredangerwwmorgan: I need to know which group is which I think
17:51wwmorganpuredanger: I see. something like (my-partition #(mod % 3) [1 2 3 4 5]) returns ((3) (1 4) (2 5))?
17:52puredangerwwmorgan: I think group-by is what I want
17:53wwmorganOK
17:55scottjAnyone using camelCase keys in their clojure and nosql just so they convert easily to javascript? I'm wondering if I should make that switch so the keys are all the same.
17:56fusssscottj: the lispy way is to use strings
17:57fussssymbols shouldn't be camel-cased, even if your lisp-reader allows it
17:57hiredmanfusss: what would you know about it?
17:58fussshiredman: just project cl/scheme experience unto clj. camel case symbols are hardly used; even in SOAP and XML
17:59kenshofusss: Is there another reason except that it's not "lispy"? I prefer camelCase and I don't care if it's lispy or not.
17:59patrickdloganfusss: yeah, scheme is case-insensitive and common lisp is kind of on the fence - case-sensitive but the reader may convert case for you.
17:59fussskensho: sniff around clojure-contrib and see how they do things
18:00patrickdloganbut I am not sure what is "lispy" about this.
18:00patrickdloganthat's the kind of cruft that (some) people have wanted to clean up.
18:00kenshofusss: that's no really a reason. If everyone jumps off a bridge you do it too?
18:01arkhconvention and consistency help readability (for yourself and others), fwiw
18:01fusssno, avoiding camelCase also helps your development tools. what if SLIME is case agnostic? would you suffer?
18:01patrickdloganhaving said that I would not recommend having a lot of symbols differing only by case, but I don't want the reader to convert the case I choose in any situation.
18:02kenshofusss: i don't use slime and don't plan to
18:02dmiles_afki am using IKVM so i run into alot of case importance since my objects have both ToString() and toString()
18:03patrickdlogandmiles_afk: oh dear.
18:04kenshoI'm all for consistency but I think it goes too far if the language dictates arbitrary naming conventions
18:06fusssthe language doesn't dictate anything, that's why we're talking about it :-)
18:08kenshoI'm just saying, just because contrib uses a specific style doesn't mean I have to follow it does it? If I'm contributing to contrib I will certainly use that style but for my own code I want to use what I like best.
18:10fusssmaverick
18:11technomancyfacepalm
18:14slyrus"if we're gonna have uniforms, maybe we should all get something different!"
18:44mebaran151is there a way to get all the function on a given type?
18:47polypusis the moderation lag on the google groups clojure mailing list really long? i've posted two messages today and they don't seem to have shown up.
18:47scottjmebaran151: how if it's dynamically typed?
18:47hiredmanpolypus: usually it's long for your first post
18:47polypushiredman: k. ty
18:48polypusanybody using the new lein shell script feature yet? i can't get it to work properly
18:50technomancypolypus: custom script or default?
18:50technomancypolypus: for the default, look at swank-clojure for an example
18:51polypuscustom
18:51mebaran151scottj: I mean a given deftype
18:51polypusi have :shell-wrapper { :bin "resources/bin/caj" } in project, and it's being copied over to ~/.lein/bin, but %s is not being overwritten
18:51polypuson a lein install
18:52technomancypolypus: shouldn't need resources/; it should be classpath-relative
18:52technomancy%s-interpolation should be happening at jar-time actually
18:52technomancypolypus: little busy now; if you get stuck could you post an example to the lein mailing list?
18:54polypustechnomancy: ok, ty. i posted to the clojure google group but i guess the moderators are taking their time. i'll look for the lein list
18:58scottjmebaran151: oh :) sorry I haven't used 1.2 features don't know
19:31polypustechnomancy: ok, i did a few experiments with a new lein project and still no luck. either that or i'm just not getting something. i posted about it to the lein mailing list just now.
20:21rlbDoes defn- even hide the def from code after an (in-ns ...)?
20:30woobyrlb: no
20:58rlbwooby: hmm, then I'm wondering what's happening -- with 1.2, (use 'clojure.java.shell) (in-ns 'clojure.java.shell) (prn as-env-string) fails, but at least in master, as-env-shell is in shell.clj.
20:59woobystrange
21:00woobycan you #'clojure.java.shell/as-env-string from some other ns and see it?
21:01rlb(Oh, and this is with the 1.2 zip.)
21:02wooby@#'clojure.java.shell/as-env-string rather
21:02rlbFails -- can't find it.
21:02rlbBut sh is fine.
21:03rlbIs there any chance the 1.2 version doesn't have it, but master does?
21:03woobyquite possible
21:03rlbI couldn't find a 1.2 branch or a 1.2 tag in the current repo.
21:03woobyrlb: http://github.com/clojure/clojure/tree/1.2.0
21:04woobyrlb: http://github.com/clojure/clojure/blob/1.2.0/src/clj/clojure/java/shell.clj#L52 maybe?
21:05incandenzaisn't it as-env-strings ?
21:05rlbAhh, I had git://github.com/richhickey/clojure.git
21:06rlbincandenza: looks like it in 1.2, but not in (richhickey's) mater.
21:06rlbthat was the problem
21:06rlbthanks
22:02slyrushmm... a couple things I miss from CL-land: 1) arrays of, say, (unsigned-byte 2) and 2) flexichain
22:02slyrusI'm sure there must be a nice flexichain-like java package around. anything in clojure?
22:02rlbIs it possible to use apply with a method?
22:02chouserrlb: no
22:02rlbnm
22:03rlbOK -- just wanted to call Runtime exec with 1, 2, or 3 args, depending. I can always use cond.
22:03pdkjava primitives are never unsigned
22:03pdkyou can still do stuff like int-array byte-array etc for all the java primitive types
22:26slyruseven though they're mutable, I'd like to see more CL-style array support in clojure
22:27rhudsonwhy?
22:27clojurebotwhy not?
22:27chouserclojure supports java arrays. what's missing?
22:28slyruschouser: well, for one thing, not having to use the interop syntax and, for another, support for types besides ints and bytes
22:29hiredmanuh
22:29hiredman,(doc char-array)
22:29clojurebot"([size-or-seq] [size init-val-or-seq]); Creates an array of chars"
22:30hiredman,(into-array [[1 2] [3 4]])
22:30clojurebot#<PersistentVector[] [Lclojure.lang.PersistentVector;@1d66cb3>
22:30chouser,(let [a (to-array [1 "foo" (Object.)])] (aset a 1 "bar") (seq a))
22:30clojurebot(1 "bar" #<Object java.lang.Object@12f035c>)
22:30hiredman,(aget (into-array [[1 2] [3 4]]) 0)
22:30clojurebot[1 2]
22:30hiredmanyou are obviously making things up
22:30slyrusor just wrong, but yeah
22:33dcooper8Hi, is nobody doing a Clojure presentation or paper at ILC 2010 in Reno?
23:02hiredmandcooper8: clojure conj calls
23:03dcooper8 ok good.
23:04hiredmanI mean clojure-conj is the 22nd and 23rd of october I believe, so most clojure people will be attending that
23:11dcooper8ah, pity.
23:11dcooper8the ILC is trying to get more inclusive for all Lisps, not just Common Lisp
23:11dcooper8so they were hoping for at least one or two clojure papers
23:12dcooper8but i guess the other lisps are not of much interest to clojure people
23:12hiredmanthis the first clojure-conj though
23:13hiredmanI would be interested in going to ILC, but I am already going to clojure-conj for work
23:14hiredman(and, I can't lie, I want to go)
23:14dcooper8well please spread the word around, if anyone can submit a Clojure paper for ILC, the deadline is coming up...
23:15dcooper8i'm personally trying to urge the ALU/ILC to live more up to its name and truly include all Lisps instead of being a thinly-veiled Common Lisp old-boy club
23:15ninjuddis clojars down?
23:15dcooper8in the meantime I think CL needs its own specific foundation and meetings
23:15rhudsondcooper8: you might want to post something to the mailing list
23:16dcooper8the google group?
23:16rhudsonthat's what I meant
23:16dcooper8i'll ask Daniel Herring to do it, he's the publicity manager for ILC,
23:17dcooper8i'll be surprised if he hasn't already done it...
23:17hiredmanthe was at least one ilc email
23:17rhudsonhaven't noticed it, if he has
23:35bortrebHow do I get a thread running off in it's own little world to print back to the main repl printWriter? I tried (let [temp *out*] (.start (Thread. (fn [] (do (set! *out* temp) (println "hi")))))) but that didn't work :(
23:37pdk(doc println)
23:37clojurebot"([& more]); Same as print followed by (newline)"
23:37pdkhmm
23:39rhudsonbortreb: (.start (Thread. #(println "hi"))) works for me
23:40bortrebfor me it prints to the terminal where I started swank
23:40rhudsonmine was in a cljr repl
23:43ninjudd(let [temp *out*] (.start (Thread. (fn [] (binding [*out* temp] (println "hi"))))))
23:43ninjuddhe's gone
23:44ninjuddrhudson: it works in cljr because there is only one repl thread
23:44ihodesdoes anyone know the reason why some function args in the clojure source start with & - eg &forms (not [& forms], [&forms])
23:45ninjuddihodes: it means all subsequent args
23:45hiredman&env and maybe &form are special things passed into macros
23:45hiredmanninjudd: he's not talking about vargs
23:46ihodesah, i see. so when we're defining defmacro, those are args passed to the function defmacro is being assigned. what's going on there
23:46hiredmandefmacro hides them, but before defmacro is def'ed in core.clj macros created manualing have to deal with the
23:46hiredmanthem
23:47hiredmanhttp://github.com/Seajure/serializable-fn has an example usage
23:47ninjuddhiredman: right, i misread the question
23:48ihodeschecking it out, thanks :)
23:52phaerHow can i convert a record to a map?