#clojure logs

2012-02-12

00:30jblomois there a lein plugin for running ant / build.xml tasks?
00:45clj_newbis there a way to tell clojure to not import _anything_ (not even core)? I want to build a DSL within clojure; and I don't want it getting conflicts w/ core functions all over the place
00:48jblomoclj_newb: I think you may be able to use (:refer-clojure :only ())
00:55clj_newbjblomo: interesting fix; thanks
00:55JohnnyLhave any of you gotten clojure to run processes in parallel on a multicore configuration?
00:56clj_newbclojure; by default, runs functions sent to agents, in separate threads, iirc
02:10amalloyamro, muhoo: "for isn't a recur target" glosses over some stuff that might be important
02:11amalloyfor expands to a lazy-seq and some function calls: you can't usefully recur to it, but you can't recur around/through it either, because it "gets in the way of" the actual recur target it's inside of
02:12amalloywhether for is a recur target isn't really relevant for muhoo's code, because loop is a recur target and you always recur to the inner-most "closest" point
03:35clj_newbwhat is the best way to get a java Graphics2D to output svg/vector graphics?
03:39tylergilliesi have a function that returns a vector and i want to pass the return value from that function to a different function that takes multiple arguments, but the second function is erroing telling me i only passed it one argument
03:40emezesketylergillies: I think you might want 'apply'
03:40emezeske,(apply + [1 2 3 4 5])
03:40clojurebot15
03:41emezeske,(+ [1 2 3 4 5])
03:41clojurebot#<ClassCastException java.lang.ClassCastException>
03:41tylergilliesemezeske: thnx
03:42tylergillieswoot that worked
03:42emezeske:)
03:43tylergilliesmessing around with java.security http://cl.ly/2Y3W1o1H2w0A163u2H1w
03:46emezesketylergillies: cool stuff
03:46emezesketylergillies: If you're gonna do a lot of java interop, you might like the thrush macro ->
03:47tylergilliesemezeske: where can i read up on that?
03:47tylergillieswith all the java libraries available why wouldn't everyone do tons of java interop?
03:48emezesketylergillies: the first answer on this thread is useful
03:48emezeskehttp://stackoverflow.com/questions/4579226/what-does-do-in-clojure
03:48tylergilliesemezeske: thnx
03:49emezesketylergillies: an example: http://pastebin.com/sCWJ9sV2
03:49emezesketylergillies: I didn't run that, so it might have bugs :P
03:49tylergilliesoh
03:49tylergilliesi know what that macro is
03:49tylergilliesjust forgot what it was called
03:49emezeskeI routinely forget what it's called.
03:53tylergilliesis there a way to import multiple classes without calling :import for each one?
04:48fliebelIs there any support for complex number in clojure/libraries? I only found something in old contrib that is both unfinished *and* outdated.
04:51romanandregquick question: do you know if you can do partial parsing of json using clojure.json?
04:51romanandregparsing json without having all the string to parse available?
04:54fliebelromanandreg: You mean like lazy xml, but for json? I don't think so, but it should be possible.
04:55romanandregfliebel: yes, exactly that, parse as data is available
04:55romanandregbut don't halt if there is not enough input
04:56fliebelromanandreg: That would only work if you interpret JSON arrays as lazy sequences.
04:59romanandregfliebel: thank you :-)
05:02talios'lo miclorb_
05:22fliebelOk, so generic functions are in new contrib, but complex numbers aren't
08:04fliebelWhat kind of latencies should I expect with Avout?
08:05fliebelThe default ticktime of 2000ms seems to indicate it's not really instantaneous.
08:36ldhI'm trying to play with irepl via "lein trampoline irepl", but am getting "java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected" (https://gist.github.com/1808500). any suggestions?
08:49fliebelldh: Some kind of version mismatch?
08:51ldhfliebel: i've had trouble with jline in the past (OS X here), solved by making sure only one jline jar is on the classpath (in /Library/Java/Extensions) IIRC
08:51ldhfliebel: not sure if/how that applies here
09:26chawksHi everybody. I am trying to use Noir to create a form with several checkboxes, however when I select more than one check box, I only receive the last selection... any ideas?
11:34apwalkchawks: I've not done this with Noir, or clojure, but ensure that the html groups the checkboxes by specifying the same name, and makes them an array, e.g. name="choices[]"
11:56chawksHi apwalk, that worked, thanks :)
12:22muhoohey, holy crap. refs are pointers!
12:22muhooi can write c in clojure :_)
12:24muhooneat. thread-safe, concurrency-aware pointers.
12:35gf3c in clojure on the JVM
12:35gf3AMAZING
12:37the-kennySo, who wants to drive a Delorean Monster Truck? https://machinegestalt.posterous.com/if-programming-languages-were-cars
13:06muhooi kind of suspected taht, when reading about structural sharing, i thought, hmm, sounds like pointers in c, but without the segfaults.
13:09muhoothe-kenny: that's fantastic. lol purple bat van
13:27jjcomerDoes anyone know how I specify attributes (other than id and class) in hiccup?
13:29Scriptorjjcomer: just specify them in the map in the 2nd argument?
13:33jjcomerScriptor: that worked!
13:33jjcomerthanks
13:33Scriptorno prob!
14:32fliebelHow can I dispatch on a number in multimethods?
14:33alex_baranosky(fn [n] (if (= n 5) :five :othernums))
14:33TimMcfliebel: Dispatch in multimethods is all based on 'isa? -- read the docs on that function.
14:33TimMcIt's not self-evident.
14:34fliebelTimMc: Right, so either all numbers need to have a common ancestor, or I need to derive them.
14:34TimMcfliebel: No, read the doc again.
14:34TimMc&(doc isa?)
14:34lazybot⇒ "([child parent] [h child parent]); Returns true if (= child parent), or child is directly or indirectly derived from parent, either via a Java type inheritance relationship or a relationship established via derive. h must be a hierarchy obtained from make-hierarchy,... https://refheap.com/paste/718
14:34TimMcvery first clause
14:35fliebel"Returns true if (= child parent)"?
14:35TimMcyeah
14:35TimMc&(isa? 5 5)
14:35lazybot⇒ true
14:36TimMc&(isa? (class 5) Number)
14:36lazybot⇒ true
14:36fliebel&Numer
14:36lazybotjava.lang.RuntimeException: Unable to resolve symbol: Numer in this context
14:36fliebel&Number
14:36lazybot⇒ java.lang.Number
14:36fliebelaha
14:37TimMcI didn't understand multimethods at all until I had that explained to me. :-)
14:37fliebelTimMc: I did understand that, I was just looking for what turned out to be called -- very logically in hindsight -- java.lang.Number.
14:38fliebel&(bases (class 1))
14:38lazybot⇒ (java.lang.Number java.lang.Comparable)
14:38fliebelThanks though.
14:44TimMcOh, hah! OK.
14:44TimMcfliebel: ##(ancestors (class 5))
14:44lazybot⇒ #{java.lang.Object java.io.Serializable java.lang.Comparable java.lang.Number}
14:45TimMcI thought you were trying to dispatch on a specific numeric value.
14:49tmciverTimMc: Really? But how does isa? help dispatch on a particular value?
14:49tmciverTimMc: I'm looking at the defproxy branch of the import stuff, by the way.
14:49TimMc&(isa? 5 5)
14:49lazybot⇒ true
14:50tmciverTimMc: But the dispatch function doesn't have to involve types, right? The dispatch function could have been (= 5 5), true?
14:51TimMcAh, well, there are two components to the dispatch.
14:51tmciverTimMc: I admit, that would be a limited way to implement multi-methods on particular values, I think.
14:51FrozenlockNooo! Y u no working! I restarted my machine and now I can't get clojure-jack-in to work. :(
14:52TimMctmciver: You could dispatch on #(mod 4 %) and have multimethods for 0, 1, 2, and 3.
14:52TimMcIt's pretty flexible.
14:52FrozenlockDoes "error in process filter: Symbol's function definition is void: define-slime-contrib" rings a bell for someone?
14:53tmciverFrozenlock: I occasionally get an error like that - usually after I kill slime/swank and try to clojure-jack-in again. I just restart emacs.
14:54FrozenlockHmmm.. I'll try that then, thanks
14:57rhallis there any real difference between these two forms of def: (defn func-name [args] (body ...)) and (defn func-name ([args] (body ...))) ?
14:57rhallI see them both used but I've never seen anyone discuss this
14:57rhallie, parens wrapping the args
14:57RaynesThe latter is typically used when there are multiple arities.
14:57TimMcrhall: The second allows you to define multiple arities.
14:57rhallah, of course
14:58Raynes(defn foo ([x] (foo x 0)) ([x y] (+ x y)))
14:58TimMcYou only get one docstring for the whole thing, of course.
14:58RaynesTimMc: Go away. I'm busy teaching.
14:58alex_baranoskyusually you wouldn't use the second, unless you had multiple arity definitions
14:58TimMchaha
14:58Raynes;)
14:58rhallcool... thx
14:58Raynesalex_baranosky: I don't think he understood that yet, thanks. ;)
14:59RaynesIn all seriousness, isn't it awesome that everybody fights to answer questions?
14:59RaynesMust be doing something right.
14:59alex_baranoskyRaynes: I'm slow over here. too be programming
14:59rhallit's great the quick responses you get here
15:00RaynesTimMc: In other news, I'm biting the Enlive bullet. Working on moving RefHeap to it. Has been pretty painful so far, but I'm dealing.
15:00FrozenlockGrrr, I close Emacs for nothing, still not working :(
15:01RaynesActually, it wasn't really enlive that was painful. For some reason my layout became different when it was expressed using the precise same HTML, only formatted well. Since hiccup doesn't format HTML, I never noticed. It was extremely frustrating figuring that one out.
15:01FrozenlockIs is possible my previously installed Slime (for CL) clashes with clojure's own slime?
15:03TimMcRaynes: Weird.
15:04TimMcWhy are you moving to enlive, anyway?
15:04RaynesTimMc: Yeah, I went as far as to actually diff the HTML. :P
15:04RaynesBecause it seems like a cleaner solution than the gobs and chunks of vectorcream that is RefHeap right now.
15:05RaynesI'm fine with hiccup, but messy is messy and RefHeap is getting messy.
15:05TimMc*nod*
15:05TimMc(Haven't seen the source, but I know the feeling.)
15:06RaynesThe reason I gave you shit about tryclojure was just because it was pretty small.
15:06RaynesI probably would have agreed with you if it got bigger.
15:07RaynesI'm not sure if Enlive is the best solution here, but everybody seems to like it. I'm mostly worried about how much overhead this adds to people wanting to contribute to the sit.e
15:07Raynessite.*
15:08RaynesEnlive is pretty complicated, and I really like how easy 4Clojure is to contribute to. I'm not sure RefHeap will be able to serve a similar purpose under Enlive, but we'll see.
15:08brehautRaynes: so you had some success?
15:09Raynesbrehaut: Well, I've got one file converted after only 6 hours.
15:10RaynesBut that was because of the formatting bu...
15:10RaynesOh you weren't here.
15:10Raynesbrehaut: Let me get you some logs.
15:10brehautcheers
15:10Raynesbrehaut: https://refheap.com/paste/719
15:14brehautRaynes: re:contribution, i tihnk enlive is less intimidating if you have someone elses working code to get started with
15:14TimMcabsolutely
15:15Raynesbrehaut: Fair enough.
15:16Raynesbrehaut: Now, go finish this conversion to enlive.
15:22scottjFrozenlock: yes. swank-clojure doesn't work with recent versions of slime.
15:23FrozenlockThat's really unfortunate...
15:23romain_p_Hi, can someone help with the following korma error: http://pastie.org/3369281
15:24RaynesFrozenlock: That is mostly the fault of the SLIME developers though, for never releasing anything.
15:24scottjFrozenlock: I use slime from 2009-10-15 and it works fine with clojure and CL
15:24FrozenlockYeah, simply installing it for CL was quite an epic adventure
15:25Frozenlock"Oh you took it from ELPA? No you should take it from X place instead"
15:28FrozenlockWhat is the command to download and install swank with leiningen?
15:30compjmaybe: lein plugin install swank-plugin 1.4.0
15:30compjsorry
15:30compjswank-clojure
15:30compjnot swank-plugin
15:31puchaczguys, for installing CL and all libraries you need (including slime) I suggest quicklisp
15:31puchaczit is much better than it used to be few years back
15:31scottjit didn't exist a few years back :)
15:31puchaczi.e. than before quicklisp arrived
15:31scottjoh that it :)
15:31compjdoes cvs slime work with clojure?
15:32scottjcompj: no
15:32osa1how can I implement clojure.lang.IFn in my records with arbitrary number of parameters? I've tried (invoke [a & rest] ...) but doesn't seem working(I'm getting AbstractMethodError)
15:33puchaczoh, I see I would have to take a week holiday at least if I wanted to evaluate clojure..... slime does not work, ouch
15:33pmooserAnyone using a current version of clojure-mode ? I'm getting errors because it is referencing a tramp-related function that isn't defined in slime.
15:33scottjpuchacz: slime works, just not cvs version
15:33puchaczah, ok
15:33pmooserSpecifically, 'slime-tramp-local-filename'
15:34TimMcosa1: Well, you're going to have to implement all 22 overloads of invoke.
15:34scottjpmooser: ;;; clojure mode has no business messing up slime for CL
15:34scottj(remove-hook 'slime-connected-hook 'clojure-slime-remote-file-name-hook)
15:34osa1TimMc: whoa!
15:34TimMcAre you sure you're up for that? :-)
15:34osa1TimMc: not if you're sure it's the only way
15:35TimMcIt's not.
15:35osa1TimMc: maybe I can write a macro to do that for me
15:35osa1TimMc: oh, what are other ways then?
15:35TimMcAFn is a helpful adapter, but you're not going to be able to use it in defrecord, deftype, or reify since it is a concrete (albeit abstract) class.
15:36TimMcYour best bet is proxy.
15:36pmooserscottj - you're awesome. Things like this seem to happen a lot.
15:36TimMcosa1: The larger question is... are you sure this is what you really want to do in the first place?
15:36pmooserIt doesn't help of course that I can't use the 'standard' ways of setting this stuff up (jack-in), so I run into these issues often.
15:36scottjpmooser: just try not to update stuff if it's working :)
15:37pmooserscott, I was trying to upgrade to swank-1.4.0 so I could give CDT a try, and an update of clojure-mode seemed to be required.
15:37osa1TimMc: actually I'm not. I just want to know if there's a way to do that. I'm in the learning phase.
15:37scottjpmooser: I recommend ritz
15:37TimMcosa1: You;d have to have a pretty compelling reason to do it.
15:38FrozenlockAh damnit! I broke everything!
15:38pmooserscottj: I've been looking at it … it's never been clear to me exactly what state it is in.
15:38FrozenlockTime to delete all and start over.
15:38pmooserFor me to use it I have to figure out how to launch the ritz swank thread from within my app (again, I can't use lein or cake or whatever),
15:38pmooserbut I looked at the lein plugin for ritz earlier and it didn't look that hard.
15:39TimMcscottj: I took me sooooo long to learn not to upgrade things compulsively.
15:40scottjTimMc: I'm getting better at that. I love ubuntu LTS but will probably go to debian stable next time since 3 years is more upgrading than I like :)
15:40TimMcyep
15:40pmooserscottj: Do you find that ritz works better thank swank-clojure in general?
15:41scottjpmooser: I haven't done this but if your emacs configs including slime were in git then you could create a branch called trying-out-cdt and mostly get back if it didn't work
15:41Raynesscottj: Next LTS will be 5 years.
15:41TimMcRaynes: Now, if only they actually *supported* it...
15:41scottjRaynes: ahh, mark must want to keep me :)
15:41pmooserscottj: Sure, they are - I was just interested in not having to downgrade my clojure-mode.el to the previous version if possible, and you kindly helped me make the necessary config changes.
15:42scottjpmooser: ritz fixes several annoying things like it will show you line numbers of errors for things evaluated in the repl
15:42RaynesTimMc: Ubuntu is an ill-conceived weak-ass piece of shit anyway, so...
15:42TimMcheh, do you have that memorized by now?
15:42RaynesNo, I actually had to google this time.
15:42RaynesGoogle "timmc browserid piece of shit"
15:42RaynesFirst hit.
15:43TimMcniiice
15:43Raynes$google timmc browserid piece of shit
15:43scottjpmooser: I like the debugger stepping UI in ritz. I haven't used it a lot though
15:43Raynes$kill
15:43lazybotKILL IT WITH FIRE!
15:43RaynesHm.
15:43TimMchaha
15:43RaynesHe refuses to google you.
15:44pmooserscottj: I'll see if I can integrate it with my setup at work. It's going to be interesting to see how it reacts to ritz's need to spawn and extra JVM process.
15:45scottjpmooser: btw ritz uses a different version of slime than swank-clojure :)
15:45pmooserMy development setup is (unfortunately) not exactly typical, in that I run my own swank-server listening on a thread in an app that is mostly written in Java.
15:45pmooserscottj: Yeah, I'll have to carefully archive everything off before I start playing with ritz too much.
15:45pmooserAll my configs are in git, but all of my ~/.emacs.d stuff is not.
15:48pmooserscottj: Thanks again for all the help. I really appreciate it.
15:48pmooserHope to meet some of you folks at clojure/west!
16:12Frozenlock1 required artifact is missing.
16:12Frozenlockfor artifact:
16:12Frozenlock org.apache.maven:super-pom:jar:2.0
16:13FrozenlockI was thinking that by starting everything over it would work... :(
16:16muhooclojure.contrib. batteries not included anymore :-)
16:19muhooalso, google is fun: http://www.google.com/search?q=browser+piece+of+shit&amp;btnG=Search
16:28muhoook, fail. pomegranate is installed, but this dies:
16:28clojurebotRoger.
16:28muhoo(add-dependencies "org.clojure/data.json" "0.1.2")
16:28muhooIllegalArgumentException No value supplied for key: 0.1.2 clojure.lang.PersistentHashMap.createWithCheck (PersistentHashMap.java:89)
16:29muhooalso, this fails too: (add-dependencies 'org.clojure/data.json "0.1.2")
16:29Bronsai think it should be (add-dependencies [['org.clojure/data.json "0.1.2"]])
16:30muhooah, thanks
16:30muhooalso, i notice that noir doesn't use the official clojure data.json
16:30muhooit uses clj-json. why?
16:30nollidji'm looking at the clojure source. does anyone know what the &form and &env mean in (fn defn [&form &env name & fdecl] ...)?
16:30FrozenlockYesss! It works! Now nobody move! Don't even breathe!
16:31muhooFrozenlock: that's how i feel about most of the stuff i write :-/
16:32FrozenlockAwww you broke it!
16:32muhoohopefully, once i start writing production stuff in clojure, i won't feel like it's so fragile.
16:32Frozenlock:P
16:32Bronsanollidj: defn is a macro
16:32Bronsain a macro the first two args are &form and &env
16:32nollidjah, ok. thanks
16:32Bronsathose are passed by the compiler i think
16:33nollidji was wondering where they came from. defn is defined by a literal def instead of defmacro, so i guess that's why it's there
16:33Bronsayeah
16:33Bronsaif you look a t defmacro source you can see
16:33Bronsa add-implicit-args (fn [fd]
16:33Bronsa (let [args (first fd)]
16:33Bronsa (cons (vec (cons '&form (cons '&env args))) (next fd))))
16:34nollidjah, i see
16:36muhoobe afraid. a moron (me) has discovered the threading macro.
16:36muhoo(-> 'clojure.data.json ns-publics keys)
16:36muhoomuaahahaha
16:49muhooi need a cigarette now (-> "http://localhost/testserver/somebs?stuff=whatevs&quot; slurp read-json pprint-json)
16:50RaynesHahaha
16:50RaynesI've got an electronic one lying around here somewhere...
16:51muhooit's like unix pipes, but in a real language (not bash)
16:51brehautmuhoo: modulo multiprocess stuff
16:51Raynesbrehaut: Conch!
16:52brehautRaynes: or threads and LinkedBlockingQueues ;)
16:52muhooand tons of other stuff, including whatever java libs exist
16:52muhooyep, well consider this one happy newb.
16:52brehautim tempted to try to write a terrible facsimile of erlangs processors / mailboxes using PriorityBlockingQueue and core.match for fun
17:04RaynesTimMc: http://c.images.memegenerator.net/instances/500x/14493242.jpg
17:05rahcolaam I right to say, that there is no equivalent for letrec in clojure?
17:06bbloomletfn ?
17:08rahcolawhat if you have a function and a other value, mutually dependand?
17:08rahcolalike you have a function f that you map over a sequence s
17:09rahcolabut f accesses s
17:11radsin that case couldn't you just put s before f and all would be good? I think I'm missing something here
17:11raekrahcola: lazy-seqs can be mutually recursive
17:12bbloomrahcola: pretend you have letrec, paste the form you're trying to achieve
17:12lpetit(let [s (some-seq), f (fn […] … s …), v (map f s)] …)
17:12raek(declare foo-seq bar-seq) (defn foo-seq [] (lazy-seq (cons 0 (bar-seq)))) (defn bar-seq [] (lazy-seq (cons 1 (foo-seq))))
17:13muhoohow would i do this with destructuring, to get two keys out of this
17:13muhoo&(let [f [{:a 1, :b 2, :c 9}, {:a 3, :b 4, :c 10}]] (for [i f] [(:a i) (:b i)]))
17:13lazybot⇒ ([1 2] [3 4])
17:13muhoothe [(:a i) (:b i)] seems unidiomatic to me
17:14raek(map (juxt :a :b) f)
17:15rahcolarads: should have been more clear, s would be created by mapping f over it :)
17:15raekmuhoo: with destructuring: (for [{:keys [a b]} f] [a b])
17:15muhooraek: that's mildly insane, but i lov eit.
17:15rahcolasomething like: (letrec [s (cons 0 (map f (range 1 10))) f (fn [i] (+ i (nth s (dec i))))] (do-something s))
17:15muhoothanks
17:16TimMcmuhoo: data.json is probably slower than clj-json
17:19muhoooh, thanks.
17:20muhoowow, now i need a towel: (map (juxt :display_name :display_photo) (:responses bar))
17:21RaynesCalm down.
17:21muhoohehe
17:22muhooyou have to understand. the languages i've been using for work have been PHP and Java.
17:22muhoocoming to this from that, it's , well, i don't kno quite how to describe it exactly.
17:22Raynesamalloy too comes from that world.
17:23RaynesHe is nuts for juxt, obviously, but he doesn't very often need a towel.
17:23amalloya lot of clojure users do
17:24TimMcPerspiration, clearly. >_>
17:24muhooit's hard work, this coding.
17:28TimMcmuhoo: ##(map #(select-keys % #{:a :c}) [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6}])
17:28TimMc$ping
17:28lazybot⇒ ({:c 3, :a 1} {:c 6, :a 4})
17:28lazybotTimMc: Ping completed in 0 seconds.
17:28amalloyTimMc: the $ping command doesn't do anything, last i checked
17:28TimMcmuhoo: ^ if you still want the key-value relationships
17:28muhooooh, neat, thanks
17:28TimMcamalloy: I just wanted a response and thought $ping might do something.
17:28amalloyah. $kill was written for exactly that purpose
17:28amalloythough personally i just do &1
17:29Raynes$kill
17:29lazybotKILL IT WITH FIRE!
17:29RaynesActually, kill wasn't written for that purpose at all.
17:30RaynesI use it because it's the only command I can reliably remember that does nothing but print a message.
17:30RaynesI added it for testing the bot in the early stages.
17:32amalloysphinxure? really?
17:33Raynes._.
17:33Raynes$google sphinxure clojure
17:33RaynesYeah, google hasn't been working all day.
17:34muhooTimMc: why would i use a set instead of (map #(select-keys % [:a :c]) f) ?
17:34Raynes$google sphinxure clojure
17:34Raynesamalloy: So, I haven't touched that code in a year and it is broken.
17:34TimMc(map #(select-keys % [:a :c]) [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6}])
17:34TimMc&(map #(select-keys % [:a :c]) [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6}])
17:34lazybot⇒ ({:c 3, :a 1} {:c 6, :a 4})
17:35Raynes~google foo bar
17:35clojurebotFirst, out of 1900000 results is:
17:35clojurebotfoobar2000
17:35clojurebothttp://www.foobar2000.org/
17:35RaynesSo obviously the API still works...
17:35TimMcmuhoo: *shrug* It just seems like the appropriate semantics.
17:36muhoocool, thanks
17:36Rayneshttps://refheap.com/paste/721
17:36RaynesI'll give anybody, including amalloy, 1 dollar to fix that bug in the next two hours.
17:38RaynesHint: handle-search in lazybot/plugins/google.clj is giving nil to URLDecoder/decode. Go find out why.
17:40aphyrHow can I test a private function?
17:41alex_baranoskyreference it as #'function
17:41alex_baranoskyI think...
17:41Raynesaphyr: You can access the var.
17:41Raynes#'some.namespace/someprivatevar.
17:42alex_baranoskyor use the newest version of midje and call (expose-testables my.namespace.foo) , while marking that priate function with ^:testable
17:42alex_baranoskythat's not deployed to clojars yet however
17:42aphyrRaynes: Ah, excellent.
17:43aphyrI was mucking around with ns-resolve... that's exactly what I needed.
17:43Raynesalex_baranosky: You forgot </shamelessplug>
17:43Raynes:P
17:44Raynesalex_baranosky: I have a new library with like three tests. Go rewrite them with Midje.
17:44Rayneshttps://github.com/Raynes/bultitude
17:44alex_baranoskyRaynes lol
17:45alex_baranoskyLet me put that on my todo list right after....... nothing
17:45Raynes:p
17:45RaynesYou seem to get off on fixing my tests and stuff, so I figured...
17:45muhooRaynes: is this in the string library somewhere? https://refheap.com/paste/720
17:45alex_baranoskybultitude is hard to say
17:46RaynesSee my note in the README about the name.
17:46amalloyclojure.string/join is the second half
17:46Raynesmuhoo: Nope. It can also be better expressed as (clojure.string/join " " (.split #"\s+" s))
17:46Raynesamalloy: It's an ancient snippet from lazybot's title plugin.
17:46Raynes:P
17:47RaynesRemember when I hated you and join?
17:47amalloyhaha. the number of interpose/str fixes i've applied to that code already...
17:47RaynesYeah. We used to give each other so much shit over that.
17:48aphyrHuh. What's the correct style? join or apply str interpose?
17:48Raynesjoin, for the most part.
17:48amalloyjoin in every instance ever
17:48aphyrGot it.
17:49RaynesI still tend to use (apply str (interpose " ")) in isolated cases where there is no real reason to bring in clojure.string. Basically, when I'm too lazy to add the require.
17:49RaynesMore than one of those = use join or die.
17:54TimMcRaynes: Did you switch JSON libs recently with lazybot?
18:00muhoohm, https://refheap.com/paste/724
18:00muhoowaz that mean?
18:01TimMcmuhoo: That means you have an older clj-json, I think.
18:01muhooolder than what, specifically?
18:01muhooit's 0.5.0, from clojars
18:01TimMcthan the most recent
18:01muhoohttp://clojars.org/clj-json
18:02muhoomost recent says 0.5.0, via that site
18:02TimMcOh, maybe the commit that makes it compatible with 1.3 hasn't been released yet.
18:02TimMcAnyway, I just switched to using cheshire because of that.
18:03muhooodd. 0.4.3 is what noir requires, and it works fine with 1.3
18:04muhooheh, but 0.4.3 works fine . so i had a TOO recent version, apparently.
18:04TimMcWeird!
18:04muhoowell, no, maybe it's not reimporting it
18:05TimMcA regression, perhaps?
18:06muhooi suppose if i'm ogin to be using noir, and it already has 0.4.3 , then there's no sense in my importing some other json library really
18:08RaynesTimMc: Not recently, no.
18:08TimMc(My internet was being terrible, so I couldn't check for myself.)
18:08RaynesI switched it a while back, but the google plugin was working afterwards.
18:08RaynesIt only stopped working today.
18:09aphyrAny recommendation for what file logger I should use? I'm not familiar with java logging.
18:09devnis there anything a bit more xpathy for parsed html in clojure?
18:12TimMcRaynes: Overlimit?
18:12RaynesAn API limit? I don't know of one.
18:13RaynesAnd that'd be a pretty cool trick unless someone has spammed him with google commands.
18:13TimMc>_>
18:13TimMc<_<
18:15alex_baranoskydevn, this isn't XPATHy really but you might check it out anyway: https://github.com/antoniogarrote/apricot-soup
18:15muhoois there a way to get a seq of all the namespaces that are loaded? i'm looking at clojure.tools.namespace and it doesn't seem to have that
18:16amalloy,(loaded-libs)
18:16clojurebot#{clojure.java.io clojure.repl}
18:16muhooamalloy: thanks!
18:16TimMc&(loaded-libs) ; comparing...
18:16lazybot⇒ #{cd-client.core cheshire.core cheshire.factory cheshire.generate cheshire.parse clj-config.core clj-http.client clj-http.cookies clj-http.core clj-http.util clj-time.core clj-time.format clojail.core clojail.jvm clojail.testers clojure.contrib.zip-filter clojure.con... https://refheap.com/paste/725
18:17muhootwo bots, no waiting.
18:17muhooif the line gets more than 3 people deep, they open another bot.
18:21Raynesamalloy: I've got another lazybot bug for you. If you dec someone's karma to 0 and then try to inc it, lazybot thinks you're asking it to leave karma the same.
18:21Raynes$karma foo
18:21lazybotfoo has karma 0.
18:21Raynes(inc foo)
18:21lazybot⇒ 1
18:21Raynes(dec foo)
18:21lazybot⇒ 0
18:21Raynes(inc foo)
18:21lazybot⇒ 1
18:21Rayneswut
18:22amalloycool story
18:22RaynesI swea… T…
18:22tmciverHa!
18:22amalloyyou sweat? go get a towel
18:22Raynesamalloy: https://refheap.com/paste/726
18:23tmcivernot again!
18:23muhoothat's really odd, noir supposedly requires clj-json, but if i do loaded-libs, it doesn't show it.
18:23Raynesmuhoo: Proptip: use noir 1.3.0 alphas.
18:23amalloyRaynes: that looks like the "only three operations at a time" restriction
18:23Raynesmuhoo: They use cheshire.
18:23muhoowait, what?
18:23Raynesamalloy: But then the error is wrong.
18:23muhoono, i'm looking at the project.clj, and it says clj-json
18:23amalloyor no, because it was different people anyway
18:24muhooplus the source code has specific references to it
18:24Raynes(dec foo)
18:24lazybotDo I smell abuse? Wait a while before modifying that person's karma again.
18:24amalloylazybot: no, but you smell abused. does he not let you go outside?
18:25Raynes(inc redhat)
18:25lazybotYou want me to leave karma the same? Fine, I will.
18:25Raynesamalloy: This was done on a whole different network. Why is it broken here too?
18:25RaynesThe sky is falling, bro.
18:25muhooRaynes: i've got noir 1.2.2
18:26Raynesmuhoo: UPGRADE TIME
18:26muhoo*sigh*
18:26Rayneshttp://clojars.org/noir alpha9!
18:26Raynesmuhoo: Do you use flash sessions?
18:26muhooRaynes: this is from git
18:26RaynesIf so, they're broken now.
18:26RaynesWell, your usage of them is broken.
18:26muhoocommit f62e7e5e2045a53cf6980dc1ad0491b94b7ec92f
18:26TimMcRaynes: How can that "leave karma the same" error message even exist?
18:26RaynesWe rewrote how they work in 1.3.0.
18:26RaynesTimMc: That's a good question bro.
18:27muhooflash sessions? i don't use flash. adobe can bite me. :-)
18:27RaynesNot that kind of flash.
18:27amalloypart of the soon-to-be-unveiled lazybot-noop plugin, TimMc
18:27RaynesBut if you don't know what I'm talking about, you can probably upgrade to 1.3.0 cleanly.
18:28Raynesamalloy: Have you deployed 4clojure-pasting-to-refheap yet?
18:28muhoook, i'll try. really, i figured if i git clone something off of github, i'm getting the most recent version.
18:28Raynesmuhoo: Not if you aren't using the 1.3 branch.
18:28muhoofair enough, and easy enough to fix too.
18:29RaynesI encourage usage of alpha software.
18:29TimMcRaynes: So people can find your bugs?
18:29muhooi generally stay away from alpha software
18:29alex_baranoskyTimMc, exactly!
18:29muhoowhatever was stable 2 years ago, is just fine now.
18:29RaynesI use macosecks
18:29TimMcRaynes: The question is, do *you* use alpha software?
18:30alex_baranoskyit really dependes on the software in question
18:30muhooi generally use production stable. that's how i roll.
18:30RaynesTimMc: I'm currently using Leiningen master, Emacs 24, macvim from homebrew, Textual for IRC from the unstable git branch...
18:30alex_baranoskyI don't think non-alpha Midje releases are way less stable than non-alphas
18:30muhooi got enough bugs of my own, i don't need anyone else's.
18:31alex_baranoskyit depends how much you want to use new features that aren't available yet
18:31RaynesAnd the chrome beta release channel
18:31RaynesI would use canary but I'm too lazy.
18:31muhooa friend called me "technologically Amish".
18:32RaynesI don't have friends who aren't infants.
18:32RaynesAlpha humans.
18:32muhoogenerally that's why i'm discovering clojure now. when it first came out, i figured, "nah, i'll wait for the bugs to shake out first"
18:32RaynesWhatever you do, don't use ClojureScript.
18:32RaynesYour head will explode.
18:33duck1123How do I get the namespace from a var?
18:33RaynesWait, you're just now getting into Clojure and you're already using RefHeap as your primary pastebin?
18:33muhooi know. i love the idea of clojurescript, but i can tell i've got a few years before i get to play with it.
18:33RaynesYou and I are going to be very good friends.
18:33amalloy&(meta #'inc)
18:33lazybot⇒ {:ns #<Namespace clojure.core>, :name inc, :file "clojure/core.clj", :line 857, :arglists ([x]), :added "1.2", :inline #<core$inc__inliner clojure.core$inc__inliner@198f833>, :doc "Returns a number one greater than num. Does not auto-promote\n longs, will throw on overflow. See also: inc'"}
18:34Raynes&(-> #'inc meta :ns str)
18:34lazybot⇒ "clojure.core"
18:34muhooRaynes: refheap is the first pastebin i found that had an emacs client.
18:34duck1123in the meta... I was thinking there was a fn that would give it, thanks
18:34Raynesduck1123: ^ minus str if you just want the ns object.
18:34muhoomaybe others do, but i didn't know abou tthem.
18:34Raynesmuhoo: Every single pastebin ever has an emacs client. :|
18:34amalloyRaynes: ns-name, not str
18:34RaynesBut by all means, keep using refheap.
18:34Raynesamalloy: Piss off.
18:35Raynes&(doc ns-name)
18:35lazybot⇒ "([ns]); Returns the name of the namespace, a symbol."
18:35amalloywrite me an emacs client for pissing off and i'll consider it
18:35amalloy(yes, i agree it's absurd there's a separate function - namespaces should just be Named
18:35amalloy)
18:35duck1123agree
18:36Raynesamalloy: (defun piss-off () (message "Piss off, amalloy"))
18:36RaynesDOne.
18:36amalloythere was some discussion of it on the mailing list a while ago, duck1123, but as usual nothing came of it
18:36muhooit's gettin' real in #clojurre
18:36Raynesamalloy: Want some keybindings too?
18:37muhoook back to my confusion here. this is what's loaded. no clj-json https://refheap.com/paste/727
18:37Raynesmuhoo: How did you get that list?
18:38muhoo(seq (loaded-libs))
18:38RaynesIs this on the 1.3 branch of noir?
18:38muhoo[noir "1.2.2"]
18:38muhoosorry, actually 1.2.1
18:38RaynesNoir wont load that namespace until you require noir.response
18:39muhooaha, ok, that makes sense
18:39muhooWarning: *coercions* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *coercions* or change the name.
18:39muhoobecause there's the error message clj-json spews out
18:39RaynesThat's not an error.
18:39Raynes1.3 uses cheshire which doesn't have that warning.
18:40amalloywell, it's a warning about an error that will occur later
18:40muhooi see. ok. now it makes sense why you'd recommend 1.3
18:40RaynesYou know, I think I'm an asshole for turning people away from clj-json, since a co-worker (I think) maintain sit.
18:40Raynesamalloy: An error that never actually does occur.
18:40RaynesPretty sure it is never ever rebound.
18:40cindy1986Okay, restart after dist-upgrade
18:40amalloyRaynes: it can occur. *coercions* is intended to be rebound
18:41RaynesI don't think so.
18:41RaynesAt least, unless the client rebinds it.
18:41cindy1986mhh grub2
18:41amalloysince i maintain it with lancepantz, i am confident in telling you you're wrong
18:41amalloyyes, the client is intended to rebind it
18:41RaynesWell, you didn't bother telling me why.
18:41Raynes"Yes it does. U R rong." wasn't particularly helpful in my understanding.
18:42amalloy*coercions* is pretty gross though
18:42RaynesIn this case, why do you guys bother maintaining clj-json when cheshire is maintained just fine by someone else and is just as fast?
18:42amalloyi dunno
18:42amalloythat's lance and justin's decision
18:42RaynesTell Lance to talk to me about it.
18:42RaynesJustin told me to talk to Lance about it.
18:43amalloyactually it might be because of *coercions*
18:43RaynesBut I can never get Lance to actually sit at his keyboard long enough to have a meaningful discussion.
18:43amalloywe use it to make clj-json encode sets as json arrays
18:43RaynesMaybe you can convince him to.
18:43Raynes:p
18:43muhoogentlemen, i really didn't want to start a dispute over something as mundane as json libraries.
18:44RaynesWe aren't disputing. Just wondering what would need to be done to stop maintaining a library.
18:44RaynesIf we can use cheshire without major modifications, we might as well.
18:44RaynesI can probably add whatever is necessary if anything is necessary.
18:45RaynesOr dakrone would if we asked, I'm sure. He basically does whatever I tell him to.
18:45Raynesdakrone: sudo make me a sandwich
18:47amalloylet's fork off into three disputes: json, whether we were disputing, and whether there are gentlemen present
18:48Scriptorquick question, on windows 7 where does the emacs starter kit go?
18:48RaynesOn your Linux partition.
18:48Raynes~rimshot
18:48clojurebotBadum, *tish*
18:48muhoohttp://www.youtube.com/watch?v=kQFKtI6gn9Y
18:49TimMcScriptor: ~/
18:50mrBlissScriptor: WIN+R %APPDATA% RET
18:51TimMcoh, right
18:53Scriptorhmm, that's the place I used
20:40codeforkjeffjust upgraded to latest clojure-mode from technomancy. now when i do clojure-jack-in, i get errors in emacs and can't edit the file: "Symbol's function definition is void: slime-tramp-local-filename" anyone else seen this?
20:40codeforkjeffi'm editing a local file, not using tramp at all
21:31aphyrIs there a sane way to log to a file?
21:31TimMcaphyr: where log4j is insane? :-P
21:31aphyrI'm like 3 hours and hundreds of pages into java logging and clojure.tools.logging and getting ready to write my own damn logger
21:32aphyrI just want to say (set-log-file "foo.log"), and have my log messages go there.
21:32aphyrInstead there's this fucking configurator bullshit and XML and property files and nested domain contexts
21:32TimMcWrite your own logger. You can always sub in something horrible later. :-)
21:32beffbernardaphyr: Which framework are you using?
21:33aphyrI'll use whatever gets the job done
21:33TimMcI bet there's a Clojure lib for this, actually...
21:33aphyrRight now just clojure.tools.logging
21:33beffbernardtools.logging?
21:33aphyrI guess it split off from contrib.logging...?
21:34TimMcIt moved.
21:34aphyrI mucked around with clj-logging-config but it doesn't seem to actually set the filename anywhere. I can't figure out how to make a RollingFileAppender happy, either.
21:34beffbernardjust add log4j, or any slf4j package in your project.cljj
21:34beffbernardthen make sure the config files are in your classpath
21:34TimMc"just add log4j", he says
21:34aphyrI don't want to use a config file though
21:34beffbernard:)
21:35TimMcI don't think anything to do with log4j is ever simple.
21:35aphyrI need to be able to set the log file from a fn call
21:35TimMcIt is very inflexible at runtime.
21:35aphyrI could do the fucking file IO and synchronization myself in like 20 lines...
21:35aphyrI don't know why this should be so hard, haha
21:35TimMcaphyr: send messages to an agent
21:35beffbernardperformance, rolling logs, etc
21:36aphyrYeah, performance would be nice
21:36aphyrI understand that log4j is super fast, which sounds great...
21:37aphyrIt's not clear to me how clojure.tools.logging chooses *which* logger to use
21:37aphyrlog4j seems to have this whole heirarchy of named loggers
21:41beffbernardYeah, I"m curious myself. I'm just looking into the code ATM
21:51beffbernardaphyr: Well in clojure.tools.logging.impl there is a find-factory method… it uses Class/forName to see if each logger is in the classpath
21:51arohner1aphyr: https://gist.github.com/37b57284a130eb296ef3
21:52aphyrarohner1: !!!!
21:53aphyrYes, that's it exactly.
21:53TimMcThat's disgusting.
21:53TimMcI mean, it would still look worse in Java...
21:53aphyrI was about a quarter of the way through writing that myself.
21:54aphyrThanks
21:54arohner1np
22:04technomancycodeforkjeff: I was a bit trigger-happy applying incoming pull requests
22:04technomancybest to stick with the packaged releases rather than following git if you want to avoid breakage
22:23FrozenlockI'm still struggling with the java --> clojure conversion. How would this be written in clojure?
22:23FrozenlocklocalDevice.getConfiguration().setProperty(PropertyIdentifier.objectName, new CharacterString("BACnet4J slave device test"))
22:24FrozenlockUsually I would do : (.somejavafunction argument). But for this long expression, I'm confused.
22:25brehautat a guess it is (.setProperty (.getConfiguration localDevice) PropertyIdentifier/objectName (CharacterString. "BACnet4J slave device test"))
22:26brehautor perhaps you might prefer (-> localDevice .getConfiguration (.setProperty PropertyIdentifier/objectName (CharacterString. "BACnet4J slave device test")))
22:26FrozenlockI'll try it, thanks!
22:27amalloyi much prefer the -> notation there. but Frozenlock, you probably should figure this out yourself by translating each sub-piece and asking questions about the parts you don't understand or can't fit together
22:28Frozenlockamalloy: I agree. Unfortunatly every java-clojure interop explanation I've seen assume a working knowledge of java. :(
22:29FrozenlockIt feels like learning 2 languages at once.
22:30RaynesYou only need to know a certain limited amount about how Java works and only as much as you need to know to do something at any given point in time.
22:30jaimefthat's what you get with a java dsl :P
22:31Frozenlockjaimef: I flushed racket because they didn't have docstring :P
22:37jaimefFrozenlock: yeah.. fighting the size atm trying to use compozure without eating all the ram :-/
22:39FrozenlockI noticed the same thing earlier today! "Hey, where's all my ram?.. OMG!"
22:40FrozenlockOkay, biggest eater was chrome... but still :P
22:43jaimefon small vm's in the cloud every byte counts
22:44jaimefe.g. run lein with only 256megs of ram :P
22:49technomancyjaimef: definitely use lein trampoline if you're short on ram
22:49jaimefhey technomancy yeah once I get more clojure clue I will check it out
22:50amalloytrampoline is good, but at least as important is setting a maximum heap size for the jvm
22:50jaimeftechnomancy: do you use slime for other lisps?
22:51amalloytrampoline gets you from two 500MB instances down to one; -Xmx40m gets you down to maybe 100MB
22:51technomancyjaimef: no; CL's attitude towards slime development drives me nuts
22:51daediushey all, got a code question, i'm a noob clojure dev trying to create a macro that will take in a symbol and (def set the symbol to a number
22:51RaynesOnce we get the classloader stuff solid in Leiningen...
22:52Frozenlocktechnomancy: wasn't slime FOR common lisp?
22:52technomancyFrozenlock: sure, and the JVM was for Java
22:52jaimefgiven sbcl's default lack of readline like support slime is the only usable option imho
22:52brehautFrozenlock: how do you feel about CVS?
22:52technomancydoesn't mean we can't find better uses for them both =)
22:52daediushttp://pastebin.com/zaU7jU4z
22:53daediuscan someone give me a hint for how to do this?
22:53daediusoops.. http://pastebin.com/r17UbfC2
22:53daediuscorrected
22:53Frozenlockbrehaut: never used it, why?
22:53brehautyou are in for a treat
22:54amalloyyour macro should return a list representing code to run
22:54brehautim pretty sure the CL slime is still in CVS?
22:54FrozenlockI think it is. I just snatched the lastest version available on the website and was done with it.
22:55FrozenlockWho's developing Slime anyways? I've yet to meet one of "them" :P
22:55emezeskedaedius: You want to read up on "quoting". I suggest the Joy of Clojure, it has some good content regarding macros and quoting.
22:55brehautIf you had had experience with CVS that would tell you everything that is wrong
22:56daediusyah, trying to figure it out, I get the gist of it, but I don't know what symbols to use to say "I want the actual value of what this parameter is"
22:57daediusin the codes case, getting the value of the symbol thats passed in as a parameter
22:57Apage43(defmacro foo [s] `(def ~s 10))
22:59daediusahhh, I came close, I made a mistake of (defmacro foo [s] `((def ~s 10)))
22:59daediusthanks Apage43
23:00amalloyit's instructive to consider the other approach of (defmacro foo [s] (list 'def s 10))
23:02emezesketechnomancy: Did you say there was a doc on migrating plugins from lein 1.6 -> 1.7?
23:02TimMcemezeske: PLUGINS.md on master
23:02technomancyemezeske: https://groups.google.com/group/leiningen/browse_thread/thread/cce838e9460d51c2
23:03emezesketechnomancy, TimMc: thanks
23:03TimMcemezeske: Oops, disregard what I said.
23:03technomancywell doc/PLUGINS.md is about 2.0, which does the :plugins thing but also has several other changes
23:03technomancy(1.7 has :plugins too)
23:03TimMcI assumed you had written 1.7 -> 2.0, because that's what was on my mind.
23:05emezesketechnomancy: So my plugin has two main namespaces: leiningen.cljsbuild and cljsbuild.core. Do I need to move everything underneath leiningen?
23:05technomancyemezeske: the tl;dr is anything that runs inside the project classpath needs to be in its own dependency
23:05technomancy:plugins exist only in the Leiningen process
23:05emezesketechnomancy: My plugin doesn't have anything that needs to be in the project classpath
23:06technomancyok, then you're in luck
23:06technomancyyou should be able to just update your documentation
23:06emezeskeWell, it's complaining about not finding the non-leiningen namespace
23:07technomancythe leiningen.* convention is only needed for tasks
23:07emezeskeOkay, so it *should* work. I'll keep diggin then.
23:08hugodtechnomancy: are installed plugins in 0.7.0 still equivalent to using :dev-dependencies?
23:08hugodoops, 1.7
23:08technomancyhugod: no, they aren't placed on the project's classpath
23:08technomancyapart from that they're the same
23:08hugodok, thanks
23:08emezesketechnomancy: Uh weird question: if my plugin uses eval-in-project, does that project need to have my plugin as a plugin dependency?
23:09technomancyemezeske: oh, you are doing that funky construct-a-dummy-project thing, right?
23:09emezeskeYeah
23:09emezeskeWell, it merges in the :dependencies and :dev-dependencies from the parent project
23:09emezeskeMaybe I just need to merge in :project as well
23:10technomancyyou mean merge in :plugins as well?
23:10technomancyI'd advise against that
23:10emezeskeYeah
23:10emezeskeOh
23:10technomancy:plugins is specifically intended to be kept off the project classpath
23:10emezeskeNo I mean, add a :plugins to the dummy project
23:10technomancyso if you want to assoc lein-cljsbuild specifically in, you could do that
23:10technomancyor you could spin cljsbuild-core off into its own jar
23:10technomancyif it never needs to run in the context of lein
23:11emezeskeRight
23:11emezeskeI think I am really going to like lein 2.0 ^_^
23:11technomancyI hope you do! =)
23:14emezeskeOkay, I think spinning off a non-lein jar is the cleanest thing to do
23:14emezeskeThat solves some other problems as well
23:16technomancyI think that the lein2 isolation of :plugins makes sense, and it only seems confusing because :dev-dependencies lets people get away with a lot of crap that didn't particularly make sense to begin with
23:19emezeskeI agree. The 1.6 way of doing plugins has a very blurred line between "extends leiningen" and "is a library that your project uses."