#clojure log - Dec 08 2010

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:07 amalloy: scottj: nice, i didn't know about emacs-client. not sure what i'll use it for, but (server-start) is in my ~/.emacs now!

0:08 did you figure out your butlast thing?

0:09 * hiredman has totally defeated DynamicClassLoader

0:29 jackdempsey: hey all, going to writeup a small app in clojure as part of the continual learning process. key piece will be making some http calls, parsing the resulting dom, and looking at some elements

0:29 i still don't know much of what's in contrib, so if anyone has a pointer as a lib or two i should look at, would appreciate it

0:30 seems like clojure-http-client is a good start

0:30 ah, nm, ha

0:53 scottj: amalloy: nope, I'm went ahead and used butlast cause this is working on code and I don't think I can write code faster than butlast can process it

2:05 bartj: the only way I can print which test functions are being executed (with clojure.test) is with the "testing" macro

2:05 can someone please confirm?

5:24 AWizzArd: Do we have an Ant expert available? :)

5:24 (the build tool)

5:55 esj: I LIVE !

6:32 bartj: does clojure invoke threads while doing a reduce? for eg: this operation (time (reduce + (range 100000000)))

6:32 took only about 31 seconds, and I am extremely keen to know how it is *so* fast

6:34 bobo_: bartj: no i think preduce exissts though

6:34 kjeldahl: &(doc preduce)

6:34 sexpbot: java.lang.Exception: Unable to resolve var: preduce in this context

6:34 bobo_: guess not

6:34 clojurebot: I guess that is my answer.

6:35 bartj: gah, I am able to see preduce in the cheatsheet but not in the documentation as well)

6:35 kjeldahl: Really? I see no preduce on http://clojure.org/cheatsheet

6:36 Also, only guessing, but considering what reduce does, it's kind of hard to run in parallel. Map on the other hand...

6:36 bobo_: yeh

6:36 bartj: $Revision: 1.02, $Date: July 10, 2009

6:37 bobo_: there is a pvreduce in the fork join stuff though

6:40 bartj: kjeldahl, you mean to say that preduce will do it much faster ;)

6:41 kjeldahl: bartj: No, I was thinking of the sequential nature of the reduce operation. But lots of people have thought about this more than I.

6:41 Apologies if I didn't get the joke, and my reply seemed to serious. :-)

6:41 too serious I meant

6:49 kzar: So I was messing around with swing and I was wondering if there's something like partial I could use here, I was trying to do something like (partial . g drawOval) so I could easily map some numbers into drawOval. I think it's not working because the . is a macro? Best I could get was #(.drawOval g %1 %2 %3 %4) but that forces me to use that number of arguments and is a bit verbose

6:50 Chousuke: there's memfn

6:55 cemerick: I don't think there's any use case that is better served with memfn than with #()…

6:55 bsteuber: cemerick: I think kzar just gave one, no?

6:56 how do you solve if with #() ?

6:56 cemerick: bsteuber: memfn doesn't give you anything like partial application

6:57 ,((memfn substring a b) "foot" 1 3)

6:57 clojurebot: "oo"

6:58 cemerick: those "args" you provide to memfn define the arity of the returned fn.

6:59 bsteuber: cemerick: ah ok, had a wrong idea of memfn in my head, then

6:59 jave: I tend to wind up with stuff like: (eval `(sh ~@(rtmpdump-cmd isbn chapter))). It doesnt feel quite right

6:59 clojurebot: I want my bikeshed blue!

7:00 jave: whats the proper way to do it?

7:01 bsteuber: jave: why not (apply sh (rtmpdump-cmd …)) ?

7:01 cemerick: jave: (apply sh (rtmpdump …))

7:01 jave: hmm. sometimes one needs to ask humiliating questions. It occured to me the moment I pressed enter

7:04 bsteuber: :)

7:04 happens to me all the time here oO

7:07 kzar: heh same here

7:07 djpowell: hmm, just got bitten by using for inside a dynamic binding. dynamic bindings and (in this case, unwanted) lazyness are an unpleasant mix

7:16 cemerick: djpowell: That is largely fixed in 1.3.0 -- until then, http://cemerick.com/2009/11/03/be-mindful-of-clojures-binding/

7:29 * raek just realized that compare-and-set! checks identity rather than value

7:35 * raek hacks together compare-and-set-value!

7:36 bobo_: compare-value-and-set maybe?

7:42 cemerick: raek: identity-based CAS is a primitive operation provided by AtomicReference.

7:43 That is, you can't paper over it with a value-based comparison and get the same concurrency semantics.

7:50 esj: Heroku sold for 212 Million ! gawp

8:04 djpowell: cemerick: I'm not sure that 1.3.0 fixes the dynamic/lazy thing

8:05 (def *x* 1) (binding [*x* 2] (for [y (range 1 3)] *x*)) - still returns (1 1) rather than (2 2)

8:06 putting doall around the for fixes it

8:07 raek: cemerick: I am making a state machine that has its state in an atom. not all transitions are allowed at all times, so I want to have functions that try to do transitions and return booleans representing whether they suceeded

8:09 cemerick: djpowell: you may be right -- I know that bindings are passed along in agent sends, futures, etc, but the lazy-seq gotcha may remain.

8:11 raek: how is identity-based CAS related to that?

8:11 djpowell: cemerick: the fix to futures etc is nice, but yeah, I think lazy-seq is a big gotcha at the moment

8:30 jweiss: is there a functional way to get the first item in a list that matches a predicate? I could do (first (filter pred list)) but i'm not sure if the laziness works there to prevent more predicate calls than necessary?

8:30 i'm trying to think of a way to test that at the repl

8:31 djpowell: write a fn that calls (println "X") before calling your pred

8:31 cemerick: jweiss: you've got it right

8:31 jweiss: djpowell: ah that'll do it. cemerick thanks

8:31 cemerick: jweiss: actually, some is more concise

8:32 jweiss: cemerick: but some will just give me true or false, not the first matching item

8:32 oh

8:32 i guess i am wrong

8:32 cemerick: jweiss: no; if you make your predicate return the value from the seq, then it's exactly what you want

8:32 jweiss: cemerick: ok thanks

8:32 djpowell: oh beware btw - chunked seqs mean that for the built in data-structures, the predicate may get called for the first chunk

8:33 jweiss: djpowell: ok, i can live with that, this is actually a tiny dataset, but i wanted to know for future reference

8:38 chouser: right, so be careful with that -- some things produce chunked seqs while others don't

8:40 djpowell: this dynamics + lazyness thing is difficult to fix yourself. something like a bound-seq wrapper is ok - but what if seqs are nested inside the outer seq

8:40 chouser: & (let [i (atom 0)] {:filter (first (filter #(do (swap! i inc) (odd? %)) '(1 2 3 4 5))) :i i})

8:40 sexpbot: ⟹ {:filter 1, :i #<Atom@3f29e0: 1>}

8:40 chouser: & (let [i (atom 0)] {:filter (first (filter #(do (swap! i inc) (odd? %)) (range 5))) :i i})

8:40 sexpbot: ⟹ {:filter 1, :i #<Atom@157385e: 5>}

8:41 chouser: ^^ jweiss

8:43 jweiss: chouser: was just processing what that code does, i think i got it :) thanks

8:45 & (let [i (atom 0)] {:filter (first (filter #(do (swap! i inc) (odd? %)) (range 25))) :i i})

8:45 sexpbot: ⟹ {:filter 1, :i #<Atom@153dc23: 25>}

8:45 jweiss: & (let [i (atom 0)] {:filter (first (filter #(do (swap! i inc) (odd? %)) (range 100))) :i i})

8:45 sexpbot: ⟹ {:filter 1, :i #<Atom@36afc2: 32>}

8:45 jweiss: so i guess chunk size is 32

8:46 djpowell: Yeah - which matches the internal arrays, clojure uses to implement hash-maps and vectors, as well as just being a reasonablish size

8:50 chouser: hash maps don't generate chunked seqs currently

8:50 & (let [i (atom 0)] {:filter (first (filter #(do (swap! i inc) %) (apply hash-map (range 100)))) :i i})

8:50 sexpbot: ⟹ {:filter [0 1], :i #<Atom@1e5c05: 1>}

8:51 chouser: & (class (seq (hash-map :a 1 :b 2)))

8:51 sexpbot: ⟹ clojure.lang.PersistentHashMap$NodeSeq

8:51 chouser: & (class (seq (vector :a 1 :b 2)))

8:51 sexpbot: ⟹ clojure.lang.PersistentVector$ChunkedSeq

8:55 jweiss: is there a way to make re-find do multiline matching

8:59 i think i found it

8:59 & (re-find #".*findme.*" "blah blerg blah\nfindme blork\n foo bar")

8:59 sexpbot: ⟹ "findme blork"

9:00 jweiss: & (re-find #"(?s).*findme.*" "blah blerg blah\nfindme blork\n foo bar")

9:00 sexpbot: ⟹ "blah blerg blah\nfindme blork\n foo bar"

9:19 jweiss: chouser: something doesn't seem right here

9:19 & (doc clojure.contrib.error-kit/deferror)

9:19 sexpbot: java.lang.Exception: Unable to resolve var: clojure.contrib.error-kit/deferror in this context

9:20 jweiss: clojure.contrib.error-kit/deferror

9:20 ([name [parent-error?] doc-string? [args*] & body] [name [parent-error?] doc-string? args-destruct-map & body])

9:20 Macro

9:20 Define a new error type

9:20 nil

9:20 tonyl: (require 'clojure.contrib.error-kit)

9:20 ,(require 'clojure.contrib.error-kit)

9:20 clojurebot: nil

9:20 jweiss: according to that the doc-string comes between the parent error and the args

9:20 but the way it actually seems to work is that the doc-string needs to come after the parent error and args

9:21 ,(doc clojure.contrib.error-kit/deferror)

9:21 clojurebot: "([name [parent-error?] doc-string? [args*] & body] [name [parent-error?] doc-string? args-destruct-map & body]); Define a new error type"

9:22 jweiss: ,(clojure.contrib.error-kit/deferror blah [] "my docstring" [s] {:msg "boo!" })

9:22 clojurebot: DENIED

9:22 jweiss: doh

9:23 actually i guess it works both ways

9:35 jcromartie: so maybe someone can advise me on the "clojurely" way to design this

9:35 but in developing a data masking tool, I know that I need "rules" which can be previewed and applied to a database

9:36 and can be generated (for instance by functions that suggest transformations for a certain table)

9:36 so I've got multimethods for apply-rule commit-rule! and preview-rule

9:37 apply-rule being the non-destructive version

9:40 cky: ,'DENIED

9:40 clojurebot: DENIED

9:40 cky: :-D

9:50 neotyk: ,(source clojure.walk/postwalk)

9:50 clojurebot: java.lang.Exception: Unable to resolve symbol: source in this context

9:51 neotyk: can someone enlighten me what (partial postwalk f) in postwalk defn does?

9:52 garytr25: &(source clojure.walk/postwalk)

9:52 sexpbot: ⟹ Source not found nil

9:52 neotyk: ,(clojure.repl/source clojure.walk/postwalk)

9:53 clojurebot: Source not found

9:54 neotyk: postwalk in short (defn postwalk [f form] (walk (parrtial postwalk f) f form))

9:54 jcromartie: ugh I always screw myself over when trying to organize code into namespaces... I end up with cyclical dependencies everytime

10:31 OK this is fun

10:31 Say I have a defn in another namespace, and I use that namespace.

10:31 So the symbol resolves fine...

10:31 but then I use eval inside of pmap

10:31 and it fails

10:32 so ((eval 'normalize) "hi") works

10:32 but (pmap #((eval 'normalize) %) ["hi"]) does not

10:33 or a simpler example

10:33 @(future (eval 'normalize))

10:34 tonyl: is normalize a valid symbol

10:35 jcromartie: (eval 'normalize) works fine, it resolves

10:36 but any new thread seems to not have that binding bound

10:36 tonyl: yeah that would be a problem

10:37 why not (let [v (eval 'normalize)] (pmap #(v %) ["hi"]))

10:38 jcromartie: yeah I could do that

10:38 but I was going to defer eval until the last moment

10:39 simple enough of a change

10:39 tonyl: I am not much of a help there. I don't know much about threading bindings

10:39 jcromartie: but I assumed threads inherited bindings

10:39 :)

10:39 no problem

10:39 tonyl: as far as I know only root bindings, not parent bindings

10:43 jcromartie: "Supplying an initial value binds the root"

10:43 so (def x 1) should mean that any thread has access to x

10:50 kzar: I want to return an array with one change, something like take [:a :b :c] and return [:a :b :herp-derp], what's the best way to do that?

10:51 ,(aset [:a :b :c] 2 :herp-derp)

10:51 clojurebot: java.lang.IllegalArgumentException: No matching method found: aset

10:52 chouser: kzar: that would be right if [] were an array, but it's not -- it's a vector

10:52 ,(assoc [:a :b :c] 2 :herp-derp)

10:52 clojurebot: [:a :b :herp-derp]

10:52 kzar: chouser: oh whoops, thanks

10:52 chouser: I forgot they aren't the same, sorry

11:26 rata_: hi all

11:27 does anybody know a possible reason why "lein compile" isn't compiling my dependencies in one of my computers? (archlinux, lein 1.4.0)

11:44 jcromartie: what's the best way to structure namespaces and dependencies?

11:45 in terms of what depends on what namespace

12:02 amalloy: jcromartie: avoid cyclic dependencies :) - did you have something more specific in mind?

12:07 dnolen: anybody tried to write a binary decision diagram in Clojure?

12:12 amalloy: dnolen: what for? to figure out what function does the thing you want?

12:12 if so, i know fliebel wanted to do that, but i think he gave up and did something easier

12:13 dnolen: amalloy: there's some interesting research (and working projects) that implement datalog efficiently via BDDs

12:13 amalloy: also found an interesting paper that uses BDDs to do abstract interpretation of prolog programs.

12:14 just curious if anybody had messed w/ them, had pointers, links, code to share.

12:49 fogus`: dnolen: I would love to see someone retrofit BDDs onto clojure-datalog.

12:57 dnolen: fogus`: I should look more closely at the clojure-datalog implementation, it uses magic sets right?

13:01 fogus`: dnolen: Yes. The datalog impl is very cool. I spent a couple hours picking Straszheim's brain at The Conf. If you want to learn more about it, then check out the dissertation "Soft Stratification for Transformation-Based Approaches to Deductive Databases"

13:04 pdlogan: fogus`: any idea of the expressiveness / performance of the datalog v. the recent mini-kanren's? -- i.e. I guess the datalog would not be as expressive -- is it a pretty efficient implementation?

13:04 dnolen: fogus: Yeah I'm looking forward to digging into it. I haven't used it much since it seems quite slow.

13:04 pdlogan: i.e. are any of these candidates for "real world use"?

13:05 dnolen: pdlogan: even the new miniKnaren is "slow". I'd like it to be about 10X faster than it is. Right now it solves the Zebra puzzle in ~14-20ms. I'd like to see < 2ms.

13:06 I'm working on that.

13:06 fogus`: pdlogan: Not sure about real-world use as I haven't tried. I think in that regard I would love to see the TheDeadline folks open source their Rete engine. They seem to have no issues using it for real work

13:07 pdlogan: I see - thanks dnolen - you think it can get there eventually?

13:07 fogus`: pdlogan: I tried to convince them to do so, with no success. ;-)

13:08 dnolen: pdlogan: I don't see any obvious obstacles. There's a metric ton of literature out there that I've been pouring over that's quite helpful in that regard.

13:08 pdlogan: fogus`: the original OPS5 source is around somewhere - and oh is it a piece of work.

13:09 fogus`: pdlogan: As for expressiveness I can't say either (great help I am huh) since my experience with both has been exploratory

13:09 pdlogan: Yes, I've looked at it (MY EYES!)

13:09 pdlogan: yeah, n/p - there are various levels of "datalogs +/-"

13:10 jena has a forward and backward engine in open source java, recenttly incubated for apache. (FWIW)

13:10 (two different engines and the forward has to run strictly before the backword if used together)

13:11 anyway all the attention to LP in clojure is getting exciting

13:11 fogus`: I've always wished that Jess had a less restrictive license

13:12 dnolen: pdlogan: yeah I haven't look at much forward literature. All Prolog stuff. I'm curious to see if Clojure makes it easier to unify them.

13:12 pdlogan: yeah jess seems the pinnacle in java

13:13 "forward" is by definition stateful, where backward is not, for one thing

13:13 fogus`: I've been playing with my own inference engine and have something fun working, but it's very rough around the edges and not general purpose.

13:13 dnolen: pdlogan: miniKanren is interesting in that that each function is like little a abstract logic machine. They produce goals, does it matter if the results are produced backwards or forwards in a particular machine? (I doubt it)

13:15 Warren's incomplete paper on XSB brought me to that thought.

13:18 pdlogan: interesting stuff -- it's been a long time since I've been into logic programming and all of a sudden I have a big stack of reading.

13:20 fogus`: (inc pdlogan)

13:20 sexpbot: ⟹ 1

13:23 dnolen: fogus`: thx for the datalog paper, I've been looking for the right ones to read.

13:24 fogus`: dnolen: to paraphrase Jeffrey -- If the paper doesn't talk about negation, then it's a toy.

13:26 dnolen: fogus`: also haven't read much about negation, beyond Prolog's negation as failure.

13:26 and that miniKanren has disequality constraints.

13:28 maacl: I am struggling coming up with an elegant (or actually any) Clojure solution to this map transformation https://gist.github.com/733674 (python solution incl.)

13:31 amalloy: maacl: clojure.set/index?

13:32 i don't think it's quite what you want, but it looks close, so maybe it's useful/inspirational?

13:34 maacl: amalloy: yeah looked at it, but i find it difficult to use when the map is "keyless" (i.e. the keys are actually data)

13:35 * jcromartie is sad that SQL server doesn't support LIMIT

13:35 jcromartie: SQL Server*

13:38 jkkramer: maacl: here's one way, using reduce & for: https://gist.github.com/733691

13:45 alexyk: jcromartie: are you serious? MSFT's?

13:45 pppaul: is there a tutorial on using 'for'?

13:46 jcromartie: alexyk: yes

13:46 amalloy: &(doc for)

13:46 sexpbot: ⟹ "Macro ([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost f... http://gist.github.com/733699

13:46 alexyk: jcromartie: how do you limit things then? :)

13:46 amalloy: pppaul: the above is pretty good

13:46 jcromartie: select top 10 *...

13:46 instead of select * limit 10

13:46 and to limit to a range, you need a subquery

13:46 alexyk: a*holes

13:46 jcromartie: select top 10 * from (select top 100 * ...)

13:46 heh yeah

13:47 alexyk: no matter how F# tempted me to look at .net I never plunged, and this stuff confirms it's not for naught

13:47 no matter how Dr. Harrop enticed us

13:49 Raynes: https://github.com/Raynes/sexpbot/commit/ca81a293e39890d0289965c87178e52e6f762b4d

13:50 jweiss: chouser - having a curious problem with errorkit: https://gist.github.com/733706

13:54 edw: My swank connection clobbers my app whenever I close it. Is there a way to avoid this? And ideally automatically re-spawn a swank listener?

14:03 amalloy: $source deferror

14:03 sexpbot: Source not found.

14:04 amalloy: jweiss: https://github.com/richhickey/clojure-contrib/blob/2ede388a9267d175bfaa7781ee9d57532eb4f20f/src/main/clojure/clojure/contrib/error_kit.clj#L59

14:05 chouser: jweiss: yeah, deferror has all kinds of bad magic in it. :-(

14:05 amalloy: deferror puts some metadata in the var of the error thing you define; if you define a new var pointing at the same thing, it has the wrong meta

14:05 (disclaimer: i've never used deferror in my life, but the source sure looks that way)

14:06 chouser: that was written before cgrand told us at the Conj to have our DSLs produce values, and not to rely on macros

14:07 jweiss: amalloy: chouser ok i see why that's happening now

14:07 i guess i can copy over the meta myself

14:09 chouser: I'm actually not sure that'll be sufficient

14:09 there's also heirarchy stuff going on that appears to be based on the error's name, not its value.

14:09 amalloy: i'd guess not. when black magic is being done, usually you have to copy the meta and sacrifice a chicken

14:10 chouser: jweiss: are you sure you need error-kit? It's due to be replaced, I just haven't taken the time.

14:10 jweiss: if you don't actually need continue or continue-with, I'd recommend clojure.contrib.condition instead

14:39 huh. I just abused tree-seq where I normally would have used iterate

14:40 no need for a separate (take-while ...) to end the seq

14:40 jweiss: chouser: well i probably don't need it (yet) but i do need something like that at some point

14:41 i'm kind of surprised there aren't more people using it, it's pretty cool (although it would seem the implementation could be improved)

14:42 is there some other way to let the callers just pick a handler by name other than using error-kit

14:43 amalloy: chouser: wow, that's evil

14:43 though tbh (take-while identity (iterate f x)) is so common i have a function for it

14:44 chouser: & (tree-seq #(< % 10) (comp list inc) 0)

14:44 sexpbot: ⟹ (0 1 2 3 4 5 6 7 8 9 10)

14:44 chouser: amalloy: I didn't realize that's what I was doing until I was done

14:45 hiredman: jweiss: condition from contrib is simpler than error kit, but flexible, you end up with throwable maps

14:45 jweiss: hiredman: yeah i saw that, i may give that a try

14:46 chouser: jweiss: you can provide a function that you will call when an error happens, and users can dynamically bind that to their own function that does what they want

14:47 jweiss: chouser: yeah, that would do what i need. i guess i don't really *need* error-kit then

14:47 chouser: error-kit probably doesn't blong in contrib, at least not in its current state

14:48 I wrote it as a sort of proof-of-concept, to show you could get most (all?) of Common Lisp's error handling behavior in Clojure

14:48 and it went it contib because that's where I was putting stuff then :-P

14:48 * jweiss has a way of using things like that. i used lancet back in the day.

14:49 chouser: but that all leaves quite open the question of whether or not we *should* use all of Common Lisp's error handling in Clojure

14:56 dnolen: amazon s3 multipart upload api seems like a sweet thing to couple with Clojure.

14:57 parallel file upload

15:03 edw: Whenever I close a swank connection in Emacs, my process (started via lein repl or lein swank) dies. How do I get my process and its REPL to continue running?

15:06 amalloy: edw: i haven't had that problem, but then i use cake

15:07 edw: I've tried wrapping the swank.swank/start-repl in a try statement, but it doesn't return, so the exception happens in another thread.

15:07 amalloy: that is, i don't know enough to suggest that it's lein's fault, but since cake is basically a drop-in replacement you might try it

15:08 edw: What's the prevelance of lein vs cake usage? I'm trying to keep my toolset as mainstream as possible.

15:08 amalloy: edw: i think they're both pretty mainstream these days

15:11 edw: I'll check it out. Thanks.

15:12 jkkramer: edw: how are you closing the swank connection in emacs?

15:15 raek: edw: I'm using leiningen and I haven't had that problem

15:15 edw: jkkramer: Using ,sayonara

15:18 jkkramer: edw: i've never seen that before. is that for quitting emacs or just closing swank?

15:18 edw: Okay, this is weird: using ,disconnect leads to a graceful shutdown while ,sayonara fubars the server.

15:18 I.e. I can reconnect after ,disconnect-ing.

15:19 jkkramer: M-x slime-disconnect seems to also work

15:19 edw: This doesn't help if the connection is gracelessly severed e.g. I slap my laptop shut and go home. Or the network monkey restarts the router.

15:22 I was hoping to use screen(1) to keep my app running forever on my Linode server.

15:22 jkkramer: edw: so severing your local connetion kills the remote swank server?

15:23 edw: Well let's try it...

15:23 jkkramer: that would be surprising to me

15:24 edw: Huh. With cake...it works!

15:24 (To test, I killed the SSH tunnel and re-started it.)

15:37 maacl: jkkramer: thanks a lot

15:40 amalloy: edw: this isn't actually surprising, because cake does some things that are substantially different than lein

15:41 specifically of interest to you is that the project jvm is kept alive in the background indefinitely. eg $ echo "(def x 1)" | cake repl; echo x | cake repl

15:41 should result in 1, even though you "shut down" the repl

15:53 jweiss: & (declare z)(if (bound? z) z 0)

15:53 sexpbot: java.lang.SecurityException: You tripped the alarm! def is bad!

15:54 jweiss: why does the above throw "Var user/z is unbound"?

15:54 amalloy: jweiss: the bots will only evaluate one sexp at a time. aside from declare being "evil" here, you need to wrap things in a (do)

15:55 jweiss: (bound? #'z)

15:55 or (var z)

16:04 stuartsierra: Ack no! swank broken on Clojure master

16:16 danlarkin: ~ $ readlink /tmp Tarragon

16:16 clojurebot: Titim gan éirí ort.

16:16 danlarkin: sorry

16:54 lpetit: hello, can someone explain me how to correctly set this bug (for which I've just provided a little patch) in the right state ?

16:54 http://dev.clojure.org/jira/browse/CONTRIB-102

16:55 I mean, I see in the docs I must set it the "patch" tag, and set in some ready to test state, but I don't see anywhere in the interface where I can do this.

16:58 stuartsierra: lpetit: we haven't sorted out the JIRA process completely yet

16:59 your best bet is to bug somebody

17:00 *my* answer is to not use anything in contrib except logging, json, and maybe sql

17:00 lpetit: stuartsierra: well, can I bug you ?

17:00 :-D

17:01 stuartsierra: I'm busy. :)

17:01 but I'll try to take a look later

17:01 lpetit: may this be a problem with the rights currently attributed to my profile ?

17:03 stuartsierra: dunno, I've managed to avoid learning anything about JIRA so far :)

17:04 hiredman: lpetit: I think you just mark it as test

17:04 marvinthepa: is there a way to do (apply and (true true true false false false))

17:05 other than (reduce #(and %1 %2) (true true true false false false))

17:05 i.e. without the last two false's being evaluated?

17:05 stuartsierra: no

17:06 lpetit: hiredman: well, "mark it as test", I do not see how to do that. Someone needs to explain me how to do this step by step in the JIRA UI.

17:06 stuartsierra: click "edit"

17:07 change "patch" to "code & test"

17:08 change "approval" to "test"

17:08 (we need to change the text on that for contrib

17:11 lpetit: wow, how come I didn't see this "edit" button. Somehow since the "comments" were available, I have thought that I was already in editable state, with insufficient rights to edit attribute fields. Thanks Stuart.

17:15 marvinthepa: (every? #(true? %) (map #(and %1 %2) col (drop 1 col)))

17:15 ugly..

17:17 tonyl: marvinthepa: what are you trying to do?

17:17 brehaut: marvinthepa: (rest col) ~= (drop 1 col)

17:18 marvinthepa: wow

17:18 i am really stupid forgetting about rest

17:18 brehaut: marvinthepa: you dont need to wrap true? in a fun either

17:18 lpetit: marvinthepa: true? instead of #(true? %)

17:18 marvinthepa: sure..

17:19 that was a fast shot. Anyway, lets say I have a lazy col of booleans

17:19 I want to return false if one of them is false

17:20 (apply and) does not work..

17:20 brehaut: (some false? col)

17:20 kotarak: marvinthepa: (every? identity col)

17:20 lpetit: logical false (eg boolean false or nil), or true false (ah! true false!)

17:20 ?

17:21 marvinthepa: Wow I feel stupid. It's late..

17:21 brehaut: kotarak: is right, i am wrong

17:21 s/://

17:21 sexpbot: <brehaut> kotarak is right, i am wrong

17:21 kotarak: brehaut: I think yours should work, too, shoudn't it?

17:22 brehaut: its backwards

17:22 kotarak: Ah, yes

17:22 You are right

17:22 lpetit: ,(every? identity [true true false])

17:22 clojurebot: false

17:23 kotarak: ,(some false? [true true false])

17:23 clojurebot: true

17:23 marvinthepa: ,(not (some false? [true true false]))

17:23 clojurebot: false

17:23 marvinthepa: thanks

17:45 jweiss: i seem to be having a problem where lein aot compiling is not working the way i'd expect - if i include a namespace to compile, and that ns refers to another one that uses defrecord, it doesn't seem to compile the defrecord, and running my compiled class fails.

17:46 i wouldn't think i'd have to include gen-class on all the deps

17:46 stuartsierra: jweiss: this may be a bug: http://dev.clojure.org/jira/browse/CLJ-42

17:49 jweiss: stuartsierra: hm, i am not sure if that's the bug or not. would lein be using reload-all under the covers?

17:50 stuartsierra: dunno

17:51 but there *are* bugs around AOT-compiling and defrecord/deftype

17:51 jweiss: stuartsierra: ok good to know, i'll poke around jira

17:51 technomancy: AOT... more trouble than it's worth =P

17:51 stuartsierra: I don't think the bugs have been identified / ticketed yet.

17:52 jweiss: technomancy: unfortunately we have a lot invested in TestNG test harness... java classes only

17:52 technomancy: jweiss: it could be related to https://github.com/technomancy/leiningen/issues/#issue/141

17:52 jweiss: technomancy: that sounds sorta like what i see

17:52 clizzin: how can i use clojure to override a single method in a java class? i googled up a page detailing the use of proxy; is that the preferred strategy?

17:53 kotarak: clizzin: it worked for me, YMMV

17:54 ohpauleez: clizzin: proxy is the best way

17:54 kotarak: clizzin: if you need the name of your class which does the override you'll need gen-class

17:55 clizzin: kotarak, ohpauleez: my understanding is that proxy returns an object of the "subclass" type, so that i can pass it to a java method that takes an argument of the superclass, correct?

17:55 t

17:55 that is*

17:56 lpetit: clizzin: yep

17:56 clizzin: lpetit: cool. (was going to clarify what i meant with an example, but looks like you get me.)

17:56 thanks all!

17:56 i'll give that a shot and hopefully it'll work

17:56 ohpauleez: clizzin: good luck!

17:57 kotarak: lpetit: woah. You obviously need a Java background to parse this that fast. ;)

17:58 lpetit: kotarak: maybe I have just /pretended/ to understand. After all, one chance over two, and I'll sleep before we'll get the answer ;)

17:58 kotarak: lpetit: haha :D

18:00 lpetit: no, in fact I'm used to reading Eclipse javadocs and filling the holes, I've a lot of training, that's all :-p

18:01 kotarak: lpetit: yeah, I wouldn't expect you throwing guesses around. :)

18:05 clizzin: ugh so proxy can't access protected members...is there any way to do this in clojure, or will i have to write some java?

18:13 i notice lpetit has gone silent after all, haha

18:13 lpetit: hey, it's midnight here in France !

18:14 oh, sorry you wrote smth. You didn't place lpetit in your post, btw

18:14 clizzin: haha, no worries. yeah, it wasn't a specific query for you, but it does seem you are probably best equipped to answer.

18:15 lpetit: clizzin: I'll let the proxy experts talk.

18:15 kotarak: clizzin: gen-class has some knobs to expose protected things, but never used them. You'll have to check the docs.

18:15 lpetit: clizzin: proxy probably suffers from the same limitations as dynamic java proxies ?

18:15 ohpauleez: if you have access to the Java side of things (and not just the class or jar) you can just put them in the same package namespace

18:15 clizzin: kotarak: thanks for the tip

18:16 ohpauleez: oh interesting. this is definitely possible via gen-class, but do you know if it can be done with proxy? i don't see it in the docs, but maybe someone knows something.

18:17 lpetit: clizzin: suggestion when using gen-class = levarage the :impl-ns option . So the "API" of your gen-class is clearly separated from your "implementation".

18:17 clizzin: and sometimes it can let you solve cyclic compilation problems, too.

18:17 ohpauleez: clizzin: no idea, I haven't tried to do it with a protected method before

18:19 clizzin: lpetit, ohpauleez: thanks for the tips, i'll poke around in the docs and see if i can figure something out

18:19 ohpauleez: awesome

19:56 KirinDave: I'm having a weird issue with ring

19:56 Ihave all these logging statements that seem to be swallowed when they're in ring handlers.

19:56 Anyone know why this might be?

20:00 hiredman: logging like real logging, or logging like printlns?

20:06 KirinDave: hiredman: Well actually neither get out

20:07 hiredman: printlns are not surprising because they print to *out*, which, who knows how it's been rebound

20:11 KirinDave: hiredman: I think we're trying to use logula, which is one of the illustrious codahale's tools.

20:12 hiredman: never heard of it

20:17 jcromartie: so, in clojure.contrib.sql with-connection can't combine multiple with-query-results?

20:20 hm no that's not right

20:20 laziness

20:20 that's the issue

21:54 GMTao: Hey all.

21:55 I heard that Rich has left Clojure and moved on to other things. Is this true?

21:55 hiredman: you'd have to ask him

21:56 GMTao: Okay, thanks. I wasn't sure, so I wanted to confirm.

22:41 defn: wait. what?

22:42 is there any evidence to suggest what GMTao is talking about is true?

22:50 jcromartie: it looks like he's gone a bit quiet

22:50 but it's only been 4 days since a commit

22:51 defn: 4 days? That's it?

22:51 It's called a "vacation", folks.

22:51 :)

22:51 brehaut: wait, those are for nerds too?

23:23 Raynes: defn: Uh, unless Rich got run over by a bus, I seriously highly extremely doubt that that would happen.

23:26 defn: Raynes: hey man dont shoot the messenger

23:26 i was just surprised, thought maybe i missed a memo

23:26 Raynes: $seen rhicky

23:26 sexpbot: I have never seen rhicky.

23:26 Raynes: $seen rhickey

23:26 sexpbot: rhickey was last seen quitting 3 days ago.

23:27 Raynes: Indeed. Probably doing talks or holiday stuff or something.

23:27 * Raynes goes to sleep.

23:27 defn: btw, Ruby is becoming more sane -- I've got JRuby using headius' bridge to the Clojure STM, Hamster (tries), multiple dispatch methods, and the ability to read in and emit s-expressions

23:28 this is all likely for naught, but I can't help wondering what a "sane" ruby would look like...

23:30 technomancy: defn: I saw that cloby gem

23:30 what exactly is the point of putting mutable objects in STM?

23:30 does he just not understand what's going on there or what?

Logging service provided by n01se.net