#clojure logs

2010-05-25

00:02durka42has anyone tried doing I/O to child processes with ProcessBuilder?
00:04dnolenvIkSiT: hmm, the seq would be reversed, what's advantage?
00:05vIkSiToh generally, trying to do it using recursion and figuring out how to generate that seequence
00:08dnolen,(loop [n 1234 result '()] (let [q (int (/ n 10)) r (rem n 10)] (if (= r 0) result (recur q (cons r result)))))
00:08clojurebot(1 2 3 4)
00:23remleduff,(loop [n 1034 result '()] (let [q (int (/ n 10)) r (rem n 10)] (if (= r 0) result (recur q (cons r result)))))
00:23clojurebot(3 4)
00:25remleduff,(loop [n 1034 result '()] (let [q (int (/ n 10)) r (rem n 10)] (if (= n 0) result (recur q (cons r result)))))
00:25clojurebot(1 0 3 4)
00:32dnolenremleduff: good point.
00:33dnolen,(loop [n 10345678 result '()] (let [q (int (/ n 10)) r (rem n 10)] (if (= q 0) (cons r result) (recur q (cons r result)))))
00:33clojurebot(1 0 3 4 5 6 7 8)
00:33dnolenthis is 5-6x slower than just converting to string and back.
00:37remleduffThat seems odd
00:37dnolenremleduff: why? Java string operations are probably highly optimized.
00:37remleduffIt's a super simple loop though
00:38remleduffVs a ton of string ops
01:00riddochcHm. This one always bugs me. NullPointerException. It means I've done something stupid, I know, but it's not so helpful.
01:28Lajlariddochc: http://www.youtube.com/watch?v=jK47iKOb9lQ
01:34riddochcLajla: Surfer dude?
01:35Lajlariddochc, silver surfer.
01:36LajlaThe greatest comic book series ever except for Spawn, Blame and Kodomo no Jikan.
01:38riddochcLajla: Cool, I guess. I can't say I know much about comic books...
01:38Lajlariddochc, it is sophisticated philosophical literature man, a reflexion upon humanity, Galactus is this all-powerful planet eating diety who is neither good nor evil.
01:39LajlaHe simply eats planets to survive, as do humans.
01:39LajlaAnd he talks with a British accent.
01:39replacatechnomancy: did you see i used @(promise) in the clojure.pprint tests? But I had to comment it out cause there's now way to identify an unfulfilled promise :(
01:39replaca*now => no
01:39technomancyreplaca: no, I hadn't seen that
01:40technomancywe are using it in tests for our distributed job system to simulate a task that is permanently blocked, for that exact reason
01:41replacai want a version of ideref with an isAvailable method, so we can implement a general available? call on iderefs
01:41cemerickreplaca: I've suggested that in the past
01:42replacafuture, promise, delay can all implement it
01:42riddochcLajla: I don't quite see the association between my NullPointerException and Silver Surfer. Care to clue me in? :)
01:42replacaI though I had seen something like it
01:42cemerickThe objection was that it doesn't necessarily make sense / is useful for vars and atoms
01:43replacacemerick: they just return true (and don't have to implement the new interface)
01:43replacaassume an IDeref2 that has the extra method
01:44cemerickreplaca: I agree. There's a bit of semantic difficulty with atoms, but I'm happy to paper over that.
01:44cemerickI don't think an additional interface is warranted, though.
01:44replacathen the available call can check and just return true for IDerefs
01:45replacadon't atoms always have a value?
01:45cemerickyeah, it's not a technical problem. Rich had objections.
01:45Lajlariddochc, I just wanted to share my childhood nostalgia actually, and lured you into watching that clip making you think it was related to your problem. =(
01:45cemerickThey always have a value, but not in the same way as futures, delays, and promises. Same for refs.
01:46cemerickThe former get one value, and done.
01:47replacayeah, what i'm talking about is "will i block?" any guarantees about *which* of a set of vals you'll get is completely off the table
01:47cemerickI understand what you're driving at -- I'm all for it
01:47replacapprint is my big concern, of course
01:47cemerickjust trying to represent Rich's objection, as I remember it
01:48replacayeah, I should chat with him about it
01:48replacaso much to do... :)
01:49replacaright now I should wake this bby up so she'll sleep during the night
01:49replaca*baby
01:51cemerickreplaca: OK, my memory is faulty :-) http://clojure-log.n01se.net/date/2009-08-18.html#11:34c
02:05replacacemerick: thanks
02:07riddochcLajla: Aw, that's okay. Nostalgia's good.
02:08Lajlariddochc, I used my smooth cunning to lure you by manipulating the situation, yeees.
02:14riddochcLajla: How clever of you. Aside from other conversations here in #clojure, do we know each other? I can't say your nick rings a bell...
02:15Lajlariddochc, I am fairly new here deciding wether or not to exchange Scheme for Closure, thus far my most viable option seems 'design a new language that combines them'.
02:15LajlaAlso, I am the second best programmer in the world, only second to Microsoft's chief software architect.
02:17riddochcLajla: Is that so? Interesting. ;)
02:19Lajlariddochc, yes, they never told you?
02:19LajlaHow long have you been dwelling these forrests?
02:21riddochcThey? Oh, in #clojure, I was on a little last fall, but haven't really been on much before about two months ago or so.
02:22Lajlariddochc, ahhh, I just told them two days back that I am second only to the Microsoft CSA.
02:22LajlaNow they worship me and bow in reverence to an emerald statue in my liking every day as the sun rises.
02:24riddochcI see. So, I'm curious, you mentioned you're thinking of combining Scheme and Clojure. What would you change about Clojure as it is?
02:27Lajlariddochc, well, combining is a strong word, I'm actually more thinking of extending the concept of 'application' in Scheme beyond the lambda abstraction.
02:27LajlaI was actually thinking of taking 'code = data' to the point that data can be applied in many forms.
02:27LajlaLambda abstractions being one of them, and also I want to have immutability of data for that and.
02:27Lajlathat end*
02:28LajlaBut say that x is an ordered sequence, like say and array or a list, then (s 1 -1) would be a slice from the second to the last element.
02:28LajlaAnd (s 1) would be the second.
02:28LajlaThat behaviour of closure inspired me.
02:31riddochcHuh. Do you think it might get to a point where determining what function the first element of a list serves would make the code too obfuscated?
02:32riddochcI mean, life in Scheme is comparatively simple, compared to even clojure. The first item in a list, if it's code, is either a function, macro, or a special form.
02:33riddochcEr, mostly.
02:33KirinDaveriddochc: Well, except when it isn't. :)
02:33riddochcKirinDave: Yeah, yeah. Details. ;)
02:34KirinDaveriddochc: I mean, (module ...) is a great example. :)
02:34Lajlariddochc, well, no, that's not how scheme works actually.
02:34riddochcIt's just that... giving special meaning to lots of data structures when put at the beginning of a list and evaluated could get really complicated, really fast.
02:34LajlaIt first tests if it's syntax at compile time.
02:34LajlaAt runtime, it simply evaluates all the members of a form.
02:34KirinDaveLajla: But macros can work on forms even from (eval ...)
02:34LajlaIf the head does not evaluate to a procedure, it results into an error.
02:35LajlaKirinDave, well, inside eval there are different rules.
02:35LajlaIt effectively recompiles there again.
02:35KirinDaveLajla: I mean, sure, ultimately the evaluator gets something that is exactly that way.
02:35LajlaAlso note that Scheme only had eval from 5.
02:35KirinDaveBut it's not something the programmer will ever see.
02:35KirinDaveOr if they do, it's because they're asking for it.
02:35KirinDaveIt's not a level most people work on.
02:36LajlaSure, but this evaluation model is actually simpler, Scheme needs to check if it's a procedure, then needs to check if the types of the arguments match.
02:36LajlaIn this case, only the types of the arguments need to be checked for match.
02:36riddochcNot all members of a form are evaluated, necessarily. if, for example.
02:37Lajlariddochc, that's syntax.
02:37Lajlariddochc, buuut
02:37Lajlathis case is different
02:37Lajlabecause I intend the language to be lazy.
02:37LajlaIf is a function in this language.
02:37riddochcSo lazy you don't need conditions? ;)
02:37Lajlariddochc, well, it's a function like any other.
02:38LajlaThe only basic forms I have that are fundamentally different are let and letrec, which work lazily too, so those might need some fundamnetally different internal representation.
02:39riddochcI've been wondering lately, what's "lazy enough"... I read "Real World Haskell" about a year ago, and it got pretty hard to wrap my head around when it got to monads.
02:39LajlaBut for instance, contrary to Scheme (letrec ((a b) (b a)) a) would be valid, it would just be an infinite loop trying to resolve the maning of a.
02:39Lajlariddochc, well, is it just much of a continuum, there's just lazy and strict evaluation I guess.
02:42riddochcWell, it sounds like an interesting project, anyway. Try your hand at writing a compiler for it.
02:42riddochcOr interpreter, or whatever.
02:43riddochcHave you written much about it? Got a spec, or a blog, or anything like that for it?
02:46Lajlariddochc, well, I'm currently sort of making a mock-up implementation in Scheme, interpreter.
02:46LajlaAs I said, I'm fairly new here, I'm still sorting out design goals.
02:46LajlaI think that in the end I'll demand vectors to be homogenous and occupy the same amount of storage.
02:47LajlaThere members, that is.
02:47Lajlatheir*
02:47riddochcSo they'd be more like arrays.
02:47Lajlariddochc, yap, C style arrays but bounded.
02:48LajlaBut I have some sketches of it written down
02:48LajlaI'm going for a message-passing style, except that messages are nots ymbols, but any type of data.
02:48LajlaIn (sequence 0 5) 0 and 5 could be seen as messages.
02:50LajlaAlso, I'm making an unusual design choice in that say I have a function of 3 arguments (f x y z) that I call with (f x y), only one argument, the result will be the same as (f x y nil) for variable argument functions, car and cdr on nil are thus defined, and return nil itself.
02:53riddochcSo, functions will have a known, fixed arity.
02:53riddochcThat's a little un-scheme-like, isn't it?
02:54Lajlariddochc, well, they don't at all. It's just that (f x nil nil) is the same as (f x)
02:54LajlaCalling a function with the final arguments all nil can be shorthanded by calling it with fewer arguments.
02:54LajlaSo you don't need that (define (f x y . rest) hassle inside.
02:55LajlaAnd can just use (define (f x y z) where z may be variable, you just check (null? z) to see if it's specified.
02:55riddochcOkay, sure, I guess.
02:55Lajlawhere z may be optional*
02:56LajlaIt just follows out of that car and cdr are defined on nil and just return nil itself.
02:57riddochcI wonder if some of the other non-scheme, non-CL, non-Clojure lisps might give you what you're looking for. I don't know, newlisp?
02:58Lajlariddochc, hmm, don't know that one, am checking it out now.
02:59LajlaThis version is fairly different though due to being lazy and having all valid code be an expression, like define no longer exists.
02:59riddochcAren't there a couple others that are actively developed? Anyone else know?
02:59LajlaAlso, most bizarely (- 2 1) returns -3, not 1. And (2 - 1) returns 1.
02:59Lajlariddochc, hmm, not sure, all I know is Clojure, Common Lisp and Scheme.
03:00LajlaAll other dialects have pretty much been superseeded by Common Lisp I guess, Scheme and Clojure are different from the rest as a conscious design goal, all the others just followed out of Lisp 1.5 and were later unified in Common Lisp.
03:01riddochcBut there are other new ones. Arc would count, I guess.
03:02riddochcThough I really don't know whether Arc is actually being actively developed. Paul Graham really could stand to read something like http://producingoss.com/ if he really cared...
03:03LajlaHmm, didn't know Arc too, you might be the third greatest programmer second to me and Microsoft's CSA.
03:03LajlaAs I read it, Arc made some controversial desisions of whcih I can't say I approve.
03:05riddochcI wouldn't call myself a great programmer... in fact, I'm kinda getting away from it, lately.
03:07Lajlariddochc, programming?
03:07LajlaWhy?
03:07clojurebothttp://clojure.org/rationale
03:07LajlaAhaha
03:07riddochcHeh.
03:08riddochcYeah, RSI plus major burnout. No more startups for me, thanks.
03:10LajlaIn my case it's more currently trying to write an interpreter for a dubious self-invented programming languages with so much sunlight outside it gives me a headache and I see spots in front of mine eyen.
03:10riddochcI've had a series of several jobs that have really left me feeling like something is very wrong. You know what they say, anyway, about doing the same thing over and over again, and expecting a different result.
03:11Lajlariddochc, explain?
03:12riddochcA *real* explanation would take too long, and goes waaaay beyond casual conversation. Needless to say, I'm a hobbyist programmer now, going back to school for another masters soon.
03:15riddochcI suppose I need to come up with a short explanation for it sooner or later... let's see...
03:15spariev,(partition 2 (range 10 15))
03:15clojurebot((10 11) (12 13))
03:17riddochcspariev: That's definitely strange.
03:17sparievhm, I'd like it to yield ((10 11) (12 13) (14 15))
03:17technomancypartition is confusing; generally you want partition-all instead
03:18sparievtechnomancy: thanks, it indeed confusing
03:19technomancynewlisp has made some remarkably bad design decisions
03:21riddochcI'm a bit of a perfectionist. This would seem like a good thing, but it's really, really not. I shouldn't be working in an industry where the number one priority is time-to-market. It's time I accept this fact, and move on.
03:21Chousuke,(partition 2 (range 10 16))
03:21clojurebot((10 11) (12 13) (14 15))
03:21Chousukeit's end-exclusive
03:22riddochctechnomancy: I'm curious, what're its main flaws, in your view? (I know very little about it, except that it exists.)
03:24sparievChousuke: yep, thanks :) slow morning
03:24technomancyriddochc: it has a half-baked GC model and prefers dynamic scope to lexical scope by default.
03:25riddochctechnomancy: Sounds just like emacs. ;)
03:25ChousukeI failed to be impressed by the fexprs things
03:25Chousuke-s
03:25technomancyriddochc: except even the most hardcore Emacs fans will admit that elisp is a very backward dialect
03:26ChousukeIsn't there an ongoing effort to replace elisp with guile?
03:26riddochctechnomancy: true, though I haven't read much advocacy of newlisp one way or another. Sounds like it's not worth reading about.
03:27technomancyChousuke: sort of. I don't think it'll go anywhere
03:27riddochcChousuke: I'd seen some reference about that just the other day, somewhere.
03:27technomancyChousuke: there's a branch to add lexical scope into mainline elisp anyway
03:30sparievthere is also PicoLisp http://www.software-lab.de/down.html , dynamic scope and interpreter only. claims to be very fast
03:32riddochcDynamic scope again? Weird.
03:32riddochcThen again, I suppose it is a bit easier to implement...
03:35bartjWhy can I not find "replace-re" function? I get the following error: "Unable to resolve var: replace-re"
03:36bartjmy clojure version - {:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}
03:36technomancyimplementing lexical scope is not rocket science
03:36technomancyall you have to do is read The Little Schemer
03:37technomancyit's a thin book!
03:37hiredmanI heard lexical scope is slow
03:37danlarkinit's all the stack operations it has to do
03:37riddochctechnomancy: You're right, it's not rocket science, but implementing dynamic scope was the second assignment in an undergraduate computer science class on programming languages, with two prerequisites, for what it's worth.
03:37hiredmandanlarkin: right, I wonder if they do some sort of peephole optimization these days
03:38technomancydanlarkin: well, it's a bit of a memory hog; sure
03:38danlarkinclojure's lexical scoping performs the glory hole optimization
03:39sparievbartj: it looks like replace-re still in clojure.contrib.string
03:40riddochcReally, though. Everyone knows lisp is slow. Must be parsing all those parentheses. ;)
03:40bartjspariev: but, it seems to be under clojure.contrib - which I have loaded
03:40vu3rddcan someone recommend a Free and simple http proxy to monitor the http traffic ?
03:41vu3rddI am playing with clj-apache-http and would like to see what is sent over the wire..
03:41danlarkinhere's a paper referencing the issue I'm talking about with lexical scope stack popping: http://portal.acm.org/citation.cfm?id=996546.996548&coll=GUIDE&dl=ACM&CFID=89537219&CFTOKEN=90578418
03:41riddochcvu3rdd: It's not a proxy, but try wireshark.
03:42vu3rddriddochc: thanks. I know about wireshark, but I wanted to know if there is something more simpler, which can just show http traffic
03:42vu3rddThere is something called charlesproxy, but it is not really Free
03:43riddochcvu3rdd: I often just use the Tamper Data plugin for Firefox.
03:43technomancyhuh huh he said balls
03:43vu3rddriddochc: thanks, I will look at it.
03:44vu3rddI want something like firebug which runs on the unix shell.
03:44sparievbartj: hm, what exactly do your use/require statements look like ?
03:46riddochcvu3rdd: it's not exactly a proxy... but it'd show you pretty much all the same stuff you'd see in some report from a proxy.
03:47vu3rddriddochc: thanks. I just installed it. Will play with it.
03:51bartjspariev: I don't have any use statements. I assumed since the jar files were in the classpath, it would pick it up automatically
03:51bartjspariev: but, I guess I have to put something like (use 'clojure.contrib.string) to make it work?
03:52sparievbartj: yep, exactly
03:52bartjspariev: it works, thanks
03:55bartjspariev: it looks like both use and import are the same
03:55riddochcbartj: Not exactly...
03:56riddochcThough I'd have to look it up to tell you the difference.
04:01tomojimport is for java classes
04:01tomojuse is for clojure namespaces
04:03riddochctomoj: Thanks. I have a somewhat better chance of remembering that, next time I have to know.
04:05sparievone friend of mine thinks The Little Schemer is a bit schizophrenic book. But, he's a Haskell fan, so I'm taking hist opinion whit a big grain af salt :)
04:22bartjtomoj: thanks...
04:59_na_ka_na_hi all, what's the simplest way to get current date time in Clojure
05:03spariev,(java.util.Date.)
05:03clojurebot#<Date Tue May 25 02:08:20 PDT 2010>
05:04eevar2might be worth looking at joda time (which probably has bindings in contrib)
05:04danlucraft+1 to that
05:05sparievhere's also http://github.com/clj-sys/clj-time - clojure wrapper around jodatime
05:33_na_ka_na_thanks i'll take a look @ clj time
06:21bartj(find-doc "fmap")
06:21bartj,(find-doc "fmap")
06:21clojurebot------------------------- clojure.contrib.monads/m-fmap nil Bind the monadic value m to the function returning (f x) for argument x
06:41_na_ka_na_hi, say I have a fn named myFn ... now I have String s "myFn" ... how do I find documentation of myFn using String s ?
06:44_na_ka_na_hellooo anyone there? why is it so quite!
06:45LauJensen_na_ka_na_: Im not sure its possible. (defn mfn [] nil) defines a symbol containing a function. (symbol "mfn") would give you the correct symbol but with no data attached.
06:48_na_ka_na_LauJensen: Thx for the response, why does (doc (symbol "myFn")) .. throw exception. .java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
06:49spariev_na_ka_na_ : you may want to use (find-doc "myFn")
06:49LauJensen,source doc
06:49clojurebotjava.lang.Exception: Unable to resolve symbol: source in this context
06:49LauJensen$source doc
06:50_na_ka_na_spariev: no, I know the name of the fn in a string, just trying to lookup meta for exactly that fn
06:51bartjis a hash-map a sequence?
06:52_na_ka_na_yes it is
06:52_na_ka_na_,(seq {:a 1 :b 2})
06:52clojurebot([:a 1] [:b 2])
06:55vu3rddhow do I create a jar without AOT compilation using mvn + clojure-maven-plugin?
06:55vu3rddi.e. just the clj files alone
06:55kasperlanger_na_ka_na_: (:doc (meta (ns-resolve *ns* (symbol "map"))))
06:56kasperlangerI'm sure there's an easier way to do this
06:57_na_ka_na_kasperlanger: many thanks!
06:57kasperlangerYou're welcome
06:59_na_ka_na_,(:doc (meta (ns-resolve *ns* (symbol "map"))))
06:59clojurebot"Returns a lazy sequence consisting of the result of applying f to the\n set of first items of each coll, followed by applying f to the set\n of second items in each coll, until any one of the colls is\n exhausted. Any remaining items in other colls are ignored. Function\n f should accept number-of-colls arguments."
06:59_na_ka_na_,(doc (ns-resolve *ns* (symbol "map")))
06:59clojurebotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
06:59_na_ka_na_kasperlanger: any idea why the above is throwing exception
07:00kasperlangerdoc is macro
07:00kasperlangerTake a look at how it's implemented
07:01spariev (ns-resolve *ns* (symbol "map")) just does not get evaluated
07:02sparievbtw, ns-resolve *ns* could be substituted by resolve
07:02spariev,(:doc (meta (resolve (symbol "doc"))))
07:02clojurebot"Prints documentation for a var or special form given its name"
07:04bartjis there a function to remove keys which have "nil" values in a map?
07:04tomojI don't think so, but it is not very hard to make one
07:05tomojdo you ever have false as a value?
07:05tomojif not:
07:05tomoj,(into {} (filter val {:a 3 :b 4 :c nil :d false}))
07:05clojurebot{:a 3, :b 4}
07:05bartjno always, nil
07:06tomojfilter will make it into a seq, so we have to stuff it back into a map with into
07:06tomojif you are doing other seq operations, only do the into once
07:06_na_ka_na_,(into {} (filter nil? {:a 3 :b 4 :c nil :d false}))
07:06clojurebot{}
07:06tomoj,(into {} (remove nil? {:a 3 :b 4 :c nil :d false}))
07:06clojurebot{:a 3, :b 4, :c nil, :d false}
07:07tomojyou need this if you can have false:
07:07kasperlangerI guess (print-doc (resolve (symbol "map"))) would be the best way to do it then
07:07tomoj,(into {} (remove (comp nil? val) {:a 3 :b 4 :c nil :d false}))
07:07clojurebot{:a 3, :b 4, :d false}
07:07kasperlanger'(print-doc (resolve (symbol "map")))
07:07kasperlanger,(print-doc (resolve (symbol "map")))
07:07clojurebot------------------------- clojure.core/map ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments.
07:08_na_ka_na_yes thats what I was planning 2
07:08kasperlanger:)
07:09_na_ka_na_better to use ..
07:09_na_ka_na_,(print-doc (resolve (symbol "clojure.core/map")))
07:09clojurebot------------------------- clojure.core/map ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments.
07:10bartjkey, val are functions?
07:10bartjwhich take only one argument?
07:10bartj, (doc val)
07:10clojurebot"([e]); Returns the value in the map entry."
07:13bartjtomoj: I don't understand how val is used in - "(filter val {:a 3 :b 4})"
07:13bartjbecause val is supposed to return the value of the map
07:13bartjand (val {:a 3 :b 4}) does not work!
07:14_na_ka_na_bartj: val returns value of *a map entry*
07:14_na_ka_na_,(map val {:a 1 :b 2})
07:14clojurebot(1 2)
07:14tomojbartj: correct
07:14tomojbartj: do you know about seqs yet?
07:14_na_ka_na_(seq a-map) gives a list of map entries ...
07:14tomojyeah, a seq of map entries
07:15tomojfilter, map, and functions like them call seq on the collection
07:15tomojso each time val is called by filter, it is called with a map entry
07:17bartj, (doc val) takes only one argument!
07:17clojurebot"([e]); Returns the value in the map entry."
07:17_na_ka_na_yes that argument is a map entry
07:17tomoj,(seq {:a 1 :b 2})
07:17clojurebot([:a 1] [:b 2])
07:17tomoj,(class (first (seq {:a 1 :b 2})))
07:17clojurebotclojure.lang.MapEntry
07:18tomojfilter calls the predicate on elements of the coll's seq, and returns a seq
07:18bartjmy main doubt is this: (into {} (filter val {:a 1})) works but not (val {:a 1})
07:18tomojyes, because filter does not call val on {:a 1}
07:18tomojit calls val on elements of the map's seq
07:18tomoj,(first (seq {:a 1 :b 2}))
07:18clojurebot[:a 1]
07:18tomoj,(val (first (seq {:a 1 :b 2})))
07:18clojurebot1
07:19tomojfilter converts the map into a seq of map entries before processing it
07:19tomojit then returns a seq of map entries (only the ones for which the predicate returned true)
07:19tomojthis is why we have to squash it back into a map with (into {} ...)
07:19tomojotherwise...:
07:19_na_ka_na_,(val (clojure.lang.MapEntry. :a 100))
07:19clojurebot100
07:19tomoj,(filter val {:a 1 :b 2 :c nil :d false))
07:19clojurebotUnmatched delimiter: )
07:20tomojerr
07:20tomoj,(filter val {:a 1 :b 2 :c nil :d false})
07:20clojurebot([:a 1] [:b 2])
07:20_na_ka_na_also
07:20_na_ka_na_,(key (clojure.lang.MapEntry. :a 100))
07:20clojurebot:a
07:21bartjtomoj: got it!
07:21tomojI wonder if it would be good to make protocol versions of filter, map, etc
07:21tomojwhich return the original type and work really quickly
07:23_na_ka_na_tomoj: didn't quite get what you mean, map filter etc. work with sequences currently
07:24cemerickyeesh, there are people complaining about no 1.2 release yet :-/
07:26tomoj_na_ka_na_: yes, I'm wondering if I want something that _doesn't_ work with sequences
07:27bartjtomoj: is there a way to write a "for loop" over a hash-map then?
07:27tomojsure
07:27tomojfor operates on the seq of the coll as well
07:27tomojso each time around, the binding will be to a map entry
07:27tomojwhich you can destructure like a seq, so:
07:28tomoj,(for [[k v] {:a 1 :b 2}] [k (inc v)])
07:28clojurebot([:a 2] [:b 3])
07:28tomoj,(into {} (for [[k v] {:a 1 :b 2}] [k (inc v)]))
07:28clojurebot{:a 2, :b 3}
07:28tomojsee, here also, it might be cool if there were a version of for which could bind over maps, would return a map, and would use transients
07:29tomojusing it would mean it wouldn't work as part of a chain which had other seqable types in it
07:29tomojbut they could just have the same names in a different namespace, or slightly modified names, so switching would be easy
07:30_na_ka_na_for example you mean, for-map .. which takes map as input and avoids calling seq?
07:31tomojyeah
07:31_na_ka_na_might be a good idea, but any other benefits apart from performance?
07:31tomojexcept there's no need to tag the function names with types
07:31tomojbecause of protocols
07:31_na_ka_na_currently they work to a uniform abstraction..
07:32_na_ka_na_hmm .. so u mean at runtime it will call apt. map depending on the protocol?
07:33tomojyeah
07:33tomojbut it's fast
07:33tomojno, performance is the main benefit
07:34tomojbut it also might be nice sometimes to avoid stuff like (into {} ...)
07:34tomojthe repackaging you have to do when you just want the same type back goes away
07:34_na_ka_na_Hmm .. sounds a good idea to my naive self .. post on g groups?
07:35tomojI think I will try working on it a bit
07:37bartjtomoj: for the earlier question of removing nil values from a map, I came up with this...
07:37bartj,(defn remove-nil [map] (for [[k v] map] (if-not (nil? v) [k v])))
07:37clojurebotDENIED
07:38bartj,(defn remove-nil [m] (for [[k v] m] (if-not (nil? v) [k v])))
07:38clojurebotDENIED
07:38bartj, (into {} (filter (complement nil?) (remove-nil {:a 1})))
07:38clojurebotjava.lang.Exception: Unable to resolve symbol: remove-nil in this context
07:39cemerickbartj: you can't define new fns in clojurebot's sandbox
07:40tomojbartj: great success
07:40tomojit seems a bit overcomplicated, though
07:40tomoj,(into {} (filter (comp nil? val) {:a 3 :b nil :c false}))
07:40clojurebot{:b nil}
07:40tomojoops
07:40tomoj,(into {} (remove (comp nil? val) {:a 3 :b nil :c false}))
07:40clojurebot{:a 3, :c false}
07:41bartjtomoj: yes
07:43tomojthe other day my boss did (dorun (map (fn [_] ...) (range 0 10))) instead of (dotimes [_ 10] ...)
07:43tomojI mean, you will get better at using clojure's expressivity if you keep using it
07:44bartjtomoj: that is a beauty
08:12bartjcan anyone point to a great reference to "code styling guidelines" for clojure
08:12bartjsomething like what Linus Torvalds has written for the the Linux Kernel (in C)
08:13bartjLink: http://www.linuxfromscratch.org/alfs/view/hacker/part2/hacker/coding-style.html
08:19bartjanyone?
08:22dnolenbartj: clojure mostly follows lisp conventions. One difference is the tendency to not mark constants since everything is immutable anyway.
08:24bartjdnolen: I find the above link by Linus the authoritative source on coding conventions, is there any such created by McCarthy or *the* reference?
08:24cemerickdnolen: I continue to believe that marking vars that should not be rebound with plus signs is good practice.
08:25cemerickbartj: this is the closest there is to a style guide: http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards
08:27hoeckbartj: http://norvig.com/luv-slides.ps
08:28bartjcemerick: my major beef is with indentation
08:29bartjcemereick: and the above link does not seem to have any comments on that
08:29bartjcemerick: and by that I mean, where to place the paranthesis
08:30sparievbartj: http://mumble.net/~campbell/scheme/style.txt
08:31cemerickbartj: I was just about to paste spariev's link :-)
08:32cemerickI prefer 2-space indents, but that's me.
08:32bartjhoeck: that link is a beauty :)
08:33Lajlabartj, are you Dutch?
08:33bartjfor eg: I wrote a definition which looks like this:
08:33bartj(def z (zipmap (keys a) (map (fn [x] (when (get a x) (get labels (get a x)))) (keys a))))
08:33bartjI have no clue where and when the paranthesis should start in a new line - sigh
08:33bartjLajla: no
08:35bartjspariev: thanks for the link. Just asking, are there any differences between scheme and clojure coding conventions - since, that link seems to be for scheme
08:37sparievbartj: you are welcome. I don't think there are many differences, thay both are lisps after all
08:37sparievs/thay/they
08:38sparievbtw, this link is mentioned in leiningen README
08:41cemerickThere's a variety of syntactic differences, which spill over to style.
08:42rhickeyhttp://groups.google.com/group/clojure/msg/16cc11e863625358
08:42sparievI'm not very knowledgeable about scheme, I should add :)
08:44SynrGrhickey: super. nice site, btw
08:45rhickeySynrG: thanks
08:47chouserrhickey: congrats!
08:47rhickeychouser: thanks!
08:48Lajla,+
08:48clojurebot#<core$_PLUS___3868 clojure.core$_PLUS___3868@1b149e1>
08:48LajlaCool
08:51bartjcan anyone confirm that it is not possible to view documentation for a symbol in vimclojure
08:52bartj*using vimclojure
08:53chouserthat seems unlikely. maybe \lw
08:54cemerickrhickey: congrats :-)
08:54rhickeycemerick: thanks
08:55bartjrhickey: perhaps, you would like to add a newsletter so that users can get info on discounts, training programs, schedules, etc.
08:56rhickeybartj: good idea
08:58cemerickrhickey: on a third reading, your role seems a little murky -- are you going to be working on Relevance projects, etc?
08:59rhickeycemerick: I will not be coding on Relevance projects, but I will be working with the team. And they will be working with me (on Clojure)
09:07chouserI'm a little surprised by the 20% time. Several companies these days spend that much time on various open-source projects without claiming it as some kind of core concern.
09:09rhickeychouser: what aspect is surprising?
09:09chouserit seems small
09:10chouserOf course I can't say it ought to be different or that it's somehow wrong, I just would have expected it to be a bigger slice of the company's time.
09:11cemerickMaybe 20% of the non-rhickey team members? *shrug*
09:12rhickeychouser: A commitment to dedicate 20% of developer time to specific projects seems like a large investment to me.
09:12rhickeycemerick: right, that number does not apply to me
09:12chouseroh, that's interesting. I assumed it did.
09:13chouseras in, maybe 100% of Rich's time, but none of the other 4 devs.
09:13cemerickYeah, that's part of the murkiness I was talking about before.
09:13chouseror it's friday, everybody close tickets for a day.
09:13cemerickrhickey: the impression I got was that you are Guido to Relevance's Zope, or something.
09:14rhickeycemerick: not sure I get the analogy
09:14rhickeychouser: yes, basically David, Stuart, Aaron et al will spend Fridays on Clojure itself
09:15cemerickrhickey: I might have the history wrong, but IIRC, gvr joined zope, which sponsored him working on python core "a lot", but he was part of the day-to-day at the company.
09:16chouserhmph. did I not have a patch that pointed out which line began an unclosed paren?
09:19rhickeycemerick: It is a joint venture, and I am not an employee of Relevance
09:25esjrhickey: an exciting development, nice !
09:26rhickeyesj: thanks
09:27s450r1Clojure/core seems like an excellent development to me. Seems like it means at least 4 extra people get to spend one day a week working directly on Clojure. Hope everything works out!
09:30rhickeys450r1: yes, thanks!
09:33cemerickha
09:34cemerickI do wish lispworks would jump over, though.
09:35chouserjump over?
09:36cemerickchouser: I want a clojure plugin for eclipse from them, or somesuch.
09:36chouseroh I see
09:36cemerickCan't imagine the CL space is a growth business.
09:36rhickeycemerick: I thought you wanted them to open-source it
09:37cemerickrhickey: I think it might be wise of them to do so, but no, that's not a key criterion for me (as long as the kit works)
09:37cemerickThe actual, current lispworks env has little value to me though. Can't imagine it'd ever get open sourced.
09:38cemerickrhickey: you should send them a note, prodding them to get into the clojure tooling biz :-)
09:39cgrandrhickey: congrats for clojure/core
09:39rhickeycgrand: thanks!
09:40cemerickrhickey: BTW, I wasn't trying to bring you down at all before -- just mirroring how I read the ann. Free message consulting, FWIW. ;-)
09:40rsynnottcemerick: lisp companies ALWAYS have crap-looking sites. It's traditional :)
09:40rsynnottcemerick: one nice thing that Lispworks has is an acceptable cross-platform GUI thing
09:40rsynnottoh, and a tree-shaker
09:40rhickeycemerick: that kind of feedback is very important right now, keep it coming. To the extent the message is confusing we need to fix it
09:40cemerickrsynnott: um, yeah...acceptable :-)
09:40rsynnottdistributing a desktop app with lispworks seems far more practical than, say, with sbcl
09:41rsynnottcemerick: there's no such thing as a good one :)
09:41cemerickrsynnott: swing is pretty darn good for what it gets you IMO
09:41chouserI thought qt-jambi had so much promise. :-(
09:42cemerickrhickey: in that case, the positioning of the relevance logo ahead of the clojure logo is a big signal IMO.
09:42rhickeycemerick: signal of what?
09:43cemerick(that coming from someone with (almost) no skin in the game, and I'm sure Stu & co. want maximum visibility for relevance)
09:43cemerickrhickey: that it is fundamentally a Relevance operation.
09:43cemerickchouser: yeah, that was a big loss
09:44cemerickI'm on the brink of seriously evaluating swt (again). We'll see how that pans out.
09:45cemerickrhickey: which, again, isn't a bad thing, but that's the impression IMO *shrug*
09:45rhickeycemerick: from the operations side, that's not incorrect - they are bringing their (quite sophisticated, IMO) agile practice to bear here
09:47eevar2meh. swt is never the right answer
09:48cemerickrhickey: well, the *operations* distinction is a fine one. People may assume clojure direction, etc. is determined by relevance., or that clojure.org is the "open core" of the more advanced clojure.com.
09:48cemerickeevar: it's just a widget toolkit. I find it hard to get worked up about them.
09:48rsynnottOh, yes; that's far too nice-looking to be allowed to be a commercial lisp site
09:49rhickeycemerick: I'm not sure I see that. This practice isn't selling Clojure itself, in any form. It is fundamentally a service company, based on Clojure, that also works to sustain Clojure.
09:50rhickeycemerick: what might help clarify that?
09:51rsynnottrhickey: perhaps swap the 'Why Clojure' and 'Why Clojure/core' sections?
09:51rsynnottas it is, the one saying that this particular website is is below the fold
09:52rsynnottso it does look a bit like clojure.com is the site for clojure itself
09:52rhickeyrsynnott: good point
09:52cemerickrhickey: insofar as one is familiar with "open core" business models, the fact that clojure/core is @ clojure.com, with open source bits @ clojure.org implies that alignment pretty strongly
09:53rsynnott(I initially thought it was something along the lines of erlang.se when I saw it
09:53rsynnott(erlang.se is a licensed erlang with support and certification)
09:55cemerickthe .com/.org relationship is pretty well established -- sugarcrm, zenoss, etc.
09:59rhickeycemerick: but barring giving up use of clojure.com (which I wouldn't consider), what's actionable? Just the logo order?
10:04cemerickrhickey: I'd drop the clojure logo entirely, and put a prominent link to clojure.org *saying* what is being linked to.
10:04arkahnIt seems pretty clear to me: Why Clojure speaks to the language and Why Clojure/core speaks to the services offered by Relevance. One change I would make is adding a "Learn More About Clojure" underneath Why Clojure and have that point to clojure.org
10:06cemerickBeyond that, a declaration of what the organization *is* is warranted. Is this just a PR site for relevance? A separate unit within relevance? A loose collaboration between some relevance folk and some community folk? The about page doesn't clarify these things either.
10:07arkahnfrom a business aspect, I realize you don't want to drive people away from the commercial motivation that is Relevance, but making a stronger distinction between clojure.org and clojure.com (while tying the two together) seems like a good idea
10:07rhickeycemerick: It's ok, I'm free to ignore it :)
10:08rhickeycemerick: I do think the lead paragraph here is clear - http://clojure.com/about.html
10:09cemerickrhickey: again re: the domains, punching "clojure" into many browsers will now go to clojure.com instead of the actual project (perhaps that intentional). Further, depending on the vicissitudes of google, the .com may end up ranking higher than the .org for a straight "clojure" search.
10:09cemerickrhickey: "specialized technical practice brought to you by..." is mud to me *shrug*
10:09Dawgmatixjust some feedback - the top center is what the user sees first, i think the front page under communicates what clojure/core does
10:10ChousukeI agree that clojure.org should be more clearly linked from the clojure.com page
10:10Chousukeperhaps link the first metion of "Clojure" in the intro paragraph to clojure.org?
10:11Chousukethat would make it stand out somewhat
10:11Dawgmatixhaving the first para from clojure.com/about.html on the front center on the mainpage would answer a new visitors questions on what clojure/core does instantly
10:11fogusrhickey: Cool Venn diagram. :-)
10:12cemerickfogus: did you catch that twitter convo yesterday re: macros vs. scala's call-by-name?
10:12foguscemerick: No I missed that one. Did someone say they are equivalent?
10:13cemerickfogus: that the latter are a superset, even!
10:13chousersomeone said macros are a subset
10:13cemerickI don't know what call-by-name is in scala, but I was surprised by that.
10:13chouserbut others jumped on that so I didn't have to. :-)
10:14foguscemerick: Cool! Can't wait until Clojure finally grows up and gets call-by-name :p
10:16Chousuke:P
10:16Chousukewhat languages have call-by-name?
10:16fogusSo call by name let's you do some of what macros give you, but uses currying, lambdas, and the fact that foo{} is a function call to make looping things. It's fairly nice, but I would never say it is a superset of macros
10:17cemerickoh, I found a tutorial I grok now
10:17Chousukelink?
10:17clojurebotyour link is dead
10:17Chousuke:P
10:17cemerickChousuke: http://www.naildrivin5.com/scalatour/wiki_pages/CallByName
10:17cemerickThat is just nutty.
10:18cemerickI love this: "The syntax => String is different than () => String; the first form indicates that a String is expected, but will be passed by name, not value; the second indicates a function taking no arguments and returning a String is expected. This is somewhat subtle, as you could certainly think of the first case as a no-arg function that returns a String."
10:18fogusIt's sugar
10:19cemerickyeah; it's the kind of sugar that makes ruby unintelligible to me, too
10:21fogusAnyone have a link to the superset comment?
10:21ChousukeDid someone actually claim that call-by-name offers a superset of the functionality of macros? :/
10:21cemerickyes
10:22cemerickfogus: http://twitter.com/eikke/statuses/14649976180
10:23ChousukeI'd say it's the other way around
10:23cemerickoh yeah
10:23fogusWell, I would say they are orthogonal
10:24Chousukethere seems to be some overlap.
10:24tomojhow could it be a subset?
10:24cemerickreally? Isn't c.c.logging doing exactly what the tutorial was showing, but with macros.
10:24cemerickAnd macros are obviously more capable than simple value substitution.
10:24fogusI meant orthogonal mechanisms
10:24cemerickah
10:25ChousukeCan you think of anything you can do with call-by-name that is not possible (or is significantly more difficult) with macros?
10:25fogusThe scala cbn is sugar on top of a higher-order curried function
10:26ChousukeI suppose you can't do compile-time computations with cbn
10:27fogusI can't think of anything that macros can't do, but I'm not fully conversant on the whole set of CBN use cases. :-)
10:31fogusA Twitter search for call-by-name is fun
10:37patrkrisdoes anyone know why Clojure does not use read time stamps in its implementation of MVCC, while database systems do (according to Wikipedia)? Why are databases concerned with read time stamps?
10:41stuarthallowaypatrkris: clojure cares about relative time
10:42patrkrisstuarthalloway: can you elaborate?
10:44chouserpatrkris: reads aren't tracked in clojure's STM, is that what you're referring to?
10:45patrkrischouser: yes
10:45patrkrisi was just looking at wikipedia's definition of mvcc, and in that definition, reads _are_ tracked
10:46patrkrisand I don't quite understand why that is necessary, when multiple versions are available
10:49rhickeypatrkris: that definition is biased towards databases, where you don't have GC 'tracking' of read references to older data
10:50rhickeypatrkris: and where tracking reads is nothing compared to I/O costs
10:50chousera read can cause a retry in clojure if the history isn't deep enough, right? is that true of db mvcc as well?
10:53patrkrischouser: seems to be the case in oracle at least
10:53chouserI'm having trouble thinking of any way it could be avoided.
10:54patrkrisrhickey: you're thinking about the I/O cost of potentially reading an older version from disk?
10:54chouserBack when I was using SQL DBs a lot, I don't think I had any idea transactions could be retried.
10:55patrkrischouser: none of us did - i didn't even use transactions, because I never thought I would have concurrent users :)
10:56chouserheh. well, I was using SQL Server and multi-threaded ASP, so we were definitely thinking about transactions. But apparently not as deeply as we thought we were.
10:57rhickeypatrkris: I'm just saying you're not going to see read tracking even addressed as an issue for disk-based MVCC since other factors dominate
11:10patrkrisrhickey: my problem is understanding why databases track reads, when it isn't necessary in e.g. Clojure? Do you have any idea? What does it give database systems? I am sure I'm just overlooking something.
11:10rhickeypatrkris: as I said, no GC in databases
11:11patrkrisrhickey: ah, and reading a version would create 'garbage' that would need to be be handled somehow?
11:11rhickeyso how would the db know it could reuse the disk space?
11:13cemerickrhickey: replaca brought up the notion of an available? fn (with accompanying addition to the reference interface(s)) last night; we talked about this a while ago (http://clojure-log.n01se.net/date/2009-08-18.html#11:34c) -- would you welcome a ticket?
11:16rhickeycemerick: same questions still apply - where does it go in the abstraction hierarchy, what about timeouts etc
11:17cemerickrhickey: Sure -- I just figure it'd be better to have a spot for that discussion. I'm lining up my early 1.3 wish-list items :-)
11:19rhickeycemerick: how about a design page on the wiki first?
11:19cemerickoh, sure
11:19rhickeyIMightDeref, IBlockingDeref et al
11:20Fossifaridcmi: any reason to query me?
11:21cemerickrhickey: so you're still opposed to just adding a method to IDeref (say, with overloads for timeouts)?
11:22rhickeycemerick: It makes no sense for many reference types
11:24cemerickrhickey: always returning true for those cases (atoms and refs, right?) seems reasonable *shrug*
11:25rhickeycemerick: could return true for numbers and collections too
11:25cemerickyou lost me there.
11:27rhickeycemerick: taking a boolean op and making it always return x given some y for which it makes no sense
11:27rhickeythe mere availability of available? might cause people to wonder
11:28rhickeyis a var or ref or atom ever not available?
11:28rhickeydo I need to protect against that?
11:29cemerickvars can be unbound, but I get your point
11:29rhickeycemerick: is there a problem with available? only being available where it makes sense?
11:30cemerickInsofar as a majority of impls of an interface usefully carry certain semantics, it seems fine to default the minority. IMO, of course.
11:30stuarthallowayseems like you would want available?-available? to check
11:30rhickeyyikes
11:30stuarthallowaysorry, had to be said :-)
11:30cemerickheh
11:30rhickey:)
11:30rhickeyavailable?-available? should take a timeout also
11:31rhickeyah, polling
11:32cemerickrhickey: no problem, no (aside from yet-another-interface). Given my majority/minority comment above, simply adding to IDeref seemed reasonable to me.
11:33remleduffWhy add it to IDeref interface instead of making an Available protocol?
11:35cemerickA good point. Where do things stand w.r.t. using protocols in core ("policy"-wise, perhaps)?
11:35rhickeycemerick: new abstractions are perfect candidates for protocols
11:37KirinDaverhickey: Is there a good example in the clojure code, or anywhere, that really shows what you envision protocols being best at?
11:37KirinDaverhickey: I get the gist, but I'm still not sure that I feel like I understand how they're really intended to be used.
11:37fogusKirinDave: have you looked at gvec.clj?
11:38KirinDaveNope.
11:38KirinDaveI will look right now.
11:38fogusThere is not much guidance WRT protocols there though
11:38fogushttp://github.com/richhickey/clojure/blob/master/src/clj/clojure/gvec.clj
11:38fogusBut it's a start
11:39cemerickThere's IOFactory in clojure.java.io as well. http://github.com/richhickey/clojure/blob/master/src/clj/clojure/java/io.clj
11:39rhickeyKirinDave: unfortunately the bulk of Clojure was written before protocols existed, but they'd be great for any of Clojure's abstractions currently implemented as interfaces, such as Seqable. Moving forward, some of these will be moved to protocols
11:41KirinDaverhickey: I see.
11:41fogusrhickey: Sorry if I missed an official announcement, but will cells make it into 1.2?
11:42rhickeyfogus: unfortunately not, simply not done yet
11:42KirinDaveIt's funny. I used to be a huge CLOS proponent.
11:42KirinDaveBut I really like the way this protocol code looks.
11:42fogusrhickey: OK, thank you. That gives me a reason to push for a 2nd edition one day. ;-)
11:42KirinDaveSingle dispatch is sorta limited, but people make do with it for the bulk of their time programming, I guess. :)
11:44rhickeyKirinDave: yes, and multimethods are not going away
11:45rhickeyKirinDave: but even when multiple dispatch is available, I would guess it is used less than 5% of the time
11:47KirinDaverhickey: In Clojure, you mean? :)
11:50KirinDaveThere does seem to be a fair amount of trepidation about the performance of multimethods in clojure. I've yet to find it to be a problem, but I guess I seldom write things where the tight loop is the bottleneck, these days.
11:51cemerickThey're absolutely fast enough for "app level" stuff -- it's just an additional fn invocation and map lookup.
11:51KirinDaveHow well do they jit down?
11:52KirinDaveI imagine if the type becomes stable over repeat invocations they'd be amenable to some pretty aggressive tracing optimizations.
11:52cemerickas well as it'd be able to optimize any other fn invocation, I presume
11:53KirinDaveHum.
11:53cemerickKirinDave: oh, but the method that is dispatched to will never get inlined, and the dispatch itself will never get JIT'ed
11:53KirinDaveI just wonder if the JIT could figure out that if there are type constraints matched earlier on, the map lookup could be skipped.
11:54KirinDaveI suppose the VM would have to become aware of what's going on directly to figure that out without some more aggressive trace-tree stuff.
11:54cemerickthe dispatch can't be optimized away given the way it's implemented right now. Multiprotocols might be a different story, but I don't know how far/near they are. Certainly not in 1.2.
11:57bartjrhickey: I am sorry to ask this...but has anyone asked you about the "Bus Factor" of Clojure? (http://en.wikipedia.org/wiki/Bus_factor)
11:59stuarthallowaybartj: what you would you do about the "bus factor" issue?
11:59fogusbartj: I imagine any language < 3 years old has the same bus factor
12:00esjset up a group of developers to work with key man so knowledge spreads ? oh wait...
12:01bartjstuarthalloway: I am not sure if a question as a reply is appropriate here...
12:01stuarthallowaybartj: all right then
12:02stuarthallowayif I were worried about the bus factor, I would (1) learn the tech and make a bunch of contributions myself
12:02stuarthallowaythen I would (2) encourage other people to do the same by helping get patches approved
12:02stuarthallowayand then, just maybe, build a sustainable business around growing (1) and (2) until the bus number factor gets lower
12:03stuarthallowaybut my question is a serious one: do you see something that is going undone here?
12:05replacarhickey: my idea was pretty much just to have an interface IDeref2 (name TBD) that has an extra bool isAvailable() method. The available? fn is just (if (instance? IDeref2 x) (.isAvailable x) true)
12:06replacainterested objects could implement that
12:06bartjstuarthalloway: er, you mean higher?
12:07stuarthallowaybartj: right. Sorry, I think in terms of risk, not the bus number metaphor
12:07replacarhickey: my primary interest here is so pprint doesn't hang crossing promises/futures, though laziness also poses some challenges here
12:07cemerickstuarthalloway: the bus factor notion is mostly a canard I think. Outside of what you just talked about, other people often look for something like a PEP as a check that there's some "sanity" around direction, etc. Most people aren't comfortable with hashing things out in irc. :-)
12:08cemerick(note that I'm absolutely not suggesting the establishment of a corollary process)
12:08stuarthallowaycemerick: I simply found today an amusing moment for the issue to come up
12:08stuarthallowayand don't we do a lot of hashing out here? :-)
12:08cemerickheh
12:08cemerickyeah, we do, but this ain't where the morts hang out, generally
12:09cemerickstuarthalloway: ironically, there will probably be *more* questions about "bus factors" and such for a while.
12:09cemerickThe chasm is *really* wide, depending on which one you're talking about. :-)
12:11mefestoI'm using c.c.http.agent in a script which seems to never terminate. I'm guessing some background thread is keeping it alive even though there's no more work to be done. Is a (System/exit) the way to go or is there another way?
12:11stuarthallowaycemerick: I wasn't on IRC earlier today, but we have made a bunch of website changes to clarify questions you and chouser brought up
12:11cemerickmefesto: Yeah, that's due to the agents using non-daemon threadpools
12:12cemerickA (System/exit 0) is fine; invoking (clojure.lang.Agent/shutdown) should have the same effect at the end of a script.
12:12cemerick(where shutdown tears down those threadpools)
12:13mefestocemerick: ok, thanks :)
12:13bartjI didn't mean to offend anyone asking inane questions, about bus factors...
12:13stuarthallowaybartj: no offense given
12:13remleduffOr (shutdown-agents) which does the same thing
12:13bartjI just read this - http://www.3ofcoins.net/2009/01/30/common-lisp-clojure-and-seriousness/ and it threw me off track - since I am pretty much *starting* learning clojure
12:14cemerickbartj: The term is a *little* silly, but the impulse is very natural for most :-)
12:14bartjcemerick: morts = mortals ?
12:14cemerickremleduff: ah, I didn't know about that -- been using the interop form for way too long...
12:15stuarthallowaybartj: clojure is abstraction-oriented, not merely implementation-defined
12:15stuarthallowaybartj: the article you reference is a gut reaction, lumping Clojure where it does not belong
12:16cemerickbartj: no, "Mort" is a term (perhaps slightly disparaging) used to refer to developers that don't really know a lot about CS, etc.
12:16alpheusIs it reasonable to create-ns a sandbox for experimenting and then remove-ns when you're done?
12:16cemerickbartj: originally talked about here: http://www.nikhilk.net/Personas.aspx
12:17stuarthallowaybartj: consider lack of stability
12:17cemerickMort == the fellow who puts HTML on his resumé as his primary programming language, etc., Elvis is a relatively decent developer, might put out some libraries here and there, Einsteins are people who write their own languages, etc.
12:17cemerickanyway...
12:17stuarthallowaysome languages *change* fast. Clojure is *growing* fast
12:17stuarthallowaythe difference being that there is very little deprecation or breaking change in Clojuer
12:18stuarthallowayin that respect it is more like Java than the so-called "toy languages"
12:20cemerickstuarthalloway: The changes are good. I suspect you'll still get questions along those lines, esp. from those coming into clojure totally green (I keep coming back to the domain names -- they're quite powerful branding devices). Anyway, as I said to rhickey, this is supremely not my business anyway. :-|
12:21AWizzArdSome changes though are a bit more breakish than others. For example, I noticed that duck-streams was renamed to clojure.contrib.io and now was renamed again.
12:21cemerickconrib is *not* the stdlib :-)
12:22stuarthallowayAWizzard: not renamed again. Both should be present, in order not to break people
12:22stuarthallowayAWizzArd: I am trying to prevent gratuitous breakage to contrib, if you see such, let me know
12:23stuarthallowaycemerick: your opinion and feedback are *most* welcome
12:23remleduffIs the current form of last-var-wins final? It seems like it will make it tough for library writers to support both 1.1 and 1.2 now
12:23stuarthallowayremleduff: example?
12:23cemerickstuarthalloway: well, don't go saying that. rhickey did, and look where that got him. ;-)
12:23remleduffSorry, just speculating
12:24stuarthallowayremleduff: not trying to put you on the spot! Hoping not to break people, and also to make it super easy to just go to 1.2
12:24remleduffBut what if you used flatten from contrib before? What should you do now?
12:25replacastuarthalloway: I was about to go through contrib putting deprecated tags on stuff (pprint, duck-streams, etc.). Should I go ahead and do that?
12:25stuarthallowayremleduff: if you want to still support 1.1, you can still use flatten, and it will work with a warning on 1.2
12:25stuarthallowayreplaca: that would be great!
12:25foguscemerick: It seems that macros are also a subset of C macros. :-) http://twitter.com/eikke/status/14703031487
12:26replacastuarthalloway: k. It's probably still a couple of days out. Swimming in the autodoc mire.
12:26cemerickfogus: I *knew* it! Screw you guys, I'm gonna sling some C.
12:26foguscemerick: According to TIOBE you should be able to find a lot of work
12:27cemerickfogus: I got a job before you even msg'd me back. C *and* Tiobe FTW!!1!
12:27remleduffstuarthalloway: Actually, better example. What if your library defines a name that is now taken by core? At one point with last-var-wins, your version would win, now I think core's will win?
12:27cemerickeh, long day already :-P
12:28stuarthallowayno, your version still wins
12:28stuarthallowaywith a warning
12:28remleduffOh, I misunderstood the last commit then, sorry
12:28remleduffTHought it made last-var-wins only work for core
12:28cemerickremleduff: refers to core always defer to what you have in your ns.
12:28stuarthallowaysomebody probably made a crappy commit comment :-)
12:33remleduffIs anyone around who could give me permission to post on clojure-dev?
12:43remleduffQuestion about protocols: Is the following a reasonable expectation, or is Impl expecting too much for its methods to survive this? http://gist.github.com/410416
12:44remleduffIn current master, it throws a "method not found" exception
12:50remleduffIf you don't want to look at the gist, it's defining a protocol, extending it to a type, removing the functions from the protocol, then adding them back to the protocol.
12:51remleduffAfter that sequence, the protocol is no longer extended to the type
12:51remleduffWhich is fine, but less convenient for somet things
12:52remleduffGuess I'm all alone, talking to myself. ;)
12:59remleduffOK, so even redefining a Protocol to have only exactly the same or only new methods still loses all extenders
13:00remleduffSo I guess defprotocol really implies a completely clean slate for the protocol
13:03remleduffHmm, that's not completely true either
13:05dnolenremleduff: I'm not a protocol expert but in general you can't do overly "dynamic" things with them. That's not their purpose anyway. If you want a ridiculous amount of flexibility/dynamism use multimethods.
13:05remleduffOK, so redefining a protocol with no changes, preserves extenders. Adding or removing methods to the protocol, makes a clean slate
13:05hoeckremleduff: thats a bug
13:06hoeckno, sorry, that was another one, where reevaluating a deftype does nothing
13:08remleduffAnother question, is it intentional that it's fine to only partially implement a protocol?
13:09stuarthallowayremleduff: yes!
13:11remleduffOK, but satisfies? checks that it completely implements the protocol
13:18remleduffActually, not sure I understand what satisfies? is testing
13:19remleduffI really like source being imported into the repl by default :)
13:22remleduffSo extenders? returns the list of classes that extend a protocol with "extend", "extend-type" or "extend-protocol", it doesn't give you classes that define a protocol inline? ... Is there any way to get the full list of all classes that are implementing the protocol?
13:24remleduffAlso, there's the same split between satisfies? and extends? Both of which kind of lie -- if your users don't fully implement the protocol, you can potentially get an AbstractMethodException for any invocation of a protocol method.
13:25stuarthallowayyou can't get all implementers of a Java interface either
13:25stuarthallowayand they can also lie
13:26stuarthallowayboth of which are things Java does right, IMO
13:26stuarthallowaythis feels a little academic, what are you trying to do?
13:27remleduffI was creating a test case for an issue, but I'm trying to understand if it's actually an issue or just a problem with my understanding of the intent
13:30remleduffI'm don't like having the low-level satisfies? and extends? predicates without any abstract satisfies-or-extends? predicate. Why should an implementer care how the Protocol was extended? And that same dislike falls through to the "extenders" function I guess.
13:31remleduffs/I'm/I/
13:31stuarthallowayfrankly I don't use these fns
13:32stuarthallowaymaybe we have done too much, rather than not enough
13:32remleduffI can definitely see that argument
13:35remleduffI don't think extenders is implementable in a way I would consider useful (at least without doing some sort of classpath search), because it only catches half of the classes that implement the protocol
13:37stuarthallowayit
13:38remleduffAnother question: Is there any way to ask, given a function and some arguments, what function is going to be called? I'd like to get the var so I can call print-doc or source on it. I had the same question with multimethods as well, sometimes it can get a little hairy figuring out what is being called.
13:40slyphondoes compojure's daddy hang out in here?
13:45LauJensenslyphon: no, but he's very active on the group
13:45slyphonah
13:46LauJensencompojure group that is
13:46slyphoni'm trying to do something slightly wacky, i can't use the jetty-server-setup conveniences, unfortunately
13:48LauJensenWhat are you trying to do ?
13:48slyphonwell, i have a jetty server that I constructed myself that's supporting an XMLRPC servlet
13:49slyphon(constructed programmatically, that is)
13:49slyphonso now i need to add on a small REST service
13:49slyphoni guess i could spawn another Jetty on a different port
13:49slyphonbut that seems kind of...ew
13:50LauJensenslyphon: maybe this helps? http://groups.google.com/group/compojure/browse_thread/thread/f718748a32331375/798b33a018ea9141?lnk=gst&amp;q=rest#798b33a018ea9141
13:51slyphonLauJensen: hrm
13:51slyphonLauJensen: i'll have to study this
13:52slyphonLauJensen: but thanks :
13:52slyphon:)
13:52LauJensennp
14:12cemerickfogus: you forgot the inflammatory, baiting headline: "The problem with perl is parsing."
14:12cemerickbeat me by mere seconds, you did! :-P
14:12foguscemerick: There's still time for me to edit. :-)
14:13cemerickThat's where the money is!
14:13cemerick:-)
14:14fogusActually I should have Simply said "Perl sucks. JVM Clojure Scala Erlang Arc Paul Graham"
14:14cemerickyup, then resubmit 3 weeks later with a different link and shuffle the keywords
14:15KirinDaveHackernews has really been pissing me off lately.
14:15KirinDaveA lot of unreasonable people who are scala proponents seem to have fox'd my six.
14:15LauJensenfogus: what the headline on HN?
14:15KirinDavehttp://news.ycombinator.com/item?id=1375199 (this keeps happening)
14:16cemerickKirinDave: then you must not watch the twitters. The macros/call-by-name thing keeps getting better.
14:16LauJensenoh, found it
14:16KirinDavecemerick: Please reference me. I love torturing myself.
14:17cemerickKirinDave: you can just keep refreshing this, or @eikke's feed http://search.twitter.com/search?q=clojure+call-by-name
14:18KirinDaveHaha
14:18KirinDaveVery first one.
14:18KirinDaveWhattttttt?
14:20cemerickhrm, that's four down-with-scala conversations here in as many days.
14:20cemerickor, maybe more generously, "Golly, those scala folk are funny sometimes."
14:21LauJensencemerick: you mean, people are knocking scala?
14:21KirinDavecemerick: i actually rather like scala.
14:21KirinDave cemerick: Not as much as clojure, but it's a fairly good iteration on Java.
14:21cemerickLauJensen: it gets knocked with some regularity, yeah.
14:21fogusKirinDave: I love this http://news.ycombinator.com/item?id=1375166
14:21LauJensenah ok
14:21cemerickKirinDave: which is to say...... ;-)
14:21cemerick~scala?
14:21cemerick,scala
14:21clojurebotjava.lang.Exception: Unable to resolve symbol: scala in this context
14:22cemerickhrm, used to have some funny sayings
14:22LauJensenscala would actually win more than a few comparisons against Clojure even still
14:22KirinDaveSure.
14:23cemerickEvery now and then I get the urge to give it another whirl. I do really like static typing, but then it screws me.
14:23LauJensencemerick: eh? Static typing is a pure money maker
14:25cemerickLauJensen: lots of consulting hours? ;-)
14:25LauJensenexactly
14:25LauJensenIts the fastest way to turn a 500 hour project into a 550 hour project
14:25cemerickwell see, I don't do consulting :-)
14:25LauJensenoh
14:25LauJensenYes then its bad, because it adds no real value to the product
14:26cemerickI wouldn't say that at all, but there are absolutely downsides to be aware of.
14:26fogus"Scala is just a misguided attempt to dumb-down Haskell to the level of the peasantry" -- Fake Tony Morris
14:27LauJensenCruel :)
14:28cemerickI think it's remarkable that MS is where a top-notch, widely-supported, statically-typed FP lang came from.
14:28KirinDavecemerick: It's the only thing that keeps me warm at night
14:28KirinDavecemerick: C# is a pretty grisly scene.
14:28KirinDavecemerick: Not only is it an ugly language with lots of fiddly legacy syntax
14:28cemerickKirinDave: oh, you're in MS-land, aren't you?
14:28KirinDaveYes
14:28KirinDaveI am an employee for now.
14:29KirinDaveVest in peace.
14:29cemerickright, powerset
14:29replacaKirinDave: do you know that you work downstairs from me?
14:29KirinDaveBut C# also has bad class design
14:29ordnungswidrigWhen I read about darcs and the sophisticated use of static typing, higher rank types, phantom types and all those stuff the compiler… Then I come to the conclusion to stay with dynamic typing and throwing a bunch of unit tests on it
14:29KirinDavereplaca: Please tell me you're with ustream.
14:29replacano 3vr, why?
14:29KirinDavereplaca: Or are you from that other company, 3vr
14:29KirinDaveAh
14:29cemerickhearing about what Miller's going through with ClojureCLR makes me a little scared
14:30replacapissed @ guardian :-)
14:30replaca?
14:30KirinDavereplaca: I want to give a friendly shit-talking to the ustream people for having 40 employees and 2 floors
14:30replacaahh!
14:30KirinDavecemerick: The CLR is not the raddest virtual machine around.
14:30replacaplanning for growth!
14:30KirinDavereplaca: Yeah yeah yeah
14:30cemerickKirinDave: I don't know anything about its internals, and it sounds like I don't want to.
14:31replacawe should take a coffee break and chat clojure-y stuff one of these days
14:31cemerickikvm has shielded me from it, lo these many years
14:31KirinDavecemerick: Like all things, MS takes great ideas and bones them
14:31ordnungswidrigKirinDave: *g*
14:31KirinDavereplaca: Sure. I think Ive met another guy from up there too who was doing 3vr stuff.
14:31chouserI think what Miller's doing is fantastic.
14:31KirinDavechouser: No one is saying otherwise, i think.
14:31replacayup, there are a whole bunch of us.
14:32chouserI want Clojure everywhere, and that means having a variety of hosts pushing concerns up into Clojure
14:32replacanot much clojure though
14:32KirinDavechouser: It's just what he's doing is the equivalent of wading into gunfire a la robocop.
14:32cemerickchouser: god's work, it is. I jsut don't envy him.
14:32chousercemerick: I'm with you there.
14:32KirinDaveCue robocop theme, cue cheap ricochet effects.
14:32replacaKirinDave: Zach Tellman (the penumbra guy) used to work here too, but he went off to google
14:32KirinDaveHuh
14:33stuarthallowayfogus should move the local value of nearby south a bit
14:34replacaQ: Does anyone have a pointer to the "offcial" keyword arg syntax that Rich added?
14:34chouserfogus_: my plan is to tkae people who are working nearby and cause them to become interested in Clojure.
14:34KirinDaveSo I'm supposed to ask around. Who here isn't working on a clojure book but would be interested in the massively painful process of doing so? I'm friends with a friend of a publisher who's trying to get a new book rolling.
14:34KirinDavechouser: I keep trying to do this to coda hale, but he keeps denying me on account of the parenthesis. :(
14:35chouserKirinDave: I can sympathize with that reaction, sad though it is.
14:35fogus_chouser: I always just hoped I wouldn't have to do any work. ;-)
14:35chouserI was solidly there before "on lisp", and even after only reluctantly willing to put up with parens to get at good macros.
14:36cemerickKirinDave: Some nut on twitter suggested I should write one. I think it was actually chouser in disguise, looking for company. ;-)
14:36chouserhehe
14:36chousernice try, but I have good company already.
14:36KirinDavecemerick: If you're interested, email me and I can connect you with people who want to do one
14:37chouserKirinDave: even then, I spiked lisp-like macros for JavaScript
14:37KirinDavecemerick: I think the thrust is to do one more friendly to people with no prior lisp experience. Evidently that is a major complaint about existing books.
14:37fogus_chouser: I tried that before too! My head still hurts
14:37cemerickheh, that'd be hilarious
14:37KirinDavechouser: The thing is, most languages have at least as much decoration as clojure.
14:38cemerickI've always tried to channel the common java dev, but that's a tall order.
14:39replacano help on keyword args? example? I saw the checkin, but I didn't see any guidance.
14:40chouser,((fn [a & {:keys [b c d]}] [:args a b c d]) 1 :c 3 :d 4)
14:40clojurebot[:args 1 nil 3 4]
14:40KirinDaveC# rage. Smash it all
14:40Raynesreplaca: (defn wtf [args here & {:keys [onearg twoarg] :or onearg "something" twoarg 3}])
14:40KirinDaveProperties can be set via reflection with a 3 argument method. Fields can be set via reflection with a 2 argument method.
14:40KirinDaveType dispatch if clouds, ahoy
14:41KirinDaveHate this job.
14:41DeusExPikachuis it possible to define namespace qualified vars?
14:41chouserall named vars are namespace qualified
14:41chouseror rather belong to a namespace
14:42DeusExPikachu,(def foo/bar 'foo)
14:42clojurebotDENIED
14:42KirinDaveha
14:42DeusExPikachugives me exception
14:42chouserDeusExPikachu: you can't with 'def'. What are you trying to do?
14:42chouseryou don't want to enter the namespace first with 'ns' or 'in-ns'?
14:43arohnerDeusExPikachu: there's with-ns in contrib somewhere
14:43replacaRaynes: thanks!
14:43arohnerit's something like (with-ns 'foo (def bar ...))
14:43chouseryou can use 'intern', but you usually shouldn't
14:43DeusExPikachuchouser, its a macro that defines calls def, but I need it defined in the current ns not the one where the macro is defined in
14:43replacachouser: you too!
14:44chouserDeusExPikachu: if your macro expands to (def foo ...), that'll define foo in the ns where it's expanded -- sounds like what you want.
14:44chouserif you're providing the name in the macro itself, you may be getting "Can't refer to qualified var that doesn't exist"
14:44DeusExPikachuactually technically its not a macro that expands into a def, its a macro that expands into an eval form that contains a def
14:45replaca(defn wtf [args here & {:keys [onearg twoarg] :or onearg "something" twoarg 3}])
14:45replacaoops, putty probs! :-)
14:45chouserDeusExPikachu: you're calling eval in a macro? that's likely to hurt you later.
14:45clojureboteval is DENIED
14:45fogus_cemerick: So this about sums up my thoughts on the matter (from a chat the other day) http://www.codecommit.com/blog/scala/working-with-scalas-xml-support
14:46DeusExPikachunot calling eval in macro, eval is in the expansion
14:46KirinDaveMan, calling eval in a macro is almost always a sign something is wrong.
14:46chouserhm. still dangerous. are you sure you need to call eval?
14:46KirinDaveI mean, a macro is an elaborate way of prepping an eval.
14:46DeusExPikachuyes, cause eval starts up a new classloader
14:46Raynesclojurebot: Shush.
14:46clojurebotexcusez-moi
14:46chouserah.
14:47chouserwell, ok. even so, (eval '(def foo ...)) should use the namespace into which that's expanded.
14:47chouserwhat problem do you have?
14:47DeusExPikachuchouser, ok, I'm having problems accessing foo though
14:48DeusExPikachuchouser, as in it doesn't exist after running macro
14:48cemerickfogus_: I'll have to catch this more fully later, but wow, scary stuff.
14:50chouserDeusExPikachu: (eval `(def foo ...)) should return the var that is defined, which knows it's fully qualified name
14:50chouserI just tried it here and it seems to work as you want.
14:50KirinDaveMan, this eikke stuff is awesome.
14:50cemerickfogus_: it seems to me that stuff like this should just be deathly poison w.r.t. retaining developers. i.e. scala looks just great until 6 months later you're knee-deep in xml literals and looking around for a life preserver somewhere.
14:51cemerickeh, 90% of folks probably don't bother / mind
14:51KirinDavecemerick: I think that's a problem too.
14:51KirinDaveAnd I see it happen with scala peeps around me.
14:52KirinDaveAll sighing and looking long faced, "Man programming is hard."
14:52KirinDaveBut I suppose the same could be said of macros.
14:52chousermacros are *fun*
14:52KirinDaveAll of it requires discipline. :)
14:52chouserbut rarely needed
14:52cemericknot IME, but mileage varies
14:53SynrGthe trick is to reduce all complex problems to trivially solvable problems
14:53cemerickI had that "programming is hard" feeling at the end there, when scala ~2.7.1 came out? Rough times.
14:53SynrGthen all programming is easy
14:54fogus_In talking to devs I've found that those who ran away initially thought they were learning Java++
14:54fogus_(Scala devs that is)
14:54cemerickthat *is* its billing AFAICT
14:54cemerickor Java.Next or some other silliness
14:57fogus_Yeah you would think so, but then you go and look at code by Tony Morris, Jonas Boner, or Daniel Spiewak and that is quickly dashed away
14:57chouserreading that scala xml page makes me think "writing a language is hard"
14:57chouserThe complexities in Clojure's implementation are quite localized.
14:58chouserPersistentVector is complex, but the API is simple. localized complexity.
14:58chouserThe reader is complex, but it's output is simple.
14:59cemerickbut those guys know what they're doing very deeply. If the sell is java.next, but the reality is, you need to be Jonas to really sing with it, that should be game over.
14:59DeusExPikachuchouser, here is the paste, maybe you might see something I'm not seeing http://paste.lisp.org/display/100473
14:59chouserThe STM transaction system is complex, but doesn't touch the compiler or the persistent collection implementation, etc.
14:59cemerickThe question is, do you need to be a cgrand (for example :-)) to sing with clojure?
14:59fogus_cemerick: That's my humble view
15:00DeusExPikachualso, dj.cli.repl/main is called externally to start the repl
15:00chouserThe compiler/emitter may be the biggest undividied complexity, and I want to split that into 2 and document the interface.
15:01fogus_Oh yeah, the Clojure compiler code makes my head spin
15:01chousertoo much java
15:01fogus_But that is my own fault for looking at it.
15:01chouserheh
15:02fogus_I think that Scala is really really really complicated in implementation so that the user experience is only really really complicated
15:04LauJensenfogus_: isnt that just because you aren't comfortable with it ?
15:04fogus_LauJensen: With Scala?
15:04LauJensenyea
15:06replacaRaynes: small correction to your example: (defn wtf [args here & {:keys [onearg twoarg] :or (onearg "something" twoarg 3)}])
15:06fogus_LauJensen: Maybe that's it.
15:06LauJensen:)
15:06Raynesreplaca: Small correction to your example: (defn wtf [args here & {:keys [onearg twoarg] :or [onearg "something" twoarg 3]}])
15:06Rayneslrn2sqrbracket
15:06Raynes;)
15:06replacaRaynes: parens around "or" pairs
15:06RaynesIt doesn't have to be parens, I'm fairly certain.
15:07replacayes, or square brackets, doesn't matter. I was going from Rich's destructuring examples
15:07chousermaybe LauJensen doesn't realize fogus_ has contributed to Scala.
15:07LauJensenchouser: No I had no idea
15:07replacawhich are old before the tyranny of square brackets was fully established
15:08LauJensenfogus_: I didn't mean it in a derrogatory (?) manner, but rather that people who only rate scala as 'really really' complex, usually havent tried it enough to realize its much more complex than that
15:08chouserDeusExPikachu: ok, something squirrely is going on there. don't have my finger on it yet.
15:08DeusExPikachuchouser, thanks for taking a look
15:09chouserDeusExPikachu: for one, you shouldn't quote the namespace name in 'ns'
15:09fogus_LauJensen: I see. I guess my background gave me enough chops to rate as only a double-really n00b.
15:09chouserbut I assume that's an artifact of the paste, or you'd have different errors. :-)
15:10DeusExPikachuchouser, oh yeah, hehe, I hand typed that
15:11DeusExPikachuthere's other fluff I removed for clarity
15:13chouserDeusExPikachu: something's swallowing an exception.
15:13chouserCan't let qualified name: dj.classloader/classloader
15:14DeusExPikachuah, ok I'll work on that
15:15chouserdon't think you need let there at all
15:16DeusExPikachuchouser, actually yeah, I had some defn's earlier cause I was writing some clojures but in the paste yeah Its not needed
15:17chouserI remain dubious that this is the best angle
15:17chouseryou can't just create a classloader of the sort you need?
15:18patrkrischouser: is clojure.contrib.command-line the defacto choice for command-line parsing?
15:19DeusExPikachuchouser, I suppose I could, but I'd prefer to reuse existing clojure tools, also I don't know how to do that ATM
15:19chouserpatrkris: I think the defacto choice for command-line parsing is to not do it all. :-/
15:19patrkrischouser: Hmm... but I need to do it :)
15:20chouserpatrkris: that's because you're in the only unixy mindset. In javaworld, we are already in a JVM and just make method calls.
15:20chousersorry. not helpful.
15:20DeusExPikachuchouser, hmm I simplified it but still can't get the-cl to be resolved in the new repl, `(eval `(do (def the-cl 'foo) ~~@body))
15:20patrkris:)
15:21chouserpatrkris: My point is that I think there is no command-line parser that is heavily used. If command-line is sufficient for you needs, have at it.
15:21patrkrischouser: Ok, thanks :)
15:22patrkrischouser: helpful documentation also: http://richhickey.github.com/clojure-contrib/command-line-api.html :)
15:22DeusExPikachupatrkris, I think jline was mentioned by stuarthalloway
15:22patrkrisDeusExPikachu: Will check it out. Thanks.
15:23chouserbleh. yeah, sorry about that. There's a barely-more-useful example in a comment at the end of the .clj file.
15:31chouserDeusExPikachu: it's probably still eating your exception.
15:31DeusExPikachuchouser, probably, I'm playing with macroexpand right now
15:31chousergood
15:32chouseralso try calling (with-new-classloader :done) or something
15:32DeusExPikachuoww my eyes... so much clojure.core...
15:32technomancyKirinDave: coda's too smart to really let the parens be blocking him; it must just be his excuse for something else.
15:33DeusExPikachuis there a pprint version of macroexpand?
15:33chousermacroexpand just returns the form -- you can pass that to pprint
15:34chouserpprint's code printer can do nice things to it too, but I haven't figured out how to call that conveniently
15:34replacaDeusExPikachu: yeah, but it's more complex than that. you want to bind code-dispatch
15:36replacaDeusExPikachu: see the example here: http://richhickey.github.com/clojure/doc/clojure/pprint/PrettyPrinting.html
15:36replacaunder "Dispatch tables and code formatting"
15:37replacaBTW, I'm thinking I'll probably add a pp-macroexpand for those not using slime (slime already has it built in)
15:37vu3rddtechnomancy: ping
15:38DeusExPikachureplaca, where's *code-dispatch* defined in?
15:39stuarthallowayreplaca: name it "wtf?" for "what-the-form?" :-)
15:39cp2heh
15:40vu3rddtechnomancy: Sometime back I was trying to build leiningen using ant for packaging up into debian. Facing some problems with it.
15:40technomancyvu3rdd: hmm... danlarkin did that for homebrew; I'd imagine you could take a look at his fork and re-use the stuff he did.
15:41technomancyvu3rdd: also ieure did it for macports
15:41vu3rddtechnomancy: yes, I reused most of ieure's stuff. I also made a maven pom.xml which works quite fine and creates the jar.
15:41replacaDeusExPikachu: clojure.pprint (oh, but it doesn't have the *'s anymore, I'll update the doc) => just "code-dispatch"
15:42vu3rddThe problem is that, lein deps hangs with the created jar.
15:42vu3rddit copied the deps. But seem to be doing something else after that..
15:46vu3rddtechnomancy: I tried AOT compiling not just the core, but all the namespaces. I also used the exact versions of the ant and ant-launcher dependencies (which are slightly older than the current releases)
15:46vu3rddbut no success.
15:50technomancyvu3rdd: I think the hang-after-deps is fixed in the latest lein; it was due to a maven bug, and we rolled back to an earlier maven.
15:52vu3rddtechnomancy: you mean the maven-ant-tasks jar version?
15:52technomancyright
15:53vu3rddok. Let me try. Thanks for the help
15:53vu3rddLooks like I have a new version of maven-ant-tasks
15:55vu3rddtechnomancy: success
15:55technomancygreat
15:55vu3rddmany thanks
15:55vu3rddI spent the whole day here trying to figure out what the problem is
15:55technomancyurk; sorry about that. =\
15:55technomancyit will be great to have a .deb available.
15:56vu3rddsure, it is definitely on the way to the archive in a week or two
15:56lancepantzvu3rdd: i spent about 5 hours trying to figure that one out too last week :)
15:56technomancyvu3rdd: we've got some issues with the repl task and ant's stdin support that's blocking a release of lein 1.2 unfortunately
15:57vu3rddgetting lein into debian is absolutely essential to pave way for the rest of clojure packages
15:57vu3rddlancepantz: oh! I should read irc and lists more carefully.. :-(
15:57lancepantzvu3rdd: there's an issue that references it on github
15:57technomancyI need to post that problem to the ml to get more eyes on it. did you just grab the latest git version or the 1.1 stable?
15:58vu3rddtechnomancy: latest git
15:58vu3rddI tried several versions today. I also tried 1.1.0. Every time I thought I had done something wrong since I was creating a leiningen jar myself.
15:59technomancyvu3rdd: I had to break the repl task in order to get things working consistently on OS X. since that's not an issue with .deb, perhaps you should work from a slightly older version where the repl task was ok.
15:59Drakesonhow can I generate an interface that has a function that takes an array as an arg?
15:59vu3rddtechnomancy: Ok. Let me try 1.1.0 again with this change
15:59technomancyvu3rdd: can you post to the mailing list about it so I can get back to you about it after work?
15:59vu3rddtechnomancy: sure
16:00vu3rddI will do that right away
16:01chouserDrakeson: arrays derive from Object
16:01DeusExPikachuchouser, hmm it was a backquoting problem, changed (defmacro [] `(eval `(do stuff...))) to (defmacro [] `(eval (do stuff..)), that was a bit unintuitive cause eval normally requires a quoted form
16:02chouserthat eval's not doing anything useful
16:03DeusExPikachuchouser, not at the moment, but in the actual code, I bind the-cl to the classloader that changes when eval is called, a side effect
16:03chouserI mean the stuff inside (do ...) is being evaluated and the results passed to 'eval', which is probably not what you want.
16:04DeusExPikachuchouser, oh....
16:05lambdatronicHowdy everyone. I'm wrestling with the mighty abyss of classloader hell, and I'm hoping someone can give me some advice.
16:06vu3rddtechnomancy: just posted a message to the lein ml
16:07lambdatronicI have a JPF application which manages a collection of Java "plugins", each of which has its own classloader instance.
16:09lambdatronicOne of these plugins contains clojure-1.0.jar. However, the other plugins also want to make use of clojure without generating a new instance of the runtime, since it's expensive and would prevent the plugins from sharing code.
16:10lambdatronicIn order to make this work, we hacked RT to make its class loader publically available to the plugin code we wrote. Then we have had to switch out the classloaders by hand each time we wanted to read some clojure code from any plugin.
16:10lambdatronicThis is substantially inelegant.
16:12lambdatronicNow to make the situation worse, I have a second library which was built on top of Clojure 1.2-master-SNAPSHOT, that I want to integrate into one of these plugins, but clearly this isn't going to be readable by the Clojure 1.0 which the system is already using.
16:12lambdatronicWhat I'm wondering is this:
16:13lambdatronic1) How does *use-context-classloader* work in Clojure 1.2 (since it seems to be defaulting to true now rather than false)?
16:14lambdatronic2) Which class loader does an AOT-compiled application use (i.e. clojure's DynamicClassLoader or the System class loader)?
16:16lambdatronicAny takers?
16:16chouseryou're in deep, man.
16:16lambdatronictell it like it is.
16:16chouser:-)
16:16lambdatronicI didn't design the JPF application. I wrote the Clojure 1.2 library, and the JPF app designer wants to use it. Major integration clusterfuck.
16:17chouserI have hardly anything to offer. I seems that AOT-compiled code is loaded by whatever classloader you ask to load it. They're just .classes
16:17chousers/is/would be/
16:17lambdatronicYeah, but there's something a little tricky there that's escaping me.
16:18chouserhave you looked at Clojure's code around *use-context-classloader*
16:18chouser?
16:18lambdatronicWhen you AOT-compile a class that has a (:gen-class) form in its ns macro, you get a myns.class, myns_init.class, and myns_loading-somethingorother.class
16:18chouserI don't really understand it, but I could help you find it if you haven't already. Maybe it would make sense to you.
16:18lambdatronicbut the classes that don't use (:gen-class) just get the init and loading versions.
16:19chouseryes
16:19lambdatronicI've been digging around in it and parts of JPF for most of the day.
16:19chouserok. I don't grok classloaders sufficiently to be of much help.
16:19lambdatronicSo here's the rub: do the init and loading classes use the DynamicClassLoader or not?
16:19chouserhaven't had a need to understand them, so my attempts to read don't stick well.
16:20lambdatronicYeah, it's seriously frustrating. I don't grok it well either, and I've tried reading everything I can from googling, looking at the clojure mailing list, etc.
16:20chouserI was able to run AOT-compiled clojure code in a java applet sandbox, as long as no reflection was ever used.
16:20chouserI think that indicates that the DynamicClassLoader isn't used for AOT-compiled clojure.
16:21lambdatronicCould you give me some more details?
16:21lambdatronicright, that's my understaning from what I've read.
16:21lambdatronicI'm wondering if the non (:gen-class)ed classes that generate init and loading class stubs fall under that rule.
16:21lambdatronicor if I have to (:gen-class) all of my namespaces.
16:21lambdatronicI just have no idea how to test it.
16:21chousergen-class doesn't change anything about the other classes for that namespace.
16:22lambdatronicright, of course.
16:22chouserit just generates an extra class.
16:22lambdatronicYes, I know.
16:22chouserso failing to generate that class shouldn't have any effect on how the others are loaded.
16:22lambdatronicAnd that extra class clearly doesn't use the DynamicClassLoader.
16:22lambdatronicalright, fair enough.
16:23lambdatronicthe funky thing is that apparently clojure uses a new DynamicClassLoader for each eval.
16:23chouseryes
16:23chouserto overcome problems with PermGen overflow
16:23lambdatronicand this allows for redefining vars and such, I understand.
16:23lambdatronicah.
16:23lambdatronicinteresting.
16:24chouserI think redefining vars doesn't need extra classloader instances.
16:24chouserI'm not sure about redefining record types
16:24lambdatronicoh right, damnit that's what I meant. I read that earlier.
16:25lambdatronicwell, there's this *use-context-classloader* global that rich added awhile back which apparently default to nil.
16:25chouserI haven't looked deeply at the implementation of the compiler since deftype was added. I'm sure it's not simpler than it was. :-P
16:25lambdatronicand when it's bound to true, the thread class loader is used as the parent of the dynamicclassloader rather than the system classloader.
16:25chouserhm, ok.
16:25lambdatroniconly now, in clojure-1.2 it's defaulting to true, which is confusing me.
16:26lambdatronicand a lot of the code that seems to have tested for this value in the compiler is all commented out.
16:26lambdatronicso now I'm wondering if the default behavior changed and what the heck does that mean for me
16:27lambdatronicsorry, I appear to be bitching without any real solution here.
16:27chouseryeah, I'm afraid the lack of response means nobody who knows more is paying attention.
16:27chousermight be worth dropping a note on the google group.
16:27lambdatronicguess not.
16:27lambdatronictrue true.
16:28DeusExPikachuhmm didn't know eval changes the ns
16:28lambdatroniceh?
16:30lambdatronicwell off to set up the sandboxes again...thanks chouser.
16:30chousersure -- sorry I couldn't help.
16:31lambdatronicit happens. we'll meet again. we always do.
16:31chouser:-)
16:31lambdatronic;-)
16:32DeusExPikachuso I changed my code now to (defmacro foo [] `(eval '(do (def ~'the-cl 'foo) ~@body))), I call this macro in another file, (foo (clojure.main/main)), and in the repl, the-cl is in the 'user ns, not the ns where foo is used
16:33ChousukeDeusExPikachu: why are you generating an an eval expression?
16:34DeusExPikachuChousuke, (def the-cl 'foo) should really be (def the-cl (clojure.lang.RT/baseLoader)), i'm grabbing the new classloader
16:35Chousukebut couldn't you just do (defmacro foo [] `(do (def ~'the-cl 'foo) ~@body)))
16:35DeusExPikachuChousuke, I'd grab the current classloader, instead of the new one that baseLoader is bound to after running eval
16:36Chousukeso eval changes the classloader? :/
16:36ChousukeI see.
16:36DeusExPikachufrom my understanding
16:36DeusExPikachuthat way after the eval exits, so does the classloader
16:37DeusExPikachubut I'm having trouble with the nested quotes right now, can't figure out the right combo to get the-cl in the correct ns
16:38DeusExPikachuit needs to be in the ns of the caller of the macro
16:43remleduff_You're trying to find the classLoader that created the namespace?
16:45DeusExPikachuno, trying bind the new classloader that was added in the context of the new eval, the example is check the value of clojure.lang.RT/baseLoader repeatedly in the repl, it changes with each new eval
16:46DeusExPikachui'm starting a new repl, that started in another eval, but I grab the classloader before calling clojure.main/main, so I can add URLs to the new repl session
16:49remleduff_But what's the endgame? You're wanting to recreate add-classpath or something?
16:50DeusExPikachuremleduff_, basically, but add-classpath is deprecated, and doesn't work in the repl
16:51DeusExPikachualso I want to manage the classloaders, keep track of them etc
16:57remleduffHow about (.getClassLoader (.getClass @(ns-resolve 'namespace 'symbol)))
16:58remleduffDeusExPikachu: ^^
16:59DeusExPikachuremleduff, but I want the new classloader made from eval? not the namespace classloader
17:00DeusExPikachuso after the eval, the classloader unloads
17:15ska2342Hi. Is it old news that there is a name-clash between clojure.repl and clojure.contrib.ns-utils in the current master branches?
17:16chouserah, that must be because last-var-wins only for core, not repl. bleh.
17:17lpetitchouser: worth changing the topic for #clojure and including the brand new clojure.com support site ?
17:17chouserI'm opless, unfortunately.
17:18chouseror perhaps fortunately. anyway, opless.
17:18ska2342I haven't been following the last var wins discussion closely. However: WARNING: dir already refers to: #'clojure.repl/dir in namespace: user, being replaced by: #'clojure.contrib.ns-utils/dir
17:18lpetitchouser: what does opless mean ?
17:19chouserwithout operator privileges. I can't change the topic.
17:19lpetitchouse:r oh, sorry then, my IRC client tells me that "chouser" set the topic for #clojure on Thu 15 Apr 2010 ...
17:20lpetitchouser: ^^^
17:20chouseryeah, I had op for a few days. heh.
17:20lpetitok :)
17:20lpetitmust go to bed, bye
17:22ska2342since functions are migrated from ns-utils to clojure.repl, is that contrib library going to be removed in the future?
17:24chouserthe migrated functions will probably be removed anyway.
17:25ska2342I am currently replacing some usage examples in our book that formerly used repl-utils. It would be a waste of time if the lib I replace it with will be removed in 1.2 ;-) Is there any document I can read that tells me what to expect from contrib in the near future?
17:26chouserthere are tickets in assembla for everything being migrated to clojure from contrib
17:26chouserwhich book?
17:27ska2342www.clojure-buch.de, AFAIK the first German book on Clojure to be published. I announced it a while back at the group.
17:27chouserah, yes. Just didn't recognize your nick
17:29ska2342To be frank, I think that many (most?) assembla tickets are poorly documented. But then, who am I to complain, I'm not contributing myself...
17:29DeusExPikachuwoot works
17:31DeusExPikachunested backquoting is tricky, especially when you care about which namespace you want >_<
17:51ninjuddit looks like you can't have a function with a variable number of arguments in a protocol. is that right?
17:53remleduffThink it probably has to have one non-variadic one to dispatch on by class
17:55remleduffOr... maybe you're right
17:55ninjuddremleduff: this doesn't seem to work:
17:55ninjudd(defprotocol Foo (foo [foo & args]))
17:55ninjudd(deftype Baz [] Foo (foo [foo & args] (println :foo args)))
17:56remleduffYeah, sorry. Defining it works, but actually calling it doesn't seem to
17:56ninjuddit creates a method that takes 3 args and binds the second to the symbol &
17:57ninjudddoes anyone know the reason for this limitation?
18:01ninjuddwho is an expert on protocols?
18:03ninjuddcemerick: have you encountered this?
18:03bmasonis transaction from clojure.contrib.sql broken in the 1.2 snapshot?
18:03remleduffI see a couple of google hits for "protocols varargs" including Rich Hickey saying that "it's not yet supported" but not sure if that means it will be supported. Seems like they're trying to wrap up quick enough that they might not want to change it before 1.2
18:05ninjuddremleduff: aha. good to know
18:05ninjuddremleduff: thanks
18:12remleduffJust speculating... Invoking a protocol function is currently basically just calling a method in an interface, I'm not certain how you'd do varargs efficiently, you have to know the arity of the target so you'd have to store it somewhere so you can look it up without reflection. Protocols are supposed to be host-fast...
18:15ninjuddremleduff: that make sense. perhaps protocols could transform a varargs call into a fixed args call where the last argument is a List
18:19DeusExPikachumay have found a bug, made a writeup on the ml http://groups.google.com/group/clojure/browse_thread/thread/28cf5de185252896
18:33remleduffIs "source" going to move to core?
18:37remleduffDeusExPikachu: How about: (defn foo [& body] `(do (intern *ns* 'the-cl 1234) ~@body))
18:37DeusExPikachusorry remleduff, what are you referring to?
18:38remleduffThe intern in place of that nasty double-unquote
18:38DeusExPikachuah, good tip
18:43rshwhen coding in clojure, I often find myself creating functions or macros that create hash tables that I end up storing at the top level in a namespace. Then I have a list of functions that act upon each of these objects. At a very high level, does this seem like idiomatic clojure?
18:57replacais there a way (in Clojure or Java) to do a min on Comparables rather than numbers?
18:58DeusExPikachursh, seems fine to me
18:59arohnerreplaca: you'd probably have to write your own function
19:01replacaarohner: that was the conclusion I just came to
19:01arohnerreplaca: should be pretty easy though. Check out (source min) and (doc compare)
19:01replacabut then I decided I didn't need it after all
19:01replacathanks!
19:11technomancy,(do (or (do not :there (is (not (try))))))
19:11clojurebotjava.lang.Exception: Unable to resolve symbol: is in this context
19:11technomancy,(use 'clojure.test)
19:11clojurebotnil
19:11technomancy,(do (or (do not :there (is (not (try))))))
19:11clojurebotDENIED
19:11technomancy...!
19:11technomancyclojurebot: why do you hate Yoda?
19:11clojurebotIt's greek to me.
19:14riddochcThat sounds like the right answer to me.
19:15technomancygood point
19:15riddochc:)
19:16riddochcThat yoda quote always gets used at the most inappropriate times, I think. Meh.
19:22replacatechnomancy: the keyword syntax lets you cheat a lot there
19:24technomancybut you only have to cheat once for that quotation. I think that's significant.
19:27riddochcAllowing for reading it left-to-right instead of inside-out, anyway.
19:29remleduffI'm kind of amazed no one has used "there" for something
19:30Licenser,(def there def)
19:30clojurebotDENIED
19:30Licenser,(there x 5)
19:30clojurebotjava.lang.Exception: Unable to resolve symbol: there in this context
19:30Licenserby the way, night people!
19:59replacatechnomancy|away: I'll grant you that :-)
20:28maxhodakwhat's the right thing to do when you have a list of items and you want to pick one out? calling filter all the time (which ostensibly does an O(n) search) seems hugely wasteful
20:29remleduffPut it in a map and then use get?
20:29remleduffBut I don't think that's enough detail ;)
20:29maxhodakremleduff: no i can do that, that makes sense
20:30maxhodakbut my conflict is that lists are much easier to handle as structures (you can just map instead of needing to map/reduce/etc to run through it, and many methods expect colls rather than maps)
20:30maxhodakbut maps are keyed
20:34riddochcmaxhodak: It might not be wasteful if your list is short, anyway. Using a map may be faster, but it also just might not matter. Have you measured?
20:35riddochcmaxhodak: I'd say it really depends on what you're using that list for. Unless it's actually slow, and you know it's spending a lot of time in filter, I wouldn't worry about it.
20:40remleduffIf you've got a sorted-set are you supposed to use Collections.binarySearch or is there a clojure function somewhere I'm missing?
21:18stuarthallowaychouser: you around?
21:19stuarthalloway...or anybody else who uses c.c.shell(-out)?
21:21chouseryeah, hi.
21:22stuarthallowayI am promoting c.c.shell to core
21:22chousercool
21:22stuarthallowayand the only thing I wonder about is the weird :return-map stuff
21:23stuarthallowayor more particularly, the returning of out+err mashed together when one doesn't use return-map
21:23chouserit struck me as the most common use case.
21:24chouserthings run at the command line dump stdout and stderr together in the terminal
21:24stuarthallowaytogether, but not combined
21:25chouser?
21:25stuarthallowayif I wrote to stderr first I would see that first
21:25stuarthallowayin production code I think I would always use :return-map
21:26stuarthallowayI think scripting languages tend to give you back stdout
21:26stuarthallowayand then set variables to let you inquire about stderr and the return code if you want
21:26stuarthallowaythat doesn't feel very clojurish though
21:27chouserI use the sh function rather rarely. I wonder what options most people use.
21:27stuarthallowaywas looking around to see that very thing
21:27stuarthallowaypallet uses it once, with :return-map
21:28stuarthallowayc.c.javadoc uses it once, ignoring the return value
21:28chousersh is not a complete wrapper of exec
21:29stuarthallowayunderstood
21:29stuarthallowaymy concern is to have the API promise as little as possible
21:29chouserthe idea was to make the most common uses easy.
21:29chouserok
21:29stuarthallowayin particular, promise only things we are sure we like
21:30chouserhm.
21:30stuarthallowayso I am thinking making the current :return-map the default, and only approach
21:30technomancysounds good to me
21:30stuarthallowayany first time user getting back a map with :exit, :our, and :err in it would know exactly what they had
21:30chousermy only concern with that is it would make the simple case of, say (sh "ls") more complicated
21:31stuarthallowayright
21:31stuarthalloway(:out (sh "ls"))
21:31chouserright
21:31stuarthallowaytechnomancy: do you use c.c.shell now?
21:32chouserif only we had return value polymorphism. ;-)
21:32technomancystuarthalloway: we bounce back and forth
21:32technomancystuarthalloway: we've been bitten by a JVM bug where exec temporarily needs twice the memory of the parent process, and our heap is always huge
21:32technomancyso we've been wary of it
21:33stuarthallowayto be clear: the reason to add this is (originally) to support javadoc
21:33stuarthallowayfor the repl
21:33chouseroh, I didn't realize javadoc used it
21:33hiredmanthe return map is useful
21:33technomancystuarthalloway: just to launch a browser?
21:33stuarthallowayand from there, it's just "what the hell, sh is useful on its own, might as well make it public"
21:33hiredmanbecause if my shell process does not exit with 0 I want to know
21:34remleduffWhy does it return new readers and writers rather than take readers and writers as parameters with defaults?
21:34hiredmanand I want to throw an exception and log it
21:34chouserI'm not going to make much of a fuss either way.
21:34technomancywith clojure-http-client we have two nses: a low-level version that returns a map and a higher-level one that translates non-success error codes into exceptions thrown.
21:34technomancythat has worked out pretty well IMO
21:35hiredmanthe return map is not to bad if you destructure it
21:35technomancytry/catch around a shell-out seems to better communicate what's going on though
21:35hiredman(let [{:keys [exit in out]} (sh ...)] (when-not (zero? exit) (throw ...)))
21:35technomancybut it doesn't address stdout/stderr at all
21:36stuarthallowayremleduff: designed for repl usage, not as a general purpose api
21:36hiredmanI do usually get the out as a string
21:36stuarthallowayif we could lose the need for sh in javadoc, then I could promote javadoc and leave shell for another day
21:37stuarthallowayit's already a special case branch for the mac
21:37technomancyI assume there's no JDK-provided way of launching a browser? man... the things you have to go through to support people who don't use Emacs. =)
21:38stuarthallowaytechnomancy: that is what the code in javadoc suggests
21:39chouserI don't see sh in javadoc.
21:39hiredmanbtw, what is the deal with shell and shell-out?
21:40technomancyhiredman: it's like duck-streams vs io IIUC
21:40hiredman*out of band reply*
21:42remleduffThere's actually a java 6 way of eating the browser
21:42hugodWe use shell in pallet, and I modelled clj-ssh after shell as well. I would be quite happy to see the map returned by default.
21:42remleduffeating?
21:42remleduffMan I'm out of it
21:44stuarthallowayhugod: cool
21:44stuarthallowayremleduff: sadly requiring java 6 not an option
21:44stuarthallowaychouser: javadoc calls browse-url
21:45stuarthallowaybrowse-url uses sh to avoid repl-utils turning the process into a gui app
21:45chouserah, ok, I see it now.
21:46remleduffjavadoc.browse is actually trying to use the java 6 way of doing it, if it's supported
21:46stuarthallowaywhich is weird, because it seems that *open-url-script* should be tried first, before open-url-in-browser
21:46stuarthallowayremleduff: that way still seems to make the app into a GUI app
21:47chouserstuarthalloway: btw, congrats on clojure/core
21:48stuarthallowaythanks! you should abandon your worldly possessions and join us :-)
21:48chouserheh. ah, so tempting!
21:48remleduffIsn't *open-url-script* mac os specific?
21:51technomancywhat, you're clojure monastics now?
21:52stuarthallowayremleduff: yes, but by using it first, one avoids the app transforming into a GUI app
21:52stuarthallowayat least in the test I just ran
21:53chouserremleduff: I think it's just providing a default for mac
21:53stuarthallowayif someone else on a mac wants to test this theory: start a repl, use javadoc browse as is
21:54stuarthallowaythen change the order tried by browse-url to use the script first. behavior seems better
21:54remleduffI read it as trying in turn: 1) Java 6 desktop api 2) If on macosx, shelling out (*open-url-script* isn't defined for any other platform) 3) Using swing gui
21:55technomancy4) use swank. =)
21:56tetronquestion, is there a way to enforce that a particular function call be 'pure' and not have any dirty java interop?
21:56remleduffstuarthalloway: What does "turns the app into a gui app" mean? Here, the java 6 method seems preferable, just opens it in a tab in my browser. How can I see if I'm a gui app now?
21:56stuarthallowayremleduff: in my case, the app suddenly shows up in the alt-tab circle
21:57stuarthallowaywith the generic coffee mug icon
21:57remleduffOh, doesn't happen on my windows 7 at least
21:57chouserthat sounds like open-url-in-swing
21:57remleduffI think that means you're getting the swing app
21:57stuarthallowaynope.
21:57stuarthallowaytrying the functions one at a time
21:57remleduffInteresting
21:58stuarthallowaytetron: not easily. and interop isn't dirty :-)
21:59tetronstuarthalloway: I haven't dug very deep into clojure, but something I have wanted from a programming language is a way to guarantee that particular code paths is free from side effects
21:59tetron*are free
22:00stuarthallowaytetron: that is a hard thing to do, and clojure doesn't want the complexity required
22:00stuarthallowayhaskell does it
22:01tetronthis is probably simplistic, but it seems like one could "taint" functions based on whether they are provably pure or not
22:04remleduffThere's a small amount of support for declaring things as transaction-unsafe by using the io! macro
22:04stuarthallowaytetron: marking a taint is easy, "provably pure" is not
22:05tetronstuarthalloway: fair enough :-)
22:05stuarthallowaystart to sketch out how you would do that, and in a few years you'll be back with haskell
22:07tetronstuarthalloway: and haskell is used to scare small children who don't eat their vegetables :-)
22:07tetron(eat your peas or it's coding haskell for you! no mommy, no!!)
22:08tetronI gotta go, thanks for responding though
22:09remleduffstuarthalloway: Do we really want a javadoc function? I'd kind of prefer teaching the doc function how to scrape the docs from the javadoc and formatting them in a clojure-ish way
22:13stuarthallowayremleduff: how would that work for jars you don't control?
22:13stuarthallowayyou'd end up implementing all of the javadoc fn, then refusing to show it in a browser and scraping it to the clojure format
22:15remleduffYeah, that's more work
22:19remleduffCould you use a hook multimethod (*javadoc-fn*) for handling the url so the user can provide a local one?
22:35replacastuarthalloway: except that (doc ) doesn't actually format stuff :(
22:47remleduffOh, there's no easy way to do scraping with just core
23:00maxhodakis it just me for is congomongo/insert! totally broken now?
23:00maxhodakno matter *what* i do i get a null ptr exception
23:01maxhodaksame for update!
23:01johnmn3I have a swing gui repl that reads the text from a jtextarea. It feeds the characters of text into a function sends a string of text to the repl when it has read in a whole object. It has counters to track the number of open and closed brackets.
23:01johnmn3*function _which_ sends*
23:03johnmn3it's actually a few different functions that work together. It's way too complex though, the parsing of the objects. I'd like to abstract that job into something more general. Would it make sense to use protocols for that?
23:13johnmn3maxhodak: did you try it with a fresh repl?
23:13DeusExPikachuis there talk of getting repl-utils into core?
23:18chouserDeusExPikachu: parts of it, yes
23:18chousersource, javadoc, but not show
23:42rshis there a way to get the name in which a struct was created from?