#clojure logs

2010-11-10

00:14Deranderwhen I'm working in slime and hit c-d d I get a documentation buffer in the other window in my frame
00:15Deranderis there a simple way to close that?
00:15amalloyDerander: C-x 4 0
00:15amalloyor do you want the old window back?
00:16amalloyif so, C-x 4 C-o <RET> should work
00:35Deranderamalloy: thank you
00:35DeranderI ended up just writing a macro to flip over and hit "q'
00:35Derander"q"*
00:35amalloylol
01:17uberjarjust for the record I predicted this Oracle JVM monetization strategy in this channel 3 months ago and at least 5 of you laughted at me, taunted me, and told me it could never happen :)
01:19uberjarthats all, just had to rub it in :P l8rz
01:20RaynesCool story, broy.
01:23coldheadahahah
01:25Adamanthe got his victory dance and didn't get to hear the rebuttal
01:25AdamantI think this means he wins
01:26Adamantone internet.
01:40coldheadi'll PM him the rebuttal
02:01hiredmanping?
02:01clojurebotPONG!
02:03LauJensenThe boat is rocking: https://blogs.apache.org/foundation/entry/statement_by_the_asf_board1
02:06defnanyone have stuart halloway's slides from clojure-conj? day 2?
02:21ppppaulboat is going to sink
02:22rdsrdefn: are these what u are looking for? https://github.com/stuarthalloway/clojure-presentations
02:24ppppaulis the lambda shorthand only for non-nested shorthand functions?
02:25rdsroh they don't contain the clojure-java interop slides
02:25rdsrif u want I can mail u that one
02:25amalloyppppaul: yes, #() doesn't nest
02:25amalloybecause how would the compiler know which % is associated with which closure?
02:26ppppaulname them?
02:26ppppaul%1
02:26ppppaul%2
02:26ppppauli dono
02:26RaynesThose aren't names.
02:26amalloyppppaul: that syntax already means something
02:26ppppaulhehe
02:26ppppauloh
02:26ppppauli want to do something like the below
02:26ppppaul(every? #((map #(= % ) (integer? '* '/ '+ '-))) (flatten (read-string string)))
02:27ppppaulchecking that everything in a list is an int or a math symbol
02:27ppppaulwait, that's wrong
02:27ppppaullol
02:27amalloyppppaul: that code kinda makes no sense
02:27ppppauli don't need map, i need any?
02:27amalloyyou need some
02:28ppppaulbut i need to use fn [] format
02:28ppppauli guess
02:29amalloy&(every? #(some '#{+ - * /} %) '[+ -])
02:29sexpbotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
02:29amalloy&(every? #(some #{'+ '- '* '/} %) '[+ -])
02:29sexpbotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
02:29amalloybah, what
02:29amalloyanyway ppppaul it's pretty common to use sets as predicates for things like this
02:30ppppaulyeah, i'm looking at the some docs
02:31ppppaulmakes sense, but is it for performance?
02:31LauJensen&(every? #{'+ '- '* '/} ['+ '-])
02:31sexpbot⟹ true
02:31LauJensen&(every? #{'+ '- '* '/} ['+ '- 'b])
02:31sexpbot⟹ false
02:32LauJensenamalloy: I think I use sets in a few posts on bestinclass.dk :)
02:33amalloyLauJensen: maybe i'll read your blog so i understand how this language feature works :)
02:34LauJensenWee, I finally got my last subscriber, I can retire as a blogger now
02:35ppppaullol
02:35jarturHi.
02:36amalloyLauJensen: time to move on to twitter
02:36LauJensenOh, you're not following me on Twitter either?
02:36LauJensenYou missed the ClojureQL aggregate syntax poll :(
02:36LauJensen(technically its not over yet)
02:36jarturDoes anybody have an idea how to keep a persisten SQL connection?
02:36LauJensenhttp://twitter.com/laujensen
02:36jarturI need to poll some db value every second
02:36LauJensenjartur: Yea, the trick is to not close it
02:36LauJensen:]
02:37jarturLauJensen: with standard contrib.sql it's not that simple, aye?
02:37LauJensenjartur: No its not. Wait a little while and ClojureQL will be out in 1.0 - I have seriously considered making a connection pool
02:37jarturI can of course put an endless loop within (with-connection ...)
02:38LauJensenjartur: But I guess if you need something now, you could simple override with-connection in contrib.sql.internal
02:40LauJensenI always write 'simple' when I meant 'simply' - I should make an emacs hook to catch that :(
02:40amalloyLauJensen: that should be pretty simply
02:41LauJensenhaha, punk
02:41jarturHmm, I don't really see how overriding with-connection could help. Do you mean make it not to close a connection after its scope ends?
02:42Chousukefind the var that clojure.sql binds the connection to and then just use that manually?
02:42LauJensenYep. Or just to check if it gets a map or a java.sql.Connection. If its the latter dont close. Something like that
02:42LauJensenIt binds *db* IIRC
02:43jarturI really do not like how contrib.sql works now, btw =)
02:43hiredmanif only there was something that looked like a loop but really yielded a succession of async tasks with depend on the result of the previous task...
02:44LauJensenjartur: Like I said, CQL is just around the corner now
02:44jarturOr maybe just use pure java interop for my pretty simple task for now
02:44LauJensenCheck out the github page to see how much is already working
02:44jarturI only need to write to one db and immediately check value from its slave. And do this every second.
02:45jarturActually, multiple slaves. And serve delays as a graph on web
02:48ppppaulgah, i feel like i just want to convert my list to a string and then use regex on it
02:50ppppaul&(str '(+ 2 3 4))
02:50sexpbot⟹ "(+ 2 3 4)"
02:50ppppaulthat's good enough for me
02:52ppppaul(re-match #"^\([\d+-*/]+\)" (str (flatten (read-string string)))
02:52ppppaul:)
02:55LauJensenppppaul: You had a problem and you thought you would solve it with regexes :)
02:56ppppauli have a problem with unmatched delimiters now :(
02:56LauJensen...and now you have two problems
02:56ppppaullol
02:56ppppaulwith regex my code size shrunk a lot
02:57ppppaulwithout regex i need to make a big function for every
03:03LauJensenppppaul: Didnt you see my set example ebove? about the same size as your regex
03:04Raynesamalloy: sexpy is running the latest clojail. What I just pushed mere moments ago.
03:05RaynesI've got a little bathroom reading to do.
03:05amalloyRaynes: excellent
03:05amalloyto both, i guess? :P
03:05ppppauli needed more complexity than just (integer?)
03:06ppppauli needed to test things about the number if it was an int, as well
03:06ppppaulneeded an every? and some? nested
03:06ppppaulwith (str and regex i just need that one line of code
03:06LauJensen&(number? 5.5)
03:06sexpbot⟹ true
03:07ppppauli need to make sure the integer? is 0-9
03:07ppppaulso, three functions
03:08ppppaulreplaced by (str and regex
03:11ppppaulactually, str isn't playing well with flatten :(
03:13ppppaul(str (read-string "(+ 1 1)"))
03:13ppppaul"(+ 1 1)"
03:13ppppaulrosettacode.24game=> (str (flatten (read-string "(+ 1 1)")))
03:13ppppaul"clojure.lang.LazySeq@ee696f27"
03:13ppppaulhow do i extact all of flatten?
03:13ppppaul(doall?
03:16raek,(pr-str (flatten (read-string "(+ 1 1)")))
03:16clojurebot"(+ 1 1)"
03:16ppppaulthanks
03:17ppppaulwhat does 'pr' mean? it doesn't say in the docs
03:17ppppaul(doc pr-str)
03:17clojurebot"([& xs]); pr to a string, returning it"
03:19Chousuke(doc pr)
03:19clojurebot"([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"
03:21RaynesLauJensen: You mean to tell me that 5 is a number?
03:21RaynesNo way man. No way. I can't accept it.
03:21LauJensenRaynes: Just dropping clues for ppppaul before he starts implementing Perljure
03:21ppppaullol
03:21Raynesamalloy: I just checked on crisis1, and raynes.me is pointing at our VPS now. We hath been successful.
03:22amalloycool. and i've finally got mongo doing almost what i want
03:22amalloy:P
03:22ppppauloh, is pr for serialization?
03:22Raynesamalloy: You're *still* working on getting mongo to work properly on that plugin?
03:22ChousukeWell, ghetto serialisation :P
03:22amalloy&((juxt pr print) "hi")
03:22sexpbot⟹ "hi"hi[nil nil]
03:22Raynes&(doc pr)
03:22sexpbot⟹ "([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader"
03:22RaynesOh, you already did that.
03:22amalloyRaynes: any watching tv :P
03:22amalloy*and
03:23Chousukeit works for a bunch of things, but you can't print everything readably
03:25Raynesamalloy: Anyways, as soon as my ISP's cache wears out and I can navigate to raynes.me, I'll start moving my web related stuff over to crisis2.
03:25amalloyRaynes: i actually just solved the problem i was having earlier. now i'm having trouble getting update! to work, so i'm just gonna use the same destroy!/insert! hack the other plugins use
03:25Raynescongomongo has update!?
03:25RaynesWell I'll be damned.
03:25amalloysorta
03:25RaynesAlso, don't call my code a hack. :(
03:26amalloyit's "take the entry whose id is x, and replace it with this object", more or less
03:26RaynesThat's meh.
03:26amalloyman, you *know* destroy/update is a hack :P
03:26amalloybut it's good enough for me, at this point
03:26RaynesIt makes sense, but still meh.
03:27RaynesI had somebody ask me how the plugins could see the mongo connection even though the mongo connection is opened at runtime in a totally different unrelated namespace. I didn't have an answer.
03:27RaynesI'm still not sure how that works. congomongo in general is a hack.
03:27Raynes:<
03:27amalloyyeah i guess
03:27RaynesOr magic, depending on whether your glass is half full or not.
03:28LauJensenThey should have called it Mongojure, with emphasis on the 2nd o
03:28jarturHmm, if I start a thread within a (binding ...) form will that thread have a global binding or local one?
03:29Raynes"I have before me a contract for a Ring book from the Pragmatic Press. (via @marick)" Oh my heavens, that's awesome.
03:30RaynesIt's almost as awesome as this here hotpocket I'm scarfing down.
03:30jarturRaynes: I read that @mmcgrana I think. Maybe it was retweet
03:30Raynesjartur: Maybe. I got it from disclojure.
03:30LauJensenWow, cond-let doesnt support destructuring. Doesnt that make it almost totally useless?
03:31Raynes$sed -LauJensen s/almost//
03:31sexpbot<LauJensen> Wow, cond-let doesnt support destructuring. Doesnt that make it totally useless?
03:31RaynesNo destructuring, no cookies.
03:31amalloyLauJensen: um, i'm pretty sure it does support destructuring, it's just that cond-let is a totally different type of thing than if-let, so the name is confusing
03:32LauJensen&(cond-let [[x y] [1 2]] (> x y) "bigger" (< x y) "smaller")
03:32sexpbotjava.lang.Exception: Unable to resolve symbol: cond-let in this context
03:32LauJensen&(use 'clojure.contrib.cond)
03:32sexpbotjava.io.FileNotFoundException: Could not locate clojure/contrib/cond__init.class or clojure/contrib/cond.clj on classpath:
03:32LauJensenAll has failed me
03:33LauJensen,(use 'clojure.contrib.cond),
03:33clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/cond__init.class or clojure/contrib/cond.clj on classpath:
03:33amalloy(cond-let [[a b]]
03:33amalloy [1 2] {a b})
03:33amalloy==> {1 2}
03:33RaynesThat confuses me so bad!
03:33LauJenseneh?! O_o
03:33amalloyLauJensen: i told you. cond-let does something totally different from if-let
03:33Raynesamalloy: Ever notice how some (SOME) contrib libs aren't available in the sandbox? ANY sandbox. clojurebot's, clj-sandbox, nor clojail.
03:33LauJensenThat needs to be looked at imo
03:34amalloyLauJensen: it's actually a lot more useful this way
03:34amalloyi think it should just be renamed
03:34amalloyit takes a form to bind to, then a set of tests. whichever test succeeds, it binds to the form and evals the expr with those bindings
03:35LauJensenamalloy: no cookies
03:39Raynesamalloy: Can you hit raynes.me:10000 yet? I had a buddy hit it a moment ago, successfully. :>
03:39jarturOkay, new thread within binding will have global var value.
03:39amalloyRaynes: yes
03:39RaynesEverybody but me.
03:40LauJensenRaynes: Its hard to imagine Alabama not being one of the first priorities during an DNS change :)
03:41RaynesI know, right?
03:41jarturRaynes: in Vladivostok, Russia I can hit it.
03:42RaynesMeh, what's 7 hours or so.
03:42amalloyRaynes: i just called a buddy who lives on the moon
03:42amalloygetting great d/l speeds
03:42LauJensenRaynes: You need to get some security on that server now that the Russians have access
03:43jarturMwahahaha
03:43Raynes:p
03:43LauJensenIts crazy - When you open a new VH somewhere, almost immediately, seconds after it gets an IP, the chinese start trying to get root
03:44LauJensenBut I guess when you have the power to employ a hacker for each IP in the known universe, it would be silly not to exploit that fact
03:44Raynesamalloy: Did you ever buy a new domain last night? Or are you going to keep your old VPS and keep your old domain pointed wherever it was before and such?
03:44amalloyno, i ended up not doing it. couldn't find any fun ones for sale
03:44amalloymight get akm.me or something, but eh
03:44RaynesShame.
03:45RaynesYou should. Me, you, and fogus_ would all have matching domains.
03:45jarturWhat is idiomatic way in Clojure to do scheduled execution with fixed rate?
03:46jarturreify timertask and use Timer.scheduleatfixedRate ?
03:47Raynesamalloy: You know, I've implemented a Clojure sandbox in 141 lines of code. Including whitespace.
03:47Raynes:D
03:47RaynesClojure is so awesome.
03:47amalloyprobly about 200 lines without my help,eh? nudge nudge
03:47RaynesI want to go back to the conj and do a lightning talk about it.
03:48Raynesamalloy: You cut me back 2 lines I think. Don't get snarky with me. s_s
03:48RaynesIt was at least 4. Maybe 5.
03:49amalloywell! now that you've given me that huge bump i won't have to get huffy
03:49RaynesUsing symbols rather than class objects was borderline retarded, so I give you that.
03:49amalloy*laugh*
03:51RaynesI'm going to have to learn how to dump and restore a mysql database.
03:51jarturC'mon any pointers at least. =)
03:51amalloyRaynes: mysqldump
03:52RaynesI only use mysql for wordpress. I should really just transfer it over to wordpress.com, shouldn't I?
03:52RaynesIt's kind of silly to host my own blog. I gain nothing from it.
03:52amalloyi did say
03:52amalloyi guess you gain "geek cred"
03:53RaynesAnd then I don't have to run mysql and can save memory. Not that we need memory now.
03:53Raynescemerick uses wordpress.com. He has all sorts of geek cred.
03:53RaynesOf course, he has nREPL. But hey, I've got sexpbot and Clojail!
03:54Raynes$dict entrenched
03:54sexpbotRaynes: preposition: dug in
03:54ppppaul$dict dug in
03:54sexpbotppppaul: noun: A teat, pap, or nipple; -- formerly that of a human mother, now that of a cow or other beast.
03:54RaynesDuh
03:54ppppaulso...
03:54amalloylolwut
03:55ppppaulfirm nipple?
03:55amalloy*checks*
03:55amalloynot telling
03:55ppppauloh boy
03:55RaynesIt didn't check 'in', by the way. It only checked 'dug'
03:56amalloyyeah, obv
03:56ppppauli bet in is some sexual thing too
03:59jarturAhh, TimerTask is class, can't reify
03:59jarturSucks
03:59amalloyjartur: proxy?
04:28esjmorning all
04:33Raynesesj: Morning.
04:33kryftesj: Huomenta.
04:34esjRaynes: I'm coming to visit your part of the world soon - Thanksgiving in Tennessee :)
04:34RaynesNever been.
04:34RaynesClose enough though.
04:34esjMy first experience was actually a UT / Alabama game...
04:37BahmanHi all!
04:37esjMorning Bahman
04:38BahmanMorning esj.
04:39kryftDoes anyone here happen to use vimpulse?
04:40kryftI'm wondering if it's a major/minor mode or if it works by somehow modifying whatever major/minor mode you happen to be in.
05:48morphlingLauJensen: you there?
05:48LauJensensure
05:48LauJensenThis is #clojure, where else would I be? :)
05:48morphlinghehe
05:49morphlingi'm sfehrenbach on twitter
05:49morphlingI don't get why (avg x y) would not work, but i don't think it would be a good idea anyway
05:49morphlingi think it's too close to clojures function calls
05:50LauJensenmorphling: If we're to implement a consumer of lists, you loose all excess to regular clojure, OR we need to implement factory fns for every single SQL function ever written. Which was pretty much the mistake of the old ClojureQL
05:50LauJensens/excess/access/
05:50sexpbot<LauJensen> morphling: If we're to implement a consumer of lists, you loose all access to regular clojure, OR we need to implement factory fns for every single SQL function ever written. Which was pretty much the mistake of the old ClojureQL
05:51morphlingah, okay
05:51morphlingbut how would you do (avg (max a b))? :avg#:sum#a#b?
05:52morphlings/sum/max
05:52sexpbot<morphling> but how would you do (avg (max a b))? :avg#:max#a#b?
05:52LauJensenRight now you can do [[:a.b/max :as :m] :m/avg - But this whole discussion is to arrive at a superior format
05:53LauJensen(by right now I mean on my local snapshot, on the MASTER you still have the # syntax with no way to hit multiple fields)
05:58morphlingdo you think it'd be enough to just quote sql function calls, like '(avg :field)? you could still call clojure functions with backquote and unquote
06:00LauJensenInteresting idea - I'll try to play around with it a little
06:05fliebelmorning
06:06kzarmornin'
06:06belunellow :)
06:39kzarI've got a number like 56.00000000000001 and I want to check if it's basically 56 but I think something funny is happening? &|(- 56.00000000000001 56)|&
06:39sexpbot⟹ 7.105427357601002E-15
06:43jowagkzar: http://floating-point-gui.de/
06:43Chousukekmc: what's weird about that?
06:44Chousukeor well
06:44Chousukeit is weird, but not if you keep in mind they're floats :P
06:45beluncan you cast to integer ?
06:45belunor what u need requires floats ?
06:49lenwhi all
06:52lenwi am trying to uderstand where i am building up memory - i have a (for [t (range 1 10000)] (let [x (f t)] (process x))) and i OOM exceptions - isnt x gc'ed in the for statement above ?
06:52kzarConverting it into a float did the trick, thanks for the ideas everyone
06:54Chousukelenw: for generates a lazy seq. are you sure you're not storing the whole seq in memory at once?
06:55lenwChousuke: what alternative do i have to drive that ?
06:56lenwChousuke: would that code above cause the whole seq to be in mem at once - its not what i want :)
06:56Chousukelenw: it depends on what you do with the seq for returns
06:57lenwChousuke: i am ignoring it ... its just driving the process
06:57Chousukethen you're misusing for
06:57Chousukeuse doseq
06:57lenwi thought i might be thatnks
06:57Chousukefor is not for side-effects :)
06:57lenw:)
06:58lenwlike writing to a mongodb ...
07:03tormarI want to consume a REST api using clojure, but I need to use digest authentication. Are there any client libs which has digest implemented? Not familiar with Java, but guess some interop will work for me. Any pointers?
07:04tormarFor instance, has anyone done digest auth with clojure.contrib.http.agent?
07:57rooliohelp
07:58belunhit F1 :P
08:18belun(defn show- me [& {:key s [what ] :or {:wha t "defa ult"}] what)
08:19belunhow do i talk to the bot ?
08:20bartjbelun, hit a comma before the expression
08:20bartjthere is also something called sexpbot here and you need to hit a "&" before your sexp
08:21bartjnot sure how clojurebot is different from sexpbot
08:21bartjfor eg: to invoke clojure bot here:
08:21bartj, (:a {:a 1 :b 2})
08:21clojurebot1
08:21belun,(defn show-me [& {:keys [what] :or {:what "what?"}} ] what)
08:21clojurebotDENIED
08:22belun:)
08:22belun, (defn show-me [& {:keys [what] :or {:what "what?"}} ] what)
08:22clojurebotDENIED
08:22bartjbelun, you cannot define functions here
08:22beluncan i fn and use directly ?
08:22LauJensen&(letfn [(show-me [& {:keys [what] :or {:what "what?"}}] what)] (show-me {:what "hey"}))
08:22sexpbotjava.lang.IllegalArgumentException: No value supplied for key: {:what "hey"}
08:23LauJensenbartj: actually you can, but you need letfn
08:23belun &(letfn [(show-me [& {:keys [what] :or {:what "what?"}}] what)] (show-me))
08:24bartjbelun, you need to remove the space before &, I think
08:24belun &(letfn [(show-me [& {:keys [what] :or {:what "what?"}}] what)] (show-me "something"))
08:24belun&(letfn [(show-me [& {:keys [what] :or {:what "what?"}}] what)] (show-me "something"))
08:24sexpbotjava.lang.IllegalArgumentException: No value supplied for key: something
08:24belunya :)
08:24Chousukeyou're using map destructuring
08:24belun&(letfn [(show-me [& {:keys [what] :or {:what "what?"}}] what)] (show-me))
08:24sexpbot⟹ nil
08:25beluni want try out named args
08:25Chousukedo (show-me :what "something")
08:25belun&(letfn [(show-me [& {:keys [what] :or {:what "what?"}}] what)] (show-me {:what "anything"}))
08:25sexpbotjava.lang.IllegalArgumentException: No value supplied for key: {:what "anything"}
08:25belun&(letfn [(show-me [& {:keys [what] :or {:what "what?"}}] what)] (show-me :what "anything"))
08:25sexpbot⟹ "anything"
08:26belunyay
08:26belunyet so complicated
08:26Chousukenot complicated. :)
08:26Chousukeit's pretty simple if you know how destructuring works
08:26belunaint pretty
08:27ChousukeI don't know why the :or thing didn't work though.
08:27belun&(letfn [(show-me [& {:keys [what] :or {:what "what?"}}] what)] (show-me :what))
08:27sexpbotjava.lang.IllegalArgumentException: No value supplied for key: :what
08:27belun&(letfn [(show-me [& {:keys [what] :or {:what "what?"}}] what)] (show-me))
08:27sexpbot⟹ nil
08:27belun(clojure-version)
08:27belun&(clojure-version)
08:27sexpbot⟹ "1.2.0"
08:28Chousukeah
08:28Chousukeyour or map was wrong
08:28belunhow
08:28Chousukeit needs to be {symbol defvalue}
08:28Chousukenot :key defvalue
08:28belun&(letfn [(show-me [& {:keys [what] :or {what "what?"}}] what)] (show-me))
08:28sexpbot⟹ "what?"
08:29belunyee
08:29bartjer, when should letfn be preferred over defn?
08:29beluner now :P
08:29Chousukebartj: when you don't want to define a global function :P
08:29belundefn puts stuff in ur namespace
08:29belunletfn just creates and uses
08:30bartjChousuke, functions can also be defined within defn
08:30bartjChousuke, or am I wrong ?
08:30belun&(show-me)
08:30sexpbotjava.lang.Exception: Unable to resolve symbol: show-me in this context
08:30Chousukebartj: with letfn
08:30Chousukeletfn is just sugar got let + fn
08:30raekbartj: not with defn (as you would in Scheme)
08:30Chousukeright.
08:30Chousukeif you do (defn foo ... (defn bar ...)) you're defining two global functions
08:31Chousuke... and bar's definition will change whenever foo is called.
08:31belunwhich this sandbox doesnt let you :P
08:31bartjno, I mean (defn foo (let [ bar-fn (fn [] ) ] ...))
08:31Chousukebartj: yeah
08:31raekthe only time I use letfn is when I need a helper function for a lazy seq
08:31Chousukebartj: letfn is some macro sugar for that.
08:32raekthe fn name is visible inside the fn, which is not the case if you only use (let [f (fn [...] ...
08:32bartjChousuke, hmm, ok!
08:32Chousuke(letfn [(foo [] ...)] ...) expands to (let [foo (fn foo [] ...)] ...)
08:33raekthe second "foo" is what makes foo refer to the function itself inside the function
08:34bartjChousuke, raek cool, thanks! I don't see myself declaring only functions in my lets, though
08:34Chousukeletfn also supports mutually recursive definitions I think
08:37raekideal if you tend to implement Hofstadter's M and F functions as lazy seqences a lot... ;-)
08:37fliebelChousuke: How so?
08:37Chousukefliebel: hm?
08:37Chousukehow so what?
08:38raek,(doc letfn)
08:38clojurebot"([fnspecs & body]); Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the function...
08:38fliebelChousuke: If letfn expands to a let, how could they be mutualy recursive?
08:38raek"All of the names are available in all of the definitions"
08:38fliebelraek: I see…
08:39raekhrm, I wonder what the resulting let looks like
08:39fliebelthe magic seems to be inside letfn*
08:39raekah, a special form?
08:39fliebelit's not in core at least
08:39LauJensen&(letfn [(od? [x] (if (pos? x) (eve? (dec x)) "odd")) (eve? [x] (if (pos? x) (od? (dec x)) "even"))] (odd? 5))
08:39sexpbot⟹ true
08:40LauJensenoops
08:40LauJensen&(letfn [(od? [x] (if (pos? x) (eve? (dec x)) "even")) (eve? [x] (if (pos? x) (od? (dec x)) "odd"))] (od? 5))
08:40sexpbot⟹ "odd"
08:40LauJensen:)
08:40Chousukeyou can shadow globals, you know
08:41LauJensenyea I know
08:42fliebelHuh, where is letfn* comming from? It's not in core and no in special forms.
08:44LauJensenCompiler.java line 42
08:44fogus_fliebel: Usually starred things live in the Compiler. But not always.
08:45jarpiainletfn* is the true special form, the letfn macro just adds some syntax sugar
08:46jarpiainjust like let macro adds destructuring to the let* special form
08:47fliebelI never thought of letfn as something special… more special than let.
08:48fogus_fliebel: I don't understand what you mean
08:48jarpiainin scheme it's possible to implement letfn using let because the bindings created with let are mutable
08:48chouserthough in the case of letfn and let, along with many other "special forms", the macro input is the official and documented api. Don't rely on the behavior or even the existence of let* or letfn*
08:49chouserfor example, 'if' has been a macro is some versions of clojure and a special form in others.
08:50fliebelchouser: a macro of what? What is it currently?
08:51LauJensenThe only exception is Enlives emit* which I love too much to respect christophes warnings :)
08:52hiredmanuh, I think it was a macro when rest was split into first/next
08:52hiredmanif expanded into a check to see if you were nil puning
08:52hiredmaner
08:52hiredmanrest/next
08:53chouserhiredman: right
08:53chouserfliebel: so temporarily the special form was if* and if was a macro that used it
08:53fogus_BTW, what is the canonical meaning of foo* (i.e. starness)
08:54chouserand now if is back to being a special form
08:54hiredmanfoo* is many times used to mean "a helper for implementing foo"
08:54chouserfogus_: I think it's like a "prime" quote in math. x' is somehow related to x
08:55fogus_chouser, hiredman: I see. That is what I expected. But there are some (list*) that are freely used, and others that are "off-limits"
08:55hiredmanof course since we have a unicode enabled language we can also just use ′
09:00jarpiainlist* is from Common Lisp but the naming doesn't seem to be consistent there either
09:01chouseryeah, list* does seem oddly named
09:02fogus_I propose changing the name to awesome-list
09:03bartj, (doc list*)
09:03clojurebot"([args] [a args] [a b args] [a b c args] [a b c d & more]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."
09:05fogus_,(let [awesome-list list*] (awesome-list 1 2 3 4 [5 6 7 8]))
09:05clojurebot(1 2 3 4 5 6 7 8)
09:07bartjwhat are the "a" and "b" in the documentation of list* ?
09:07bartj, (list* 1 2 3 4) ;fails!
09:07clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
09:09fogus_bartj: a and b are just args. The last thing (args) is something that is seqable
09:10fogus_see my use of awesome-list
09:11bartjhmm, is list* syntactic sugar too?
09:11bartjbecause (list* 1 2 3 4 (range 10)) = (into (list 1 2 3 4) (range 10))
09:11fogus_bartj: No. It's just a function https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L580
09:11bartjmaybe not syntactic sugar exactly, but you get the drift.
09:13Chousuke,(list* 1 2 3 4 (range 10))
09:13clojurebot(1 2 3 4 0 1 2 3 4 5 ...)
09:13Chousuke,(into (list 1 2 3 4) (range 10))
09:13clojurebot(9 8 7 6 5 4 3 2 1 0 ...)
09:14fliebel~seen Raynes
09:14clojurebotRaynes was last seen in #clojure, 279 minutes ago saying: Close enough though.
09:14fogus_,[(list* 1 2 {:a 3 :b 4}) (list* 1 2 "abc") (list* 1 2 '#{a b c})]
09:14clojurebot[(1 2 [:a 3] [:b 4]) (1 2 \a \b \c) (1 2 a c b)]
09:15bartjChousuke, am assuming order is not important while using lists
09:15Chousukebartj: huh?
09:15ChousukeI just demonstrated that list* is not equal to the into thing :)
09:16bartjbecause the ordering of the list generated is different?
09:16Chousukeyes.
09:16Chousukelist* is a basic function anyway, not syntactic sugar
09:16Chousuke~def list*
09:17djpowellthere is a nice usage of using fingertrees for statistics here: http://blog.sigfpe.com/2010/11/statistical-fingertrees.html
09:18bartjChousuke, thank you
09:24fogus_spread is fun too
09:24fogus_,(#'clojure.core/spread [1 2 3 [4 5 6]])
09:24clojurebot(1 2 3 4 5 6)
09:26fogus_Although I guess it's just the same as (apply list* [1 2 3 [4 5 6]])
09:34Chousukefogus_: except list* uses spread :P
09:35Chousukeas does apply
09:37fogus_Chousuke: Minor implementation detail. ;-)
10:26tonylmorning
10:26fliebelmorning
10:27lauri`use /nick laurioherd
10:28stuartsierramollie
10:28stuartsierraignore
11:08bartjthe definition of difference in clojure.set/difference seems very different to me
11:08bartjI thought it was (A - B) where A and B are two sets
11:10bartjsorry, wrong interpretation!
12:03ohpauleeztechnomancy: Are you a wondermark fan?
12:08hiredmanohpauleez: he is
12:08ohpauleezahhh cool.
12:08zmyrgelI'm getting "unable to resolve classname" -error from my use my defrecord defined in other file
12:09chouserzmyrgel: if you want to use a defrecord constructor directly, in need to import the class, not just use the namespace
12:09zmyrgelchouser: ah, thought that there would be something like that
12:09chouserzmyrgel: it's generally recommended to provide your own function in that namespace that calls the ctor
12:10chouserdoing that allows 'use' to be sufficient again, as well as giving you a place (in the function) to provide default args, etc.
12:11zmyrgelok, gotta see that
13:13jashmenni dont get this
13:13jashmenn,(conj [1 2 3] "b")
13:13clojurebot[1 2 3 "b"]
13:13jashmenn,(conj (lazy-seq [1 2 3]) "b")
13:13clojurebot("b" 1 2 3)
13:14stuartsierra"conj" means "add to collection"
13:14tonyllazy-seq returns a seq
13:14amalloyjashmenn: conj adds in whatever way is cheapest
13:14tonylvectors are appended
13:14tonylseqs are added in the head
13:14jashmennah okay
13:14jashmennthanks
13:15chouser,(conj {:a 1 :c 3} [:b 2])
13:15clojurebot{:b 2, :a 1, :c 3}
13:15hiredmanclojurebot: oracle is <reply>The sky is falling!
13:15clojurebotRoger.
13:16amalloyhiredman: oh, <reply> is a cute feature. does he have any other modifiers?
13:18hiredmanno, <action> would be nice
13:18hiredmanthere are also variables that can be filled in
13:18amalloyhiredman: like how?
13:18hiredmanclojurebot: say goodbye is <reply>goodbye #who!
13:18clojurebotOk.
13:18hiredmanclojurebot: say goodbye
13:18clojurebotgoodbye hiredman!
13:19pjstadigclojurebot: say goodbye
13:19clojurebotgoodbye pjstadig!
13:19amalloynice
13:19stuartsierraclojurebot: are you skynet?
13:19clojurebotexcusez-moi
13:20tonyloracle is
13:20tonyloracle is?
13:20chouserclojurebot: oracle!
13:20clojurebotThe sky is falling!
13:21tonyl:P
13:39Raynessexpbot: kill
13:39sexpbotKILL IT WITH FIRE!
13:42amalloy$sed -sexpbot s/FIRE/HUGS
13:42sexpbot<sexpbot> $sed -sexpbot s/HUGS/HUGS
13:42amalloyhm. that doesn't seem right
13:43amalloyam i misremembering the sed syntax?
13:43slyrusmissing trailing / ?
13:44amalloyslyrus: maybe, but i made the trailing / optional cause i kept forgetting it, so that would be a bug
13:44Raynesamalloy: Would you believe my ISP still hasn't cleared it's DNS cache? :<
13:44amalloys/kept forgetting/hate
13:44sexpbot<amalloy> slyrus: maybe, but i made the trailing / optional cause i hate it, so that would be a bug
13:45Raynesamalloy: I think you broke sed.
13:45amalloyslyrus: yeah, that's not the problem. i suspect he just doesn't handle sedding his own messages quite as i'd expect
13:45amalloy$sed Raynes s/broke/fixed
13:45sexpbot<> $sed Raynes s/fixed/fixed
13:45amalloy$sed -Raynes s/broke/fixed
13:45sexpbot<Raynes> amalloy: I think you fixed sed.
13:45RaynesNo, you broke it. If sexpbot does something weird, it means you've broke it. Always. Period. No questions asked.
13:45Raynes:p
13:45amalloyRaynes: no, everything still works, except he can't sed himself
13:46amalloyRaynes: haha i think sexpbot does a lot of weird things on purpose
13:46kzar$sed -amalloy s/sed/***
13:46kzarawh shucks
13:46amalloykzar: too slow :P
13:47RaynesI've got to leave for several hours. Have to drive my mother to an optometrist. <3
13:47amalloyRaynes: elbow any better?
14:06fliebelhrm, do I need to dig into Java for a timestap, or can Clojure give me that?
14:07LauJensenfliebel: like (System/nanoTime) ?
14:08amalloy&(System/currentTimeMillis)
14:08sexpbot⟹ 1289416240923
14:08fliebelLauJensen: Yea, but I saw (now) being used in some libs, so I was wondering if that existed anywhere in Clojure.
14:08LOPPguys I have trouble understanding the Ant program by Rich Hickey in clojure
14:09LOPP(defn evaporation [x](when running(send-off *agent* #'evaporation))(evaporate)(. Thread (sleep evap-sleep-ms))nil)
14:09LOPPspecifically this part
14:09kotarak,(now)
14:09clojurebotjava.lang.Exception: Unable to resolve symbol: now in this context
14:09amalloyLauJensen: nanoTime isn't necessarily good, depending on what he wants to use the timestamp for; ms might well be better
14:09kotarakfliebel: rather from some library
14:10LauJensenamalloy: not really
14:10ChousukeLOPP: that's an agent action that the agent sends to itself periodically
14:10LOPPif you are sendign off an agent in the start of the function, aren't you spamming the thread pool?
14:10ChousukeLOPP: no, the agent sends the action to itself
14:10LOPPI would understand if the agent send-off was the last call in the function
14:10ChousukeLOPP: so it just gets queued
14:10LOPPah
14:10hiredmanagent sends are held until the action completes
14:11LOPPso that thread sleep also delays the next execution
14:12LOPPalso why does he use quoting
14:12LOPP#'evaporation
14:12hiredmanyou mean #'
14:12hiredmanwhich is not quoting
14:12hiredmanit means var
14:12LOPPright...
14:12LOPPwhy
14:12hiredmanthere are several reasons to use a var instead of the function the var holds
14:12ChousukeLOPP: it sends the var to the agent as the action so that it can be redefined on the fly.
14:12hiredmanright
14:12hiredmanthat is the most common
14:12LOPPok
14:12ChousukeLOPP: if it sent the function value, it couldn't be changed
14:13LOPPI've noticed this problem in my programs
14:13ChousukeLOPP: a var pointing to a function works just like the function when used as one
14:13Chousuke,(#'+ 1 2) like this
14:13clojurebot3
14:13LOPPI have a system of listeners in my program
14:14LOPPand the thing is that if I use function values then listeners can't be changed by simple redef
14:14LOPPif I use vars then I can't submit anonymous fns
14:15Chousukeyou could use a id -> listener map
14:15Chousukethough hm
14:15LOPPhm let me take another look
14:16LOPPlet me get a paste bin going
14:18LOPPhttp://pastebin.com/2FYJJ5vn
14:18LOPPlook at get-listener-results fn
14:19hiredmanyou can, infact, have anonymous vars
14:19LOPPis that var-get needed
14:19hiredmanbut you shouldn't
14:20LOPPI'm probably doing loads of stupid shit in that code
14:20LOPPmy first clojure program
14:22LOPP(if (symbol? funx)((var-get funx) handler-result)(funx handler-result)))
14:22LOPPis this needed?
14:22Chousukeis the fn ever going to be a symbol? :/
14:22LOPPwell yes
14:22Chousukealso doesn't var-get take a var, not a symbol?
14:23LOPPmaybe...I'm cofused as hell :P
14:23LOPPseems to work well now
14:23Chousukeyeah, because that (symbol? ..) thing is never true :)
14:23LOPPI can either say (add-listener my-fun)
14:23LOPPor (add-listener 'my-fun) and it works
14:24LOPPsecond variant allows rebinding to work perfectly
14:24Chousuke(add-listener #'my-fun) would work too, even without the special casing
14:24Chousuke(doc var-get)
14:24clojurebot"([x]); Gets the value in the var object"
14:24LOPPyes that was my question
14:25Chousukebut #'my-fun is not a symbol
14:25LOPP,(var-get 'first)
14:25clojurebotjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.Var
14:25LOPPit's a sybol
14:25amalloy&(class #'first)
14:25sexpbot⟹ clojure.lang.Var
14:25LOPPI see
14:25Chousukeyeah, that's what I'm confused about :/
14:25Chousukewhy would the var-get in your code ever work?
14:25amalloy&(class 'first)
14:25sexpbot⟹ clojure.lang.Symbol
14:25LOPPit works if you do 'first instead of #'first
14:26hiredmanno it doesn't
14:26Chousukeyeah, but then the (symbol? ...) is not true :)
14:26hiredmanit passes 'first to var-get
14:26Chousukeand the var-get still doesn't get called.
14:26LOPPah
14:26LOPPwell I guess I'm screwing this one up :/
14:26hiredmanChousuke: 'first is a symbol
14:26Chousukebut THEN it works because you can treat vars holding functions as functions
14:26Chousukehiredman: I know
14:27Chousukehiredman: I was talking about what his code does if he passes #'foo to the function
14:27hiredmanso why wouldn't the var-get get called if he passed 'first?
14:27hiredmanChousuke: and he said "it works if you pass 'first instead of #'first"
14:27Chousukehm, then I read it the other way around
14:27LOPPwhat about non functions
14:28ChousukeLOPP: won't work
14:28amalloyLOPP: what about them?
14:28LOPPI mean...if I have a global var with some constant
14:28Chousukeyou'll get an exception
14:28LOPPthen I have a bunch of function using this global
14:28LOPPhow do I make it support rebinding
14:28Chousukeah
14:29Chousukeno need
14:29Chousukejust redef it
14:29amalloyLOPP: you can (def) it again
14:29LOPPordinarily the function defn will capture the then current global var value, right?
14:29amalloyno
14:29Chousukethat'll be what happens in 1.3 though
14:29ChousukeI think
14:29amalloystill not quite true, Chousuke
14:29Chousukethe problem in this case is what happens when you call (add-listener foo)
14:29LOPPbecause that was exactly what was happening to me here
14:30amalloyre-def will still work in 1.3; it's (binding) that will need more magic
14:30Chousukefoo is evaluated, and its value, the function, is passed to add-listener
14:30Chousukeso add-listener never sees the foo var
14:30LOPPright
14:30Chousukebut if you use foo in a defn someplace, it won't be replaced like that.
14:30Chousukeinstead, it'll be a Var.get() call every time
14:30Chousukeso rebinding works
14:32LOPPhm
14:32Chousukebut if you call (add-listener #'foo), you're actually passing the var itself to act as the listener
14:32Chousukeso redefs work
14:32LOPPok
14:32LOPPso I need to be careful when passing things as arguments
14:33LOPPbut not when coding the fn itself
14:33Chousukeonly if you need to redefine things dynamically :)
14:33LOPPand this only works for functions
14:33LOPPok
14:33Chousukewell, you can always do @somevar
14:33Chousuketo get its value
14:33LOPP@#'first
14:33Chousuke,@#'first
14:33clojurebot#<core$first clojure.core$first@5d1647>
14:33LOPPok
14:33LOPPthanks a lot
14:34LOPPclojure is hard :P
14:34ChousukeLOPP: nah. it just takes a while. :)
14:34ChousukeIt's not the easiest language though.
14:34LOPPdon't worry I like hard
14:34LOPPI'm bored out of my mind with java
14:35LOPPevery code snippet is so trivial yet large programs are often intractable
14:35LOPPI want things the other way around :p
14:35Chousukehehe
14:36amalloyLOPP: the clojure code snippets are a lot less complicated than the equivalent java too, usually
14:36fliebelwohooo, I wrote my first sexpbot plugin! come check it out in #tempchan
14:36amalloynone of this fiddling around with for loop indexes every time you want to do something with a collection
14:36ChousukeI like apache refactoring example :P
14:36Chousukewhere a 10-something line java method becomes a single line of Clojure code.
14:36LOPPtoday I was fixing a JSF page which had 5 different representations of the same document floating around session data at the same time
14:37LOPPintractable
14:58pppaulrosetta code now has more clojure rep!
14:59pppaulLLOP: why is clojure hard?
14:59pppaulwhat examples are you guys talking about?
15:07amalloypppaul: well, an example of clojure's brevity came up yesterday
15:08amalloysomeone wanted to write a function f so that (f + [1 2 3 4]) returns [1 3 6 10]
15:08pppaul&(second (re-find #" (\d{1,2}:\d{1,2}:\d{1,2}) UTC" (slurp "http://tycho.usno.navy.mil/cgi-bin/timer.pl&quot;)))
15:08sexpbotjava.security.AccessControlException: access denied (java.net.SocketPermission tycho.usno.navy.mil:80 connect,resolve)
15:09pppaulsounds like a cool function
15:09amalloytry it in java, and then think about the clojure version
15:09Chousuke(def reductions)
15:09amalloy&(reductions + [1 2 3 4 5 6])
15:09sexpbot⟹ (1 3 6 10 15 21)
15:09pppauli don't touch java :P
15:09pppauljavascript, maybe
15:09amalloyman i know, guys
15:09Chousuke~def reductions
15:09pppaul(doc reductions)
15:09clojurebot"([f coll] [f init coll]); Returns a lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with init."
15:10pppaulreduction is sexy
15:11pppaul(source reductions)
15:11pppaul&(source reductions)
15:11sexpbotjava.lang.Exception: Unable to resolve symbol: source in this context
15:11amalloy$source reductions
15:11sexpbotreductions is http://is.gd/gUAFl
15:13amalloypppaul: https://gist.github.com/e8c514dd7543d071fbf2
15:13amalloyand it only works for ints :P
15:13pppaul&(reductions + (take 50 (repeat 1)))
15:13sexpbot⟹ (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50)
15:13amalloyand +
15:14pppaulreductions has so many restrictions?
15:14amalloy?
15:14amalloyno, the java version i slapped together does
15:14pppauloh
15:14pppauloooooooh
15:15pppaulhow are you using array.clone()? i thought it was a protected method
15:15pppauloh wait
15:15pppaulnm
15:15amalloyObject.clone is protected; arrays make it public
15:15pppaulbut array.clone is a shallow clone, right?
15:15amalloyyes...but ints aren't references, so that doesn't matter
15:15pppaulor is clone fixed now?
15:16pppaulok
15:16pppaulints are pretty sexy
15:16amalloyyou can't really "fix" clone to always deep-clone. the meaning of clone will vary by class
15:17pppaulthe code seems pretty simple
15:17amalloythe java for intermediateSums, you mean?
15:17pppaulyes
15:18pppaulalso, the clone for java is broken cus it's protected, not because of wanting to deep-clone or not
15:18amalloysure, it's not hard code. but java makes you deal with all the fiddly bits like array indexing, allcating the return value
15:19pppaulif i have a vector<fancy-obj> vec. vec.clone() will call Object.clone() not fancy-obj.clone()
15:19amalloyand you have to restrict yourself to a fixed type and a fixed operator
15:19amalloyum, no it won't
15:19pppaulbut vector is actually for Objects... so the whole collections framework is crap
15:19amalloyit won't call any .clone at all
15:19pppaulit wont?
15:19pppauli thought it would
15:20pppaulwhat will vec.clone() do?
15:20amalloyit makes a new vector with new references to the same objects
15:20pppaulso only 1 .clone() method is called in total?
15:20amalloyindeed
15:20pppaulsurprise
15:20amalloywhich is pretty useful behavior, in fact
15:20pppaulwhat?
15:20clojurebotwhat is wrong with you
15:21pppauli can see how it's useful to have that behaviour =
15:21pppaulbut, i want other behaviours too
15:21pppauldoing a deep clone of a vector gave me a lot of problems
15:22amalloypppaul: yeah. java's non-deep-cloning behavior means if you want that you have to iterate through the cloned vector's elements and clone each one in turn
15:22amalloynot hard, but more fiddly bits
15:22pppaulit's a surprise
15:22amalloymeh
15:23amalloyany behavior would be surprising some of the time
15:23pppauljust like how CL has shared objects and non-shared objects... sometimes that leads to surprises
15:23devinus(doc defmacro)
15:23clojurebot"([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Like defn, but the resulting function name is declared as a macro and will be used as a macro by the compiler when it is called."
15:24pppaulanyway, if you search google for people trying to deep-clone in java.... some people are doing crazy stuff, like serializing to clone.
15:26pppaulso some people's surprises are another person's adventure to find out how they are supposed to solve the problem in an elegant way using the provided language features... and that leads to crazy stuff sometimes
15:27tonyl&(doc if-let)
15:27sexpbot⟹ "Macro ([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
15:29tonylwhere is the test part in if-let
15:30amalloy"bindings => binding-form test"
15:30fogus_tonyl: in the value part of the binding
15:30amalloy&(if-let [a (inc 0)] a)
15:30sexpbot⟹ 1
15:30amalloy&(if-let [a nil] a)
15:30sexpbot⟹ nil
15:30tonylooh ok, all the values must be true then
15:30amalloyall of them?
15:31tonyl&(if-let [a false b 54] [a b])
15:31sexpbotjava.lang.IllegalArgumentException: if-let requires exactly 2 forms in binding vector
15:31tonyloh so only one
15:31fogus_,(if-let [this-is-truthy :anything-that-is-truthy] this-is-truthy)
15:31clojurebot:anything-that-is-truthy
15:31amalloy&(if-let [[a b] [false 54]] [a b])
15:31sexpbot⟹ [false 54]
15:31amalloy&(if-let [[a b] nil] [a b])
15:31sexpbot⟹ nil
15:32fogus_amalloy: even better
15:33amalloyfogus_: not very good in general though. you can't bind b to 54 iff a is not falsey
15:34fogus_I'm not sure that I've ever needed to bind more than one thing in if-let
15:34amalloyfogus_: i've wanted to, just to shorten my (if foo (let [...])) forms
15:35fogus_It becomes too complicated to reason about
15:35amalloybut technomancy and i have different expectations for what this "would" do if it worked
15:35amalloyso it's a good thing it doesn't :)
15:42pppaul&(#( % %) #(% %))
15:42sexpbotjava.lang.StackOverflowError
15:42pppaul^_^
15:44tonyl$sed -pppaul s/( %/(%/
15:44sexpbottonyl: Format is sed [-<user name>] s/<regexp>/<replacement>/ Try <prefix>help sed
15:44tonyl$help sed
15:44sexpbottonyl: Simple find and replace. Usage: sed [-<user name>] s/<regexp>/<replacement>/If the specified user isn't found, it will default to the last thing said in the channel. Example Usage: sed -boredomist s/[aeiou]/#/Shorthand : s/[aeiou]/#/
15:45amalloytonyl: ( is special in regexes
15:45tonyl$sed -pppaul s/\( %/(%/
15:45tonylbrain fart
15:45amalloyheh
15:46tonyli'm guessing it only works with the last message
15:46amalloytonyl: i'm certain it only works with the last message :)
15:46amalloysince i'm the current maintainer of $sed :P
15:47pppaul:P
15:47amalloy$sed -pppaul s/P/D!
15:47sexpbot<pppaul> :D!
15:48amalloyturn that frown upside-down, matey
15:48pppaul=[
15:55tonyllol
15:55tonylamalloy: do you have an open repo of the $sed?
15:55tonyl$sed -pppaul s/\[/~\(/
15:55sexpbot<pppaul> =~(
15:56amalloytonyl: yeah, it's in raynes' sexpbot
15:56amalloyhttp://github.com/Raynes/sexpbot/blob/master/src/sexpbot/plugins/sed.clj
15:57tonylcool, i wanted to check the code
15:59amalloy$sed -pppaul s/[[]/~(/
15:59sexpbotamalloy: Format is sed [-<user name>] s/<regexp>/<replacement>/ Try <prefix>help sed
15:59amalloyhm, that should parse
15:59tonylbrackets are special chars
15:59amalloytonyl: i know, which is why i mangled it
15:59amalloy[[] is the character class matching [
16:00pppaul&(#( % ) #(% ))
16:00sexpbotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: sandbox4153$eval6042$fn
16:00amalloyi was hoping to demonstrate that \[ wasn't the only way
16:00tonylyeah that is weird
16:00pppaul&(#( % %) #(% ))
16:00sexpbotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: sandbox4153$eval6055$fn
16:00pppaul&(#( % %) #(% %))
16:00sexpbotjava.lang.StackOverflowError
16:00tonylweird
16:01pppaulhas anyone programmed in chef?
16:02ohpauleezpppaul: As in the Ruby deployment tool?
16:03pppaulChef is an esoteric programming language designed by David Morgan-Mar
16:04tonylamalloy: that regex gives me an error here http://www.regexplanet.com/simple/index.html
16:04amalloyyeah, i must be wrong about [[]
16:05tonyli thought only ^ was a special char inside the brackets
16:05amalloy]^-\ are special
16:06tonylso it is an implementation error, maybe
16:07amalloytonyl: maybe. that's a conclusion that's more often jumped to than demonstrated
16:08tonylyeah
16:08amalloyotoh it works in perl
16:08amalloy$ perl -p -e 's/[[]/!/g;'
16:08amalloy11[][[]]
16:08amalloy11!]!!]]
16:09amalloy&#"[[]"
16:09sexpbotjava.util.regex.PatternSyntaxException: Unclosed character class near index 2[[] ^
16:09amalloytonyl: okay, you win. java's regex compiler doesn't handle this right
16:10pppaulfor [[]?
16:10amalloyyeah
16:10pppaul[\[]
16:10tonylso in java you can have character classes inside char classes?
16:10amalloyi dunno
16:10tonylha interesting
16:10tonyltesting time
16:10amalloyobviously you can get around it with \[, but that's not supposed to be required
16:11pppaulbug
16:11amalloytonyl: php does, though, btw. the amusing character class [][] matches open or close brackets
16:11chouser,(re-find #"[[]]]" "]")
16:11clojurebot"]"
16:11chouserweird
16:11amalloyway weird
16:12amalloychouser: that doesn't work in perl (and it shouldn't)
16:12chouserright
16:12chouser"work" in this case is a subset of "fails to work"
16:16LOPPyou can get around special characters in groups if you put them into spots where they can't be
16:16amalloyLOPP: we're well aware. see my note about [][]. but java doesn't do it properly
16:20pppaul[.][.]
16:21lancepantzvector boobs.
16:24pppaulput a closure on it
16:36anonymouse89how do I eval a string? Something like (eval "[1 2 3]") -> [1 2 3]
16:36chouseranonymouse89: start with read-string
16:38anonymouse89chouser: ah, that's it. My only problem now is that I wrote maps to file and some of the values are strings. But they weren't written to file with quotes around them so {:name "bob"} becames "{:name bob}" when I read it back in.
16:40chouseranonymouse89: yeah, that's a problem. if you want to be able to "read" them later, you should use prn instead of println when printing
16:41pppaul(eval (read-string string))
16:42anonymouse89chouser: this is good. but it still fails for sequences of numbers
16:42anonymouse89,(prn {:a '(1 2 3)})
16:42clojurebot{:a (1 2 3)}
16:42pppaullook at my example on rosettacode for the A B problem
16:42tonylanonymouse89: maybe (map) the map entries and replace format them accordingly
16:43pppaul(eval (read-string (str "(+ " (read-line) " )") ))
16:43pppaul3 3
16:43pppaul6
16:44anonymouse89tonyl: i don't quite understand what you mean
16:45pppaullook at rossetacode :24-game :A+B. clojuredocs is good too
16:46chouser,(read-string (pr-str {:a '(1 2 3)}))
16:46clojurebot{:a (1 2 3)}
16:46chouseranonymouse89: what's the problem there?
16:48tonyl(map (fn [[k v]] [k (prn-str v)]) {:a foo :b bar})
16:48tonyl&(map (fn [[k v]] [k (prn-str v)]) {:a foo :b bar})
16:48sexpbotjava.lang.Exception: Unable to resolve symbol: foo in this context
16:49anonymouse89chouser: I guess nothing. I just thought I remembered doing something awhile ago where if "{:a (1 2 3)}" is written to a file and then read back in it says Integer not IFn
16:49tonyl&(map (fn [[k v]] [k (prn-str v)]) (read-string "{:a foo :b bar}"))
16:49sexpbot⟹ ([:a "foo\n"] [:b "bar\n"])
16:49hiredmananonymouse89: evaling and reading are not the same thing
16:50tonyl&(into {} (map (fn [[k v]] [k (prn-str v)]) (read-string "{:a foo :b bar}")))
16:50sexpbot⟹ {:a "foo\n", :b "bar\n"}
16:51tonyl&(into {} (map (fn [[k v]] [k (.replace (prn-str v) "\n" "")]) (read-string "{:a foo :b bar}")))
16:51sexpbot⟹ {:a "foo", :b "bar"}
16:51tonylthere we go
16:51tonylsomewhat wordy though
16:51chouserpr-str instead of prn-str
16:52tonyl&(into {} (map (fn [[k v]] [k (pr-str v)]) (read-string "{:a foo :b bar}")))
16:52sexpbot⟹ {:a "foo", :b "bar"}
16:53anonymouse89tonyl: nice
16:53tonylif it is a big map though, you might want to improve it
16:53tonylfor performance because into and map makes it go double through the map
16:54anonymouse89it's not a big map
16:54tonylalright
16:56Chousukeit doesn't go through the map twice.
16:56Chousukemap is lazy
16:56amalloypppaul: http://rosettacode.org/wiki/24_game#Clojure is yours?
16:57amalloynm, i can see that it is :P
16:57tonyloh so just once with into then
16:57pppaulhshshs
16:57amalloywhy does (gen-new-game-nums) use 0-10 instead of 1-9?
16:57pppaul:D
16:58pppaulum
16:58pppaulisn't that part of the ruls? 0-9
16:58amalloy"four digits, each from one to nine, with repetitions allowed"
16:58pppauloops
16:58amalloyeven if 0-9 were right, you're giving 0-10 with your rand-int 11, no?
16:58pppaultime to fix that (0s made it hard to play anyway)
16:59pppauli never saw a 10 while testing
16:59amalloy&(take 100 (repeatedly #(rand-int 11)))
16:59sexpbot⟹ (0 5 2 8 10 4 10 6 3 2 1 2 7 6 0 6 10 9 3 4 9 9 5 8 10 10 4 6 5 10 2 9 0 0 9 7 4 9 6 4 9 3 2 4 9 0 2 5 5 0 7 6 2 0 7 6 6 10 8 6 0 0 8 8 7 10 6 4 5 1 7 10 2 7 7 8 1 6 10 5 10 0 1 1 9 4 2 2 6 2 10 7 0 9 1 9 8 2 0 8)
17:01amalloypppaul: and this will blow the stack if the user takes a few thousand tries to get the answer *chuckle*
17:02pppaulit'll blow the stack at like 30k tries
17:03pppaulit may be possible to do that by giving it lots of newlines as input
17:03amalloypppaul: rather than assume the stack is big enough, why not just use (recur)? you're in the tail position already
17:07pppaulcus i'm a believer that the JVM will have tail-call recursion sometime soon
17:07pppaullol
17:08LOPPthat's optimistic
17:08pppaulalso, i'm a newb and don't always know when i can use recur
17:10pppaulso, i made the 2 bug fixes on rosetta code. thanks
17:13pppaulare complex numbers in clojure?
17:13pppaul&(1+2i)
17:13sexpbotjava.lang.NumberFormatException: Invalid number: 1+2i
17:14pppaulguess not
17:17amalloy&(doc complex)
17:17sexpbotjava.lang.Exception: Unable to resolve var: complex in this context
17:17amalloyclojure.contrib.complex-numbers
17:18amalloypppaul:
17:19pppaulthanks
17:20pppaulhttp://richhickey.github.com/clojure-contrib/complex-numbers-api.html (there is no documentation yet)
17:37LOPPis there any special requirement for namespaces to be all in one file
17:37LOPPcan I make namespace2.clj which has (ns namespace1)
17:38amalloyLOPP: hm. well, don't take this as gospel truth, but
17:38amalloyi believe you can do that, except that when someone (require)s your ns1, the runtime will look for it in ns1.clj
17:38amalloyso in practice it's not useful
17:39LOPPok
18:00maaclWhat would be an ideomatic way of writing a test of a database insert using lazytest? using do-it? does this work with contexts?
18:35bhenryi'm looking for something similar to map, but instead of mapping one function over a collection of things, i want to take a hash-map and a collection of functions. then i want back a collection of each function applied to the one hash-map
18:36bhenryshouldn't be hard to write, but wanted to know if it existed.
18:36amalloybhenry: juxt?
18:36bhenry,(doc juxt)
18:36clojurebot"([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, a...
18:36amalloy&((juxt quot rem) 20 6)
18:36sexpbot⟹ [3 2]
18:37amalloy&(doc juxt)
18:37sexpbot⟹ "([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b... http://gist.github.com/671727
18:37bhenry&((juxt :a :b :c) {:a 1 :b 2 :c 3})
18:37sexpbot⟹ [1 2 3]
18:38bhenryamalloy that's it thanks!
18:38replacapppaul: the doc at richhickey.github.com is obsolete, pelase use clojure.github.com (though I think in that particular case the changes are only cosmetic)
18:38amalloybhenry: welcome to the world of juxt
18:38KirinDaveIs there an inverse to juxt?
18:38KirinDavedejuxt?
18:38amalloyKirinDave: ...what would it do?
18:38replacaKirinDave: what would that be?
18:38KirinDaveSuch that ((dejuxt :a :b c) [1 2 3]) ; => {:a 1 :b 2 :c 3}
18:39replacaKirinDave: juxt isn't a map function
18:39amalloyKirinDave: juxt is more general than that, but haven't you just reinvented zipmap?
18:39replacait's a function combiner
18:39KirinDaveamalloy: I'm asking if something exists.
18:39KirinDavereplaca: No, I get that.
18:40technomancycombinernator
18:40KirinDavereplaca: Sorry, I didn't mean literal hash
18:40replacatechnomancy: I was exlicitly avoiding combinator :)
18:40KirinDaveI meant something such that (retval :a) => 1
18:40replaca*explicitly
18:40amalloytechnomancy: hey, look who's here. you have your client set up to highlight you when someone mentions juxt? :)
18:41technomancyamalloy: not yet, but that will soon change
18:41KirinDaveIs this crazy?
18:41amalloyKirinDave: it sounds crazy to me, but i guess if you defined it more clearly it might turn out to be useful?
18:41replacaKirinDave: you mean a primitive function definition?
18:41replacaf(:a) => 1, etc.
18:41KirinDaveYeah
18:42KirinDaveIt'd be like constantly on steroids.
18:42replacaa literal hash map
18:42KirinDaveYeah, that'd do it.
18:42replacadoes exactly that
18:42KirinDaveyes
18:42amalloyKirinDave: right. zipmap
18:42replacaand Rich has taken pains that it fill that role
18:42replaca,({:a 1, :b 2} :a)
18:42amalloy&((juxt :a :b) (zipmap [:a :b] [1 2]))
18:42sexpbot⟹ [1 2]
18:42clojurebot1
18:42clojurebotCool story bro.
18:43amalloytada!
18:43pppaulclojure.github.com bad url name :replaca
18:43KirinDaveyeah.
18:43amalloypppaul: www.github.com/clojure/clojure
18:44replacapppaul: no, I meant this: http://clojure.github.com/clojure-contrib/complex-numbers-api.html
18:44pppaulwhere is the documentation ?
18:44replacainstead of the same with richhickey
18:44KirinDaveI guess I just strongly associate juxt with the :key usage.
18:45pppaulreplaca there isn't much a diff in those pages
18:45amalloyKirinDave: using juxt as sorta a multi-get?
18:45replacaKirinDave: yeah, that's an awesome use case, but it's also a great example of how keywords as functions gives you stuff for free
18:45pppaulwhy have 2 sets? are there plans to take down the older doc websites?
18:45replacapppaul: nope, as I said in that case
18:45KirinDaveamalloy: Yes. Which can be really nice in some cases.
18:46KirinDaveI should use it more
18:46KirinDaveSo I've got several github messages
18:46replacapppaul: but in general, I stopped updating richhickey... back in the summer and it will fall further behind over time
18:46amalloyKirinDave: hm
18:46KirinDaveof people asking me, "Why should use use clothesline when I could just use ring."
18:46KirinDaveI dunno if I should like super-extra-bold the readme
18:46KirinDave"Clothesline uses Ring" in like 90pt font
18:47technomancyugh; people message you over that?
18:47replacabut (as yesterday) what people want to know, is why should I use clothesline + ring instead of ring by itself
18:47KirinDavetechnomancy: Yes.
18:48technomancyI had to add "personal email is not an appropriate avenue for bug reports" to the lein readme, so I guess I shouldn't act surprised.
18:48KirinDavereplaca: That's sort of like asking why people use api frameworks over rack in the ruby world
18:48danlarkintechnomancy: heresy!
18:48KirinDavereplaca: Ring is just adapterware.
18:48KirinDaveDon't get me wrong, it's hella useful if you have trivial stuff to bang out.
18:49KirinDavebut then someone sends your service an OPTIONS request and you really should respond to that and you go augh.
18:49replacayeah, I get that. But the response "Clothesline uses ring" doesn't address that
18:49KirinDaveAlso I guess the http 1.1 graph for webmachine terrifies people. :)
18:50KirinDaveI wsa talking with some of the basho dudes about this. Considering adding fluffy bunnies as node bodies so that people will feel more at ease. ;)
18:52replacaKirinDave: I think it's just opaque to people have haven't yet suffered from the problem
18:52KirinDaveIt is definitely opaque.
18:52KirinDaveThat's the major issue to address with it going forward.
18:58KirinDaveIt's the same problem I had with Katamari tho.
18:58KirinDaveIt's quite useful when you need it, but very few people actually need it.
18:58KirinDaveI should just make an open source distributed key-value store. I hear that sells well.
19:01amalloyKirinDave: no, sell a toolkit for developing such things. the people who actually made money during the gold rush were the equipment salesman
19:02KirinDaveamalloy: I guess so.
19:02KirinDaveI actually wonder if anyone in the world besides Powerset actually needed Katamari.
19:03KirinDaveWhen your pitch starts off with, "Do YOU have 20 year old code that does something cool but can't tell stdio from stderr? Do YOU need to run thousands of instances of this while they crash and burn randomly and pretend you can meet an SLA? Well I have the project for you!"
19:04amalloyhaha what is katamari? i must have missed out, aside from the video game
19:05cemerickKirinDave: LOL @ "…just use ring"
19:06cemerickKirinDave: This is what's called a "teaching moment" ;-)
19:06KirinDaveamalloy: it was my erlang system that was the infrastructure that powerset.com's realtime query analysis/reformulation stuff
19:06KirinDaveEvery hit to powerset.com hit this stack a few times
19:06KirinDaveIt basically was some stuff to created a distributed cloud of heterogenous resources with a uniform calling convention using json-rpc
19:07KirinDaveMost of the things it talked to had no multithreading, so they were put in read-respond mode on io lines. Lots of them run as separate processes on farm machines
19:08KirinDaveKatamari would kill/restart these as necessary to keep the spice flowing, where the spice in this case was natural language analysis
19:08amalloysounds like a blast
19:09KirinDaveHa
19:51jarturCan I somehow get a list of all of object's methods?
19:54technomancyjartur: C-c S-i in slime, clojure.contrib.repl-utils/show otherwise
20:05amaevisIs anyone here familiar with the Compiler.java implementation?
20:07amaevisping?
20:07clojurebotPONG!
20:07amaevispong?
20:07clojurebotPONG YANG!
20:07amalloyfascinating
20:08amalloyclojurebot: pong is <reply>ping?
20:08clojurebotQinfengxiang!
20:08amalloypong?
20:08clojurebotPONG YANG!
20:08amalloyjerk
20:08amalloy(dec clojurebot)
20:08sexpbot⟹ -2
20:08amaevislol
20:08amalloyclojurebot: pong?
20:08clojurebotQinfengxiang!
20:08amalloywtf
20:09amaevisclojurebot: ping?
20:09clojurebotPONG!
20:09amaevisclojurebot: ping pong?
20:09clojurebotPONG!
20:10amaevisSigh. I wish there were documentation on the Clojure compiler.
20:10amalloyamaevis: maybe the folks over at clojureclr have some
20:11amaevisI need the Java internals.
20:11amaevisI'm trying to persist closures.
20:11amaevisAnd the JVM offers no way to get the bytecode of a class after it's been defined.
20:12amalloyamaevis: i don't think that's true
20:12amaevisamalloy: Great! Do you know how?
20:13amaevisamalloy: I've been looking everywhere, including on the Oracle forums.
20:13amalloywell, i could be wrong
20:13amaevisamalloy: Oh. :(.
20:13amalloyare you looking to get bytecode out of .class files?
20:14amalloyor out of a running clojure program with no aot?
20:14amaevisNo AOT.
20:15amaevisI've built a durable ref - (dref <value> <name> <store>)
20:15amaevisI want to make (fn)s durable.
20:17technomancysome functions are inherently unserializable
20:18technomancythose that close over reference types or streams
20:18amaevisI was counting on using ASM magic for that.
20:19amaevisStateful functions wouldn't be allowed.
20:19amalloyamaevis: you could install a classloader that just logs all loaded classes and then delegates to a real loader?
20:19amaevisamalloy: I've tried that route, the issue is with ObjExpr - I can't figure out exactly where newInstance() is called.
20:20amaevistechnomancy: Stateful functions excepting those using durable identities, that is.
20:21amaevistechnomancy:
20:21amaevisOtherwise it cuts out 75% of the utility
20:21amaevisbrb
20:43jartur`Dammit, clojure.contrib.sql sucks unfortunately.
20:44amalloyfightin' words, jartur`...i bet the person who wrote it is in here
20:44coldhead:(
20:44jarturI don't mean it personnaly
20:44amalloyanyway i haven't tried either, but you might give clojureql a try?
20:44coldheadare you sure your beef isn't with SQL per se?
20:44coldheadi know mine is!
20:45jarturI need several persistent connection to different dbs
20:45amalloylaujensen has been boasting about it recently
20:45coldheadSELECT beef FROM sql;
20:46jarturIt's not the question of SQL or DB philosophy
20:46jarturSimply a question of technical possibilities for nonstandard applications
20:47jarturNow I will have to use pure JDBC probably. Or just make a fork of contrib.sql which doesn't use bindings
20:48jarturI hate bindings, btw =)
20:49jarturThough i generally suck, so it doesn't matter much what i hate or like.
21:18jarturClojureQL doesn't seem to be good at keeping persistent connections. Request takes much more time than the interval I need (> 1 sec)
21:18jartur(time @(-> players (cql/select (cql.p/< {:us_person_id 6}))))
21:18jartur"Elapsed time: 5037.438388 msecs"
21:24jarturNoting that sql query takes about 4 to 10 msecs while connection takes 5000 msces.
21:43Deranderthat is ridiculously long
21:51jarturYes it is. Though establishing MySQL connections is a costly operation
21:52jarturMuch more expensive than most simple queries in terms of latency.
21:56dnolenjartur: have you looked at https://github.com/brentonashworth/carte ?
21:57jarturdnolen: I will, thank you.
21:59jarturi wonder when github will add support for code browsing =)
21:59jarturWould be so nice
22:01jarturdnolen: Unfortunately it uses contrib.sql and (with-connection ...) Which means that connection is closed after each operation.
22:01jarturLooks like nobody needs several persistent connections to SQL databases =)
22:02dnolenjartur: with-connection does not close the connection
22:02dnolenwhen you create the connection if you do w/ pooled connection you're fine
22:03jartur(defn with-connection*
22:03jartur "Evaluates func in the context of a new connection to a database then
22:03jartur closes the connection."
22:03jartur(with-open [con (get-connection db-spec)]
22:03dnolenhttp://dosync.posterous.com/22516635
22:03dnolenI've done many tests
22:03dnolenthe connections do not get closed if you create the datasource properly
22:05jarturdnolen: Do you mean that calling .close() on a specifically configured connections do not actually close them?
22:05dnolen10,000 writes a second for mysql, more than that for postgresql
22:06dnolenon Amazon Compute Cluster
22:06dnolenwith little in the way of optimizing either dbs
22:07jarturdnolen: How did you achieve connection pooling with standard contrib.sql?
22:08dnolenjartur: mysql, https://github.com/swannodette/second-post/blob/master/src/second_post/mysql.clj
22:08dnolenpostgresql, https://github.com/swannodette/second-post/blob/master/src/second_post/postgres_pool.clj
22:09jarturWill it work with several different connections at the same time?
22:10jarturI mean to several different databases
22:14lancepantzjartur: yes, use c3p0, you can define as many connection pools as you'd like
22:15jarturlancepantz, dnolen, thank you. This is actually a solution I didn't even had an idea existed.
22:15dnolenjartur: np
22:16lancepantzjartur: if you're working with a webapp, you can actually define your connection pools as JNDI resources
22:16lancepantzhttp://docs.codehaus.org/display/JETTY/JNDI
22:36amaevisping?
22:36clojurebotPONG!
22:36amaevispong?
22:36clojurebotPONG YANG!
22:37amaevis(describe ns)
22:37amaevis,(describe ns)
22:37clojurebotjava.lang.Exception: Unable to resolve symbol: describe in this context
22:38amaevis,(doc ns)
22:38clojurebot"([name docstring? attr-map? references*]); Sets *ns* to the namespace named by name (unevaluated), creating it if needed. references can be zero or more of: (:refer-clojure ...) (:require ...) (:use...
22:45amaevisDoes anyone know if loaded classes ever get released by the JVM?
22:48puredangeramaevis: yes, but there are lots of caveats
22:50amaevispuredanger: Is there a GC-type thread for it?
22:51puredangeramaevis: classes are stored in permgen. how they're collected depends on the jvm and your gc settings
22:51puredangeramaevis: there are some well-known problems with gc of classloaders and classes (many of which are being addressed in jdk 7)
22:52puredangeron a quick google, here's a decent blog: http://blogs.sun.com/fkieviet/entry/classloader_leaks_the_dreaded_java
22:53amaevispuredanger: I wonder what kind of implications this has for long-running Clojure instances.
22:53puredangeramaevis: the same as for any long-running JVM-based program pretty much
22:54amaevispuredanger: I'm building a Class cache using the Google Guava MapMaker with WeakReference keys.
22:54puredangeramaevis: ah, well that's delicate work but those are excellent tools to start with
22:54amaevispuredanger: Do the strong/weak reference rules apply for Class objects?
22:55puredangeramaevis: sure, although you are affected by strong references from Classloaders to the Class loaded by them
22:55amaevispuredanger: Non-dynamic class JVM programs won't get OOM errors on permgen, so that's a consideration for closure-heavy apps.
22:56puredangeramaevis: well that's not true. I've gotten plenty of oom on permgen and I know it's a common issue on JRuby too
22:56amaevispuredanger: That's fine; I just wanted to know if I should even bother with the WeakReferences. If they never get collected, there would be no point.
22:57amaevispuredanger: Ah, I've never run into it. Is it more of a class size thing or a class count thing?
22:57puredangeramaevis: you should bother. we had something like this in Terracotta if you wanted to look at another (far more complicated) impl
22:58puredangeramaevis: comes up if you do a lot of dynamic class work
22:59amaevispuredanger: Hmm, I would love to get your thoughts on what I'm working on.
22:59amaevispuredanger: I'm trying to persist closures.
23:00puredangeramaevis: free to ping me at alexdmiler at yahoo if you want to move it out of here, happy to comment if I have a clue
23:00puredangeramaevis: sorry alexdmiller !
23:01amaevispuredanger: Thanks! It's not proprietary or anything, though. It's an extension to Clojure core.
23:01puredangerok
23:02amaevisI've been working on adding durability to Clojure identities.
23:02amaevisI have versions of ref, atom, and agent that are durable and observe the other guarantees.
23:03amaevisDurable refs are ACID, etc.
23:03amaevisI've got the Clojure primitives and the persistent data structures all set.
23:03amaevisThe only thing left are functions, especially closures.
23:04arohnertechnomancy: what function does C-c S-i map to for you? mine is unbound
23:04coldheadyou share your name with a wonderful logician and philosopher, alex miller
23:06amaevisI'm trying to capture the bytecode and serialize it. On deserialization, I need to transform the class to modify the name to ensure that there's no collision in canonical names.
23:06amaevisAnd make sure that references to other classes hold.
23:07amaevisHow does Terracotta handle that?
23:33jk_does anyone think that Oracle is going to cause trouble for Clojure or any of the other open source JVM based languages?
23:34dnolenjk_: i don't see how.
23:35jk_well... the only way I thought of it by going forward with future enhancements only on their pay-to-play JVM and trying to isolate and deprecate OpenJDK
23:36seancorfieldif an open source JVM becomes the norm, how can they control it?
23:37dnolenjk_: rhickey has said he's happy if the JVM changes slow down - that directly affects the surface that Clojure has to support for Java interop. Oracle doesn't seem that interested in the more interesting extensions anyway, tail call optimization and continuations
23:37jk_well they don't have to make the standardization tests available, like they did with Harmony. that would force them to diverge
23:39hiredmanI am sick of hearing about it
23:39jk_has anyone every talked about porting clojure to parrot?
23:39dnolenjk_: the JVM ecosystem has a long life ahead of it, Oracle or no. Plenty of time to get Clojure-in-Clojure well underway for people have irrational issues with the JVM.
23:40dnolenjk_: does parrot have anything remotely close the perf guarantees of the JVM?
23:40dnolens/close/close to
23:40sexpbot<dnolen> jk_: does parrot have anything remotely close to the perf guarantees of the JVM?
23:40jk_dnolen: i kind of agree... however i would be willing to bet that most clojure code today calls a lot of java
23:40hiredmanat no point has oracle said anything accept a. openjdk/hotspot and jrockit will be merged b. the resulting jdk plus oracle bells and whistles which no one accept people who are already paying oracle for them use will cost money
23:41jk_dnolen: i doubt it. i was just wondering if it was batted around at all, just to try
23:41hiredmanparrot is junk
23:41jk_hiredman: that's true about oracle but they made short work of opensolaris, for example
23:41hiredmanright
23:41hiredmanthey just came out and did it
23:42hiredmanwhich they haven't down with the jdk
23:42hiredmandone
23:42hiredmanin both cases they were very quick to let everyone know their plans
23:42danlarkinparrot really is junk (imnsho)
23:42hiredmanand the plans are different
23:42dnolenjk_: I haven't heard much interest in that. LLVM seems more interesting, if it's starting to work for Haskell I don't see why it can't work for Clojure eventually.
23:43jk_i don't know much at all about parrot except reading the web site. llvm, parrot, just some free vm
23:43jk_free meaning not owned by a large company that can mess with it
23:43hiredmanclojure's runtime is very thin and there is a big gap between where it stops and what the llvm provides
23:44hiredmanno
23:44hiredmanyou want a vm that is backed by a large company
23:44hiredmanto get any kind of decent performance
23:44dnolenhiredman: big emphasis on "eventually"
23:45jk_hiredman: yes, i understand the point. you just take the risk that they will do something stupid with the platform if you end up competing with that company's own offerings
23:46hiredmansun and oracle have invested a lot in hotspot and jrockit
23:47jk_Oracle might not really give a crap about anyone but the Fortune 500's buying their server side jvm though
23:48jk_the sun luminaries are abandoning oracle
23:48jk_because oracle doesn't listen to them
23:49danlarkinjk_: you've spoken to them, have you?
23:49hiredmanand nukes could fall on washington tomorrow
23:49jk_no i read their own words from interview
23:49jk_you can do the same
23:49jk_just google and read
23:49danlarkinI was trying on my curmudgeon hat
23:49hiredmanhttp://blogs.oracle.com/henrik/2010/11/oracles_jvm_strategy.html
23:49jk_it's a little lopsided :)
23:51dnolenjk_: in anycase, I don't think Clojurians care that much. The JVM is solid tech and it ain't going anywhere anytime soon. I mean many Java apps are stuck to JDK 1.5 (2004)! including Clojure.
23:51jk_hiredman: apache harmony was to the the open, *unencumbered* implementation with nothing proprietary in it.
23:51jk_oracle effectively ended that by pulling ibm along with them
23:52hiredmanjk_: *shrug* sun was ignoring harmony for many years before oracle came along
23:52technomancyclojurebot: oracle?
23:52clojurebotThe sky is falling!
23:52technomancy~botsnack
23:52clojurebotthanks; that was delicious. (nom nom nom)
23:52jk_lol
23:52hiredmansuddenly oracle buys sun, then sun did no wrong, poor sun that had the misfortune of not making enough money and having to be sold
23:53danlarkinabsolute worst case scenario is oracle discontinues all jvm development. So we're stuck with OpenJDK on java 6. When you think about it, that isn't actually all that bad
23:53jk_nobody believes sun did no wrong. sun was the one who was denying certification to apache
23:53hiredmanright
23:53jk_but ibm agreed to leave it because they will get more power in the jcp, supposedly
23:53hiredmanso really the situation has not changed on that front one bit
23:53jk_from what i read anyway
23:54hiredmanyou've asked ibm?
23:54technomancywhat's changed is patent aggression
23:54danlarkinI'm with hiredman, it's just a bunch of talking heads trying to earn their keep selling pageviews
23:54jk_i just see that as an isolation strategy by oracle. no, there were a lot of articles about just that
23:54technomancywith Sun in charge you could have forked openJDK without having to flee the US
23:54jk_danlarkin: that might be true, and i certainly hope it is
23:55hiredmandanlarkin: and spaming anything remotely interesting off of progreddit
23:55technomancybut forking openjdk was never really very appealing unless you were google anyway
23:55jk_i sure don't want anything to happen to diminish clojure, scala or any other such developments
23:55hiredmantechnomancy: well, apparently it didn't appeal to google either
23:56hiredmansince they didn't
23:56technomancyhiredman: exactly
23:56technomancybut they were the only ones who could have
23:56jk_google was playing a different game though. they didn't want to dump an entire jvm into a phone
23:56hiredmanI wish they had, then maybe you could get a phone with a real jvm on it
23:57seancorfieldi'm amazed at how much airplay this whole oracle/jvm thing gets... :(
23:57danlarkin640K of dalvik is enough for anyone
23:57jk_seancorfield: it's just that people are nervous about it
23:57seancorfield*some* people are nervous about it :)
23:57dnolenjk_: what people are nervous? Certainly not the millions of Java programmers.
23:57jk_seancorfield: right :)
23:58seancorfieldexactly dnolen
23:58jk_dnolen: java programmers by and large are just worried about not getting laid off :)
23:58dnolenjk_: point is who is nervous? Richard Stallman?
23:59jk_dnolen: google is your friend. i'm too lazy to do it for you right now. it's nothing new. it's talked about in the various java blogs and stack overflow, on the scala forums
23:59jk_etc
23:59dnolenpeople who iPhones and Androids should be nervous.