#clojure logs

2009-01-23

00:09durka42hiredman: does the ~syntax require extra setup?
00:11hiredmanno
00:11hiredmanI just pushed it around the time you were looking for the repo
00:11durka42it only seems to work when i address it to clojurebot
00:11hiredmanthe top of git log should be something about "~"
00:12durka42oh i missed that last commit
00:12hiredmanif it isn't, you don't have "~"
00:21eyerisWhat is the proper way to iterate over a collection, binding both the seq entry and the index into the seq?
00:22hiredman(map vector [:a :b :c] (range 3))
00:23hiredman,(map vector [:a :b :c] (range 3))
00:23clojurebot([:a 0] [:b 1] [:c 2])
00:23jbondesonfinally! got an ant script just to compile the whole mess
00:24durka42,(indexed [:a :b :c])
00:24clojurebotjava.lang.Exception: Unable to resolve symbol: indexed in this context
00:24eyerishiredman So that creates a new vector that I can iterate over using doseq?
00:24hiredmanit creates a new seq of vectors
00:24eyerisRight
00:25hiredmansure, if you want to use doseq
00:25eyerisSo then, in the doseq bindings, is there any "destructive binding"?
00:25hiredmanyou mean destructured?
00:25eyerisOr do I have to use the (first) and (last) to bind a symbol to the original seq entry and the index?
00:25Cark,(doseq [[name index] (map vector [:a :b :c] (iterate inc 0))] (prn (str index name)))
00:25clojurebot"0:a" "1:b" "2:c"
00:26hiredmanyou could just use map instead of doseq there
00:26eyerisThanks! The [name index] is what I meant by "destructive binding"
00:26eyerisWhat is that called in clojure terms?
00:27hiredmandestructured binding
00:27eyerisOk
00:30WizardofWestmarchm, this is strange, I have a vector of vector pairs that's giving me some weird issues when trying to run reduce against it
00:30hiredmanwhat is the rror?
00:30cooldude127WizardofWestmarc: let's see some code!
00:30WizardofWestmarcso I do (reduce (fn [a b] a) vecofvecs)
00:30WizardofWestmarcand it only spits out the first vector inside the larger one
00:30hiredman...
00:30jbondesonyou don't want to see his code, he's a dirty ex-pythoner ;)
00:31cooldude127WizardofWestmarc: that's right
00:31hiredmanWizardofWestmarc: that is how reduce works
00:31jbondesonyeah
00:31WizardofWestmarcwell, here's the other thing
00:31cooldude127WizardofWestmarc: first arg is the accumulator, which starts with the first item in the sequence
00:31jbondesonyou need to collect inside the function if you wanted to do that
00:31WizardofWestmarcgood point
00:31WizardofWestmarchowever
00:31WizardofWestmarcthe example that caused me to try it
00:31cooldude127WizardofWestmarc: if you keep returning the accumulator, it won't change
00:31WizardofWestmarc(def totalwords (reduce fn([[_ freq1] [_ freq2]] (+ freq1 freq2)) sortedlist))
00:32jbondesonthat counts
00:32cooldude127the second items in all the vectors
00:32durka42hiredman: i got clojurebot to promise to deliver messages. i'll work on fulfilling the promise tomorrow
00:32jbondesonand destructures
00:32WizardofWestmarcagain, this is a vec of vecs [["xyz" 1] ["def" 5]] it blows up
00:32hiredmanWizardofWestmarc: you obviously mispasted that
00:32hiredmanor mistyped it
00:32cooldude127no he didn't, it's wrong
00:32cooldude127hold on, let me fix it
00:33WizardofWestmarcoh, duh
00:33WizardofWestmarcI see one typo
00:33WizardofWestmarcI lost it in a repl crash
00:33hiredmanfn is outside the parens
00:33WizardofWestmarcyeah noticed
00:33hiredmanWizardofWestmarc: note the doubling up if the brakcets
00:33WizardofWestmarcbut the error I get when my code isn't dumb is claiming I'm trying to nth an int
00:33hiredmanof
00:34cooldude127WizardofWestmarc: (reduce (fn [acc [_ freq]] (+ acc freq)) 0 sortedlist)
00:34cooldude127try that
00:34hiredmanman, my internet sucks
00:34jbondesonyour intertubes are clogged, call a plumber
00:34cooldude127lol
00:34hiredmannah, it'ss just clearwire
00:35WizardofWestmarcok, that worked
00:35WizardofWestmarcand I get it
00:35cooldude127good
00:35WizardofWestmarcso I'd HAVE to use the initialval to make it work
00:35cooldude127you only get a vector for the accumulator the first time
00:35cooldude127WizardofWestmarc: to return a scalar value, yes
00:35hiredmanWizardofWestmarc: http://clojure.org/special_forms <-- the bit about let holds true in most binding forms in clojure
00:35WizardofWestmarcright
00:36WizardofWestmarcmy mistake was missing the fact of how it was using the accumulator
00:36WizardofWestmarcI don't normally do reduce w/anything more then basic forms
00:36cooldude127WizardofWestmarc: yeah, glad that's cleared up
00:36cooldude127reduce isn't the obvious functional idiom
00:36WizardofWestmarcjust stuff like adding a mass list of numbers generated somehow or the like
00:36cooldude127s/the/the most/
00:36cooldude127yeah
03:08zakwilsonAm I correct in assuming that pmap works best when used with a CPU-intensive function and a small collection?
03:11Carki don't know for the small collection part, but yes for the cpu intensive function
03:31Lau_of_DKTop of the morning gents
03:43zakwilsonGood morning, Lau_of_DK
03:43AWizzArdHi
03:44zakwilsonHi AWizzArd
06:57AWizzArdSchon so einiges an Deutschen hier ;-)
07:04red_fishI think I found a bug in http://clojure.org/refs http://paste.pocoo.org/show/100966/
07:04red_fisha race condition
07:07AWizzArdCan you say more about it?
07:12vyWhy I couldn't require swank.core in here: http://paste.pocoo.org/show/100970/
07:13Chousukevy: do you have a swank-clojure/swank/swank/ directory?
07:13Chousukevy: you might try just adding swank-clojure/ into the classpath
07:14Chousukeinstead of the swank subdir
07:14Chousukesince it seems to be part of the package structure.
07:14vyHrm... Let me try that.
07:14Chousukealso, depending on where the swank.clj is, you might need to require 'swank.swank instead (to match swank/swank.clj)
07:15vyThis time require'ing 'swank complains that: java.io.FileNotFoundException: Could not locate swank/util__init.class or swank/util.clj on classpath: (core.clj:0)
07:16AWizzArdseems that is already progress
07:16AWizzArdred_fish: can you please tell us more about the potential bug in refs?
07:16vyYup, it obviously did. But this time it appears be requiring me to write swank.swank.util, which is quite ugly IMHO.
07:17AWizzArdvy: when you open the utl.clj file... what (ns ..) does it establish?
07:17AWizzArdIt says (ns swank.util ..) right?
07:18AWizzArdSo if the dir that contains the subdir swank is in your CP, then swank.swank.util seems to be right
07:18Chousukeis your swank-clojure recent?
07:18vyOops! You're right, it probably says clojure/ns, which should be clojure.core/ns.
07:19vyChousuke: Yep, but it doesn't support the clojure to clojure.core transfer.
07:19Chousukehuh
07:19Chousukemine works just fine :/
07:19vyHuh?
07:20vyAm I trying to fix something already fixed in the HEAD?
07:20Chousukelast commit in the git repo was on Jan 13
07:20vyBrr!
07:29vyChousuke: But still (require 'swank-clojure-autoload) requires a pre-set swank-clojure-jar-path and swank-clojure-extra-classpaths.
07:30Chousukewell, yeah
07:31Chousukejust set them? :/
07:31vyI do, but the README is missing mentioning about that gotcha, despite I submitted 2 repetitive bug reports about it.
07:32vyChousuke: Hrm... Would you mind sharing some of your .emacs lines related with SLIME and Clojure?
07:34Chousukevy: I doubt it's really helpful, but here: http://github.com/Chousuke/dotfiles/blob/56eafa24c73fdfaa974c434fad1080f090ef0300/Aquamacs-customizations.el
07:35ChousukeI wish I knew how to make that 'viper-in-more-modes things work with clojure-mode and/or slime though :(
07:36Chousukeit only works for elisp, and apparently it's *supposed* to work with slime too, but it doesn't.
07:36Chousukeand I have no clue why
08:30gnuvinceHi
08:48red_fishAWizzArd: It's a problem with LinkedBlockedQueue
08:48red_fishAWizzArd: It can stay in dosync and the resulting coll is out of order
08:48red_fishit can't stay
08:55red_fishrhickey: I found a race condition in the example of ref (http://clojure.org/refs) http://paste.pocoo.org/show/100985/
08:56red_fishrhickey: the output collection can be out of order
08:58rhickeyred_fish: thanks, I'll check it out
09:09rhickeyred_fish: that's a naming problem - was never designed to maintain order
09:12rhickeyred_fish: I clarified the docs
09:14rfgpfeifferthere is an edge case with sets as functions
09:14rfgpfeiffer(#{true false nil} nil)
09:16Chousukehmm
09:16rhickeyrfgpfeiffer: only if you don't understand how they behave when used as functions
09:17Chousukethat might be a slight gotcha but I wouldn't consider it a real problem
09:18rhickeyyou always have to be more careful treating accessors as predicates when the values can be false/nil:
09:18rhickey(get {:a nil} :a)
09:20rhickeyThere was a time when (get #{:a} :a) -> true, and therefor (get #{nil} nil) -> true, but just returning booleans has a lot less utility
09:21rhickeyuser=> (filter #{\a \b \c \d} "fred")
09:21rhickey(\d)
09:23vyIsn't it possible to return multiple values in Clojure? If it is, then GET can return a second boolen argument telling whether the item is found or not. (Similar to GETHASH in CL.) Anyway, this is the 2 cents of a Clojure newbie.
09:23rhickeyvy: no, it's not, otherwise yes, that would be nice.
09:25rfgpfeifferI wrote some test cases for properties of algebraic structures like monoids. Is this something for contrib?
09:26rhickeyrfgpfeiffer: could you post a description of your work on the group?
09:29rfgpfeiffertest if something behaves like a monoid: http://gist.github.com/51026
09:44rhickeyrfgpfeiffer: I'd like to try that, but it's mssing some defs - closure-under? a-associative?
09:46jbondesonso rich, yesterday I was looking at the memoization function and I was wondering what your thoughts were addeding WeakHashMaps to clojure and using those for memoization.
09:47jbondesonit looks likes it would be fairly straight forward to wrap the WeakHashMap class to be useable by the clojure functions, the only real problem would be how to specify strong v weak
09:47rfgpfeifferrhickey: http://gist.github.com/51030
09:50rfgpfeifferactually, seqs are not a monoid, because the neutral element nil is not a seq
09:51rhickeyrfgpfeiffer: neat - I think you might a different name than zero - maybe none or empty ?
09:51gnuvincerfgpfeiffer: is that a requisite or just something statically typed languages need to have?
09:51rfgpfeifferneutral, maybe
09:53rfgpfeiffergnuvince: It is for test cases
09:54rfgpfeiffergnuvince: When you think about your data in terms of abstract algebra(like seqs), you can unify your test cases in terms of abstract algebra
09:57jbondesonit is officially too early in the morning for me to be thinking that abstract ;)
09:58karmazillais there such a thing as concrete algebra?
09:59rfgpfeifferyeah
09:59rfgpfeiffer1+1=2
09:59rfgpfeifferpretty concrete
09:59cooldude127very concrete
10:00jbondesononly for small values of 1 though
10:00karmazillaI can follow that
10:00cooldude127let's define small
10:01karmazilla,(def small 1)
10:01clojurebotTitim gan �ir� ort.
10:01cooldude127clojurebot: what does that mean?
10:01clojurebotexcusez-moi
10:01rfgpfeiffernatural numbers form a monoid with +. 0 is a neutral element
10:01cooldude127quit dodging my questions
10:02jbondeson,(let [big+ #(+ 1 (+ %1 %2))] (big+ 1 1))
10:02clojurebot3
10:03jbondesonsee!
10:03cooldude127DIFFERENT OPERATION
10:03jbondesonoh
10:03jbondesonfine
10:04cooldude127lol
10:05rfgpfeifferthe natural numbers only form a semigroup with big+, because (big+ 0 0) isn't 0
10:06rfgpfeiffersee? its easy
10:06jbondesonyes, but that's to be expected from large values of 0
10:07cooldude127oh god
10:20Chouser-awayrhickey: are we allowed to use 'definline'?
10:21cooldude127lol
10:26bstephensongm group. newbie here searching for a sample project or code that uses clojure-contrib.sql and accesses SQL Server. Does anyone out there have anything like that?
10:30vyShouldn't (assert (= 42 (max 2 42 5 4))) line be replaced with (assert (= 42 (mymax 2 42 5 4))) in http://clojure.org/special_forms page?
10:31cooldude127vy: yes
10:32cooldude127i noticed that the other day
10:48Chouservy: fixed, thanks.
10:51cooldude127woooo
10:52vyOk, I won't talk about porting documentation to a more consistent format (LaTeX, DocBook, etc.) stuff.
10:53Chouservy: why not?
10:53vyAFAIS, developers ignore it.
10:54vyChouser: See http://groups.google.com/group/clojure/msg/18f3147d875b236d
10:55Chousersure enough. :-)
11:00eyerisIs there any policie or opposition to including examples on the /api page?
11:00eyerispolicy*
11:01eyerisOr is the Wiki the better place for that?
11:05Chouserthe api page is directly created from the docstrings. That's the closest thing I have to an answer to your question.
11:05Chousersorry it's not very close.
11:05eyerisThat's helpful. Now all I have to do is submit a patch to those and see if it gets denied :)
11:05eyerisI think I will work on the Wiki before doing that though.
11:06ChouserI thought I saw some other wiki where somebody was trying to provide a comprehensive set of examples for all clojure functions.
11:08eyerisWas this it? http://en.wikibooks.org/wiki/Clojure_Programming/By_Example
11:17hiredmanclojurebot: where are the examples?
11:17clojurebotexamples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
11:18eyerisSweet
11:20drewrWhat's the current recommended practice on created custom exception classes? I thought I remember that proxy is verboten.
11:20Chouserdrewr: proxy doesn't help because the name of your new class isn't very useful
11:21Chouserdrewr: so one obvious option is gen-class
11:22Chouserdrewr: I had some thoughts on an alternate mechanism: http://paste.lisp.org/display/72867
11:22drewrYeah, I basically want to do "class MyError(StandardError): pass" in Python.
11:22Chouserdrewr: I'd be happy to turn that into a usable contrib library, but I've hesitated so far because I don't have any use cases myself.
11:23drewrI keep doing (throw (Exception. "...")) which doesn't seem helpful to consumers of my libs.
11:24drewrThey have no granularity in their catching.
11:24danlarkinI'm +1 for a common idiom for custom exception classes
11:25danlarkinright, throwing (Exception. "..") isn't as helpful as it could be
11:25hiredmanclojurebot: exceptions?
11:25clojurebotI don't understand.
11:25hiredmanclojurebot: exceptions is http://wuhrr.wordpress.com/2007/11/22/java-exceptions-list/
11:25clojurebot'Sea, mhuise.
11:25Chouserdanlarkin: my question is, does the stuff in my "musings" provide sufficient features to take the place of actual Exception subclasses in many cases
11:26hiredmannext to you can pick a more suitable exception from the list to throw
11:26hiredmaninstead of Exception
11:27hiredmanclojurebot: exceptions is also http://java.sun.com/javase/6/docs/api/java/lang/Exception.html
11:27clojurebotYou don't have to tell me twice.
11:27hiredman^- lists most of the known subclasses
11:28danlarkinyes, but sometimes an exceptional case doesn't fit into one of the existing subclasses
11:29drewrChouser: I'd love to see something along those lines become conventional.
11:30jbondesonanybody having problems with the latest clojure-contrib?
11:31danlarkinChouser: seems like a lot of work to solve a problem that's already solved... with custom exception classes
11:31Chouserdrewr: ok. well, it has the benefit of throwing any particular Java exception if not in a 'handling' scope, so throwers could use it without demanding that catchers do.
11:31Chouserdanlarkin: it has extra features beyond Java exceptions. :-)
11:32Chouserand doesn't require pre-compilation like Java a custom Java exception currently does.
11:34Chouserit's actually not very much code -- I could put it in contrib and see if anybody ends up using it.
11:34Chouserany suggestions for better names than 'handling' and 'handle'?
11:34Chouserof the equiv. of 'try' and 'catch'?
11:35Chouser'attempt' and 'absorb' :-P
11:36danlarkinwith-errors and handle?
11:36danlarkinnaming sucks :-/
11:38drewrNaming has caused me to completely give up on projects before.
11:40Nafaidrewr: Heh. :)
11:41drewrYo Nafai!
11:41NafaiHey drewr
11:48Chouserhm, I think I could still use 'catch' and 'finally', thought that might be more confusing than it's worth
11:57shooverChouser: is this something like CL's handler-case, handler-bind, restart-case?
12:00Chousershoover: you tell me. :-)
12:00ChouserI don't know CL well enough to know.
12:00ChouserI think I said last time this came up that I would read up on those.
12:01shoover:) it took me a long time to read that chapter in Practical Common Lisp
12:01ChouserIs PCL online for free anywhere?
12:02Chousermight be easier than reading the hyperspec
12:02shooverclojurebot: CL conditions is http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html
12:02clojurebotIn Ordnung
12:03Chousershoover: thanks
12:03shooverhandler-case is like a try/catch--stack unwinds to the handler that matches the exception
12:03shooverhandler-bind is a dynamic binding thing that lets you provide handler to run at the stack level where the error happens
12:03shooverthen there's restart-case, but I'm running out of steam
12:04Chousers'okay. I'll read that chapter and/or the hyperspec.
12:04ChouserIt's more fun to create than to learn, but the creations are better if you learn first.
12:06shoovertrue that. my sense is that you're building the thing, but maybe CL will provide understanding to help with names (or hurt)
12:07Chouserright. If it's possible to build something that works identically or very nearly so, reusing the names would be very helpful.
12:07Chouserif it's not possible or desirable for some reason to emulate CL in this way, I should probably try to avoid names that are too similar.
12:13ChouserCL has a hierarchy of condition classes, just like Java has a hierarchy of exception classes.
12:13ChouserI wonder if that tends to be as shallow in CL as it is in Java.
12:14Chousersupporting that would make my code a good deal more complicated, I think, if it's even possible.
12:16technomancyclojurebot: forget slime-installer
12:16clojurebotslime is icky
12:16technomancyclojurebot: slime-installer is http://github.com/technomancy/clojure-mode/blob/0f28b61de90ce8a09d75bf1668ef3f1c200f9c52/clojure-mode.el#L560
12:16clojurebotIk begrijp
12:17hiredmanChouser: the gview widget is neat
12:22Chouserhiredman: oh, from my blog?
12:23hiredmanChouser: yes
12:23ChouserI need to update that with a note about clojure.inspector
12:23Chouserwhich has some surprisingly similar code in it
12:26Chouser,(inspect-tree {:a [4 5 6] :b [1 2 3] :c [7 8 9]})
12:26clojurebotjava.lang.Exception: Unable to resolve symbol: inspect-tree in this context
12:26Chouser,(use 'clojure.contrib.inspector)
12:26clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/inspector__init.class or clojure/contrib/inspector.clj on classpath:
12:26Chouserbah
12:26Chouser,(use 'clojure.inspector)
12:27clojurebotnil
12:27Chouser,(inspect-tree {:a [4 5 6] :b [1 2 3] :c [7 8 9]})
12:27clojurebotjava.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it.
12:27hiredmanhwa
12:27Chouserheh. anyway, something like that
12:33rfgpfeiffer,2
12:33hiredman,(identity 2)
12:33clojurebot2
12:34rfgpfeiffer,(+ 3 4)
12:34clojurebot7
12:34jbondesonsooo... anyone with commit access to clojure-contrib want to remove the private def of mod from math.clj?
12:34jbondesonlast night it was added to clojure.core
12:35Chouserjbondeson: is it in your way?
12:36jbondesoni just modified it locally and rebuilt, i was just letting people know.
12:36jbondesontook me a while to figure out what happened.
12:36Chouserah, ok.
12:43technomancyso on the contributor agreement it asks you to list your usernames on different project web sites... I included my github info, just in case. =)
12:56Chousertechnomancy: :-)
13:30karmazilla,(let [s (.keySet {:a 1})] [(set? s) (ifn? s)])
13:30clojurebotExcuse me?
13:30karmazillaclojurebot hates me
13:31hiredmanoops
13:32hiredmansorry, when you were trying to break clojurebot I made him ignore you
13:32karmazillaaww
13:32jbondesonso, i have a fun one.
13:32karmazillaI promise I won't break him again... willfully
13:33jbondesoni have a rational that returns "NaN" when trying to float it
13:33hiredmankarmazilla: try now
13:33jbondesonand the denominator isn't 0...
13:34karmazilla,(let [s (.keySet {:a 1})] [(set? s) (ifn? s)])
13:34clojurebotjava.lang.reflect.InvocationTargetException
13:34hiredman,(.keySet {:a 1})
13:34clojurebotjava.lang.reflect.InvocationTargetException
13:35hiredman(let [s (set (keys {:a 1}))] [(set? s) (ifn? s)])
13:35jbondesoni guess with ratios that have 10k characters in the string representation it just dies
13:35jbondesonwhich is odd
13:35hiredman,(let [s (set (keys {:a 1}))] [(set? s) (ifn? s)])
13:35clojurebot[true true]
13:36karmazillathe point I'm trying to make is that the code I pasted gives [false false]
13:36hiredmanno, it gives an exception
13:37karmazillain what version of Clojure? I'm on trunk
13:37hiredmanah
13:37hiredmanlatest svn does return [false false]
13:38hiredmanlooks like .keySet no longer returns a set
13:38hiredmanor maybe it does
13:38hiredmanit is an inner class
13:38karmazillait looks like an oversight to me. I think it should be [true true], but maybe there's A Very Good reason
13:39hiredmanuser=> (set? (.keySet {:a 1}))
13:39hiredmanfalse
13:39hiredmankarmazilla: maybe you should stop calling java methods
13:40hiredmanand use (comp set keys)
13:40karmazillawhy? Java interop is part of what makes clojure practical and useful to me
13:41jbondesonhow long of a clojure expression will clojurebot take, hireman?
13:41hiredmanjbondeson: only one way to find out
13:41jbondeson\m/
13:41jbondeson,(let [sqrt2 #(loop [x %2 i 0] (if (> i %3) x (recur (/ (+ x (/ %1 x)) 2) (inc i))))] (float (sqrt2 (/ 41 20) 2 7)))
13:41clojurebot1.4317821
13:41jbondeson,(let [sqrt2 #(loop [x %2 i 0] (if (> i %3) x (recur (/ (+ x (/ %1 x)) 2) (inc i))))] (float (sqrt2 (/ 41 20) 2 8)))
13:41clojurebotNaN
13:41jbondesonthere we go
13:42jbondesontrying to calculate a rational sqrt
13:42jbondesonand it fails to convert back to a float
13:42hiredmankarmazilla: rhickey_ and Chouser seem to be out, so you could take it to the group
13:44karmazillahmm... but every change I've ever proposed to Clojure has been rejected. Don't know if I dare
13:44jbondesonoh well, i'll look into that after lunch
13:44hiredmankarmazilla: there is always a first time
13:47jawolfeHi all
13:47jawolfeI have a couple posts that have gone by on the mailing list without getting a real response, so I figured I'd bring them here
13:49jawolfeI guess several of them are for Rich; are you here currently?
13:51jawolfeAnyway, if anyone else wants to discuss, I have a number of proposals for core, and I'd like to hear people's opinions
13:51jawolfe- Faster set operations (http://groups.google.com/group/clojure/browse_thread/thread/29609929e94f279c?hl=en#)
13:52jawolfe - 0-arg distinct? returns true, not an exception (so (apply distinct? nil) = true)
13:52jawolfe - rewrite concat so that (apply concat seq) doesn't evaluate the first three elements of seq
13:52jawolfe - make every?, not-every?, some, not-any? take multiple seq args like map, i.e., (every? not= [1 2 3] [2 3 4])
13:52jawolfe- allow arguments to merge-with after the first to be lists of pairs.
13:53jawolfe- consider aliases when reading namespace-qualified keywords (http://groups.google.com/group/clojure/browse_thread/thread/dbf2cd9130eb06a3?hl=en#)
13:53jawolfeIf anyone likes or dislikes any of these, I'd like to hear it ... I'll be hanging around here for a while.
13:58duck1123I liked that 0-arg distinct one
13:58duck1123nil contains no duplicates, why shouldn't it return true
13:59jawolfeexactly, thanks.
14:00duck1123so, (every? not= [1 2 3] [2 3 4]) => true?
14:01jawolfeThat would be the idea.
14:01jawolfeJust a shortcut for (every? identity (map f ....))
14:01jawolfeThat's the one I care about the least
14:03duck1123yeah, I'm not sure how well that one would work out
14:03jawolfethere's no down-side, really, since every? currently only accepts two arguments
14:03jawolfeBut there is a short idiom for the same thing
14:04duck1123wasn't there talk about giving map-like functionality to a whole bunch of functions? What ever happened to that?
14:04jawolfeI'm not sure, I'm still pretty new to Clojure ... unless you're talking about this thread http://groups.google.com/group/clojure/browse_thread/thread/134642cc76de17f7/97ac071e5d1e739c?hl=en&amp;
14:05jawolfeHi, Rich?
14:06Carkwhat would be a nice tool to investigate a memory leak ,
14:06jawolfeOK, thanks ... can I ask you a few quick questions later?
14:06Cark?
14:06jawolfeCark: try YourKit
14:06duck1123doesn't the ns-qualifying work for ::keywords?
14:07Carkjawolfe : thanks !
14:07duck1123I tried that the other day and it was doing exactly that
14:07jawolfeyou can get the free version http://www.yourkit.com/eap/index.jsp
14:07hiredmanduck1123: he is talking about aliases
14:07jawolfeYes, :: works
14:07jawolfehiredman: yes
14:07hiredmanlike you (require '[ foo.bar :as foo])
14:08duck1123right I did ::date/Date and it turned into :clojue.contrib.date/Date
14:08jawolfeThen, you still must :foo.bar/keyword
14:08jawolfeoooh
14:08hiredman:foo/blarg is not the same as :foo.bar/Blarg
14:08hiredmaner
14:08jawolfereally ?
14:08hiredmanjawolfe: I am explaing the current state of play
14:08hiredmanor trying to
14:08hiredmanoh, you are talking to duck1123
14:09jawolfehiredman: duck1123 is correct
14:09jawolfe::foo/blarg does what I want
14:09duck1123one issue down :)
14:09hiredmanwell, something new everyday
14:09jawolfeVery cool ... just need docs for that now :)
14:10jawolfeI'll resurrect my thread on the group to make sure others hear about it
14:10jawolfeduck1123: thanks!
14:10duck1123np, I didn't know it did that till the other day when I was trying to help out cooldude
14:13danlarkinheyyyoo lots of updates to clojure-mode, hooray
14:14technomancydanlarkin: yeah, glad to see the maintainer is coming back online
14:14technomancydanlarkin: did you see my post about M-x clojure-install ?
14:14danlarkinno, point me to it?
14:15technomancydanlarkin: http://groups.google.com/group/clojure/browse_thread/thread/dfce84232ea8cf7a/e3320bc433eb910a?lnk=gst&amp;q=slime#e3320bc433eb910a
14:16technomancydanlarkin: just a response to all the "how do you install slime" questions we seem to get in here.
14:17danlarkintechnomancy: is it a good idea to push newbies to use git for clojure and clojure-contrib instead of the "official" google code svn repos?
14:18technomancydanlarkin: given that they're synched automatically, I think so
14:18technomancythe only downside is that checkouts take a lot longer, so if that turns out to be a big irritant I could be convinced to switch to svn
14:18kefkaIf I have a sorted-map, and I want to do a lookup that returns, on not-found, the highest (or lowest) entry below (above) the target key, what's the best way to do that?
14:19technomancydanlarkin: I like being able to list only three dependencies: git, jvm, and ant; none of this legacy stuff.
14:19kefka,(isa? (sorted-map) java.util.TreeMap)
14:19clojurebotfalse
14:19ChouserI use git and the official google code repos
14:19danlarkintechnomancy: well it's not legacy, it's still in use!
14:20technomancydanlarkin: half tounge-in-cheek, but I was also referring to slime's use of CVS
14:21technomancy(yuck yuck)
14:21danlarkintechnomancy: but aside from nit-picking git/svn for clojure&contrib, I like it
14:23technomancydanlarkin: cool. waiting to see what jochu says about it.
14:23hiredmankefka: that sounds like a real pain in the ass
14:24kefkahiredman: I think the best way is to convert it to something that implements TreeMap
14:24kefkain the Java API
14:24Chouser(doc subseq)
14:24clojurebotsc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true; arglists ([sc test key] [sc start-test start-key end-test end-key])
14:27Chouser,(apply sorted-map (interleave (range 10) (iterate inc 100)))
14:27clojurebot{0 100, 1 101, 2 102, 3 103, 4 104, 5 105, 6 106, 7 107, 8 108, 9 109}
14:27Chouser,(first (subseq (apply sorted-map (interleave (range 10) (iterate inc 85))) > 4))
14:27clojurebotjava.lang.NoClassDefFoundError: clojure/core$bound_fn__4473$fn__4475
14:27Chouserhm. that worked for me.
14:28Chouserkefka: anyway, that looks like your building block.
14:28kefkaChouser: If you're treying to answer my problem, I actually need O(log N) performance
14:28kefkaChouser: I can obviously iterate through the map, but I'm trying to use its sorted/binary-tree structure to get O(log N) lookup time
14:29Chousersubseq does this
14:30kefkaChouser: Ok, cool.
14:30Chousersubseq takes a sorted collection and a key, returns a seq starting at the given key's location
14:30ChouserI think. :-)
14:31ChouserI mean, that's what it returns, and I think it's O(log N) to get the seq started.
14:32kefkaChouser: Yeah. I guess I assumed subseq would behave like CL's subseq
14:32kefka,(subseq "foobar" 2 4)
14:32clojurebotjava.lang.NoClassDefFoundError: clojure/core$bound_fn__4473$fn__4475
14:33Chouserclojurebot's got some kind of issue with subseq.
14:33kefkaChouser: Well, it doesn't work at the repl either.
14:33kefkaChouser: because "foobar" is not a sorted collection
14:33Chouserright
14:36kefkaChouser: What is Clojure's "best practices" analog of subseq?
14:36clojurebotsvn rev 1224; Added doc string to ns macro, patch from mb
14:36clojurebotsvn rev 1225; Added doc strings for many *vars*, patch from Jarkko
14:36clojurebotsvn rev 1226; made :default a keyword arg to defmulti, added support for docstring and metadata map, patch from mb
14:36clojurebotsvn rev 1227; added mod, patch from Mark Engelberg
14:36clojurebotsvn rev 1228; made (stream astream) identity
14:37hiredman,(first (subseq (apply sorted-map (interleave (range 10) (iterate inc 85))) > 4))
14:37clojurebot[5 90]
14:37hiredmanhmmm
14:37hiredmanbetter make sure you are running a recent svn
14:37Chouserkefka: on a seq or a vector or... ?
14:38Chouser,(take 3 (drop 4 "commonlisp"))
14:38clojurebot(\o \n \l)
14:48jawolfeChouser: did you see my thread on faster set operations?
14:49Chouserjawolfe: by reordering arguments based on size, right?
14:49jawolfeChouser: yeah
14:49Chouserno, I didn't.
14:49jawolfehttp://groups.google.com/group/clojure/browse_thread/thread/29609929e94f279c?hl=en#
14:49Chouserer, wait, that's not right. I must have.
14:49jawolfehaha
14:50jawolfeAnyway, what are your thoughts on that ?
14:52Chouserseems fine. I've not used clojure.set much, but I don't know any reason why your suggestions would be bad.
14:53jawolfeok, thanks.
14:53jawolfeas a "meta" question ... I've had several threads like this that I think are good ideas
14:53jawolfeAnd nobody on the group disagrees
14:53jawolfeBut, Rich never chimes in with approval (or disapproval)
14:54jawolfeWhat's the right thing to do here?
14:54Chouserthat's a good question
14:54jawolfeShould I drop it? Keep bumping the thread? Or come here to troll for Rich (you can guess which I decided on :) )
14:55jawolfeOr just post the issue anyway, I guess, as a final option
14:55jawolfe(which is what I did for the .hashCode bug)
14:55danlarkinjob cuts at sun: http://www.theregister.co.uk/2009/01/23/sun_first_cuts/ :(
14:57technomancyspeaking of sun, does clojure work fine on openjdk, or is it recommended to only use sun's version?
14:57Chouserjawolfe: Rich assured me not too long ago that he still reads every post to the google group, so you can assume he's seen your suggestions.
14:58WizardofWestmarcwell, it ran on Azule which isn't pure sun jvm correct?
14:58jawolfeChouser: OK, so do I take a lack of response as "no thanks"
14:58Chouserjawolfe: or perhaps as a "not yet"?
14:58jawolfeChouser: Since, e.g., he never chimed in on the .hashCode thread, but when I posted an issue anyway, he fixed the bug pretty fast.
14:59duck1123I have to give credit to _anyone_ that can keep up with every message to the group, especially someone as busy as rich
14:59jawolfeChouser: if "not yet", then should I bring it up again later? If so, when?
14:59WizardofWestmarcyeah, the group's putting up something like 1800 posts/month now
15:00Chouserjawolfe: I *think* it would be acceptible to put a "Hey Rich, should I create an issue for this" on the end of the thread.
15:00jawolfeChouser: It seems to me that non-controversial changes should live on some sort of "issues" page, even if not the official one on Google gcode
15:00technomancyup to 1355 ML members now; nice
15:00jawolfeChouser: OK, but the two threads I'm talking about already have one of those at the end of the initial message:)
15:00WizardofWestmarcML members?
15:00WizardofWestmarcmailing list?
15:00technomancymailing list
15:00jawolfeChouser: OK to bump them by adding it again?
15:00WizardofWestmarccrazy
15:00technomancyWizardofWestmarc: google still considers it "low traffic" for some reason
15:01Chouserif he says "no", there's no point is bringing it up anymore. if he says "yes", your path forward is clear.
15:01WizardofWestmarc...really?
15:01technomancyhttp://groups.google.com/group/clojure <= in the sidebar
15:01WizardofWestmarc'cause it's keeping pace with the Django group
15:01Chouserif still no response, well, your guess is as good as mine
15:01jawolfeChouser: OK, thanks.
15:01rhickeyjawolfe: did I not say that your stuff wa sbest for contrib for now?
15:02jawolferhickey: yes, you did, specifically with respect to map-when and so on
15:02rhickeyi simply can't take every suggestion for core
15:02jawolferhickey: i know
15:02jawolfethere were four specific things for core i posted after that
15:02jawolfeall changes to existing functions
15:02rhickeynot now
15:03jawolfeok, thanks.
15:03jawolfehow about faster set operations?
15:03duck1123I like that contrib is the staging area for stuff that may eventually end up in core
15:04jawolfeduck1123: I like that too
15:04jawolfebut certain things, like making (distinct?) return true ...
15:04gnuvinceSpeaking on contrib, would greatest/least be an interesting addition?
15:04jawolfeit doesn't make sense to add a new version to contrib just for this change
15:04WizardofWestmarcIt makes sense, see how stuff works in practice before determining if it's worth putting in core. Plus I like a small core
15:05jbondesoni like your greatest least gnuvince, i know i'll be using it in my apps. but i'm not a registered contributor sooooo...
15:05gnuvinceChouser: what do you think?
15:06jawolfegnuvince: what do you think about maximal-elements ?
15:06jbondesonok, so now that i'm back from lunch, anyone consider themself knowledgable about the rational datatypes for math?
15:06gnuvincejawolfe: it that an existing lib?
15:06jawolfeit's on my list of proposed utilities for contrib
15:07gnuvinceDo you have code anywhere?
15:07jawolfehttp://groups.google.com/group/clojure/browse_thread/thread/134642cc76de17f7/97ac071e5d1e739c?hl=en&amp;
15:07jbondesondoes approximately the same thing, but rather than grabbing the first max, it grabs everything that is maximal
15:07jawolfeyou can get least, greatest, least-by, greatest-by from it ...
15:07gnuvincejawolfe: here's my code: http://github.com/gnuvince/clojure-greatest-least/blob/777edc6acfe016cb33f77d027cf5b6be2f5d888f/greatest-least.clj
15:08duck1123I just wish there was a better way to browse documentation for the fns in contrib. I was using clj-doc, but I think it's getting out of date and I got a bunch of errors when I tried running it locally.
15:09jawolfegnuvince: same basic idea
15:09technomancyduck1123: slime's C-c C-d d doesn't cut it for you?
15:09jawolfesometimes I want something like a random maximal element though, which is why getting all of them can be nice
15:09duck1123Thankfully, reading clojure source code as a means of documentation isn't all that painful
15:10gnuvincejawolfe: an random maximal element?
15:10duck1123technomancy: that works if you know what you're looking for, not if you just want to browse to see what's new that you're not using
15:11technomancyduck1123: yeah, a weekly "what's new" column would be awesome
15:11jawolfegnuvince: i.e., (let [richest (maximal-elements second {:bob 10 :bill 20 :sarah 20})] (random-element richest))
15:12gnuvinceSo it'd return either [:bill 20] or [:sarah 20]?
15:12jawolfeor maybe I want all the richest people: (map first (maximal-elements second {:bob 10 :bill 20 :sarah 20}))
15:12jawolfeyeah
15:12jawolfeI actually use that in a few places, when you want to make sure there is fair tie-breaking
15:13jawolfeChouser: If fast set operations are also "not now", what do you think about putting them in contrib
15:13jawolfeI don't like the idea of duplicating functionality, but orders of magnitude performance improvement can be useful ...
15:15jawolfegnuvince: how are least and greatest different from (min ...) and (max ...) ?
15:16gnuvincejawolfe: min and max work with numbers only.
15:16gnuvince,(max "hello" "world")
15:16clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
15:16jawolfegnuvince: ah, right
15:17gnuvince> (greatest "hello" "world")
15:17gnuvince"world"
15:18jawolfegnuvince: my maximal-elements only works with numbers too, I guess
15:18gnuvinceYes
15:18gnuvince,(> "hello" "world")
15:18clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
15:18jawolfegnuvince: maybe you could add "all-greatest-by", ...
15:18gnuvinceMy implementation works with compare
15:18jawolfegnuvince: although then there will be 8 :)
15:19gnuvincejawolfe: I'll do that.
15:19gnuvinceDo you have a github account?
15:19jawolfegnuvince: nope, not yet ... learning git as we speak
15:19gnuvinceok
15:20jawolfegnuvince: I think Chouser said it was OK to post a contrib issue for maximal-elements, and I'm happy to pass that on to you
15:20jawolfeif you want to post yours instead
15:20jawolfethat would make sense to me .
15:20gnuvincejawolfe: I'll see about adding a function to return all the greatest/least elements
15:20gnuvinceThen I'll submit it to Chouser for consideration
15:21jawolfegnuvince: thanks.
15:21gnuvinceThank you; I hadn't thought about the issue of multiple greatest values.
15:24eyerisShould the api documentation for (require) say "root resource <classpath>/x/y/z.clj" instead of "root resource <classpath>/x/y/z/z.clj"? I see the former in practice.
15:24Chousereyeris: yes, that's out of date
15:27Chouserthis is cool: http://www.trampolinesystems.com/blog/machines/2009/01/22/jruby-clojure/
15:29danlarkinChouser: yeah I saw that... very rad
15:29eyerisclojurebot where are the examples?
15:30Chousukeclojurebot: examples
15:30clojurebotexamples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
15:30Chousukeeyeris: don't forget the :
15:30eyerisYeah, I normally just /msg him
15:30eyerisor her
15:31eyeriswhatever :)
15:31mibuis there a simple way to strip a qualified name symbol's namespace part and just leave the name part? I want to write a simple utility to cleanup macroexpand-1's output so it's easier to read
15:32danlarkin(doc name)
15:33clojurebotReturns the name String of a symbol or keyword.; arglists ([x])
15:33eyerisWhat mistake am I making in my (ns) usage that would cause this exception? http://pastebin.ca/1316279
15:33danlarkinmibu: name
15:33mibudanlarkin: thanks
15:34hiredmaneyeris: drop the (:refer-clojure) bit
15:34hiredmanclojure.core is refered automatically (unless stuff)
15:35eyerisOk. That makes sense. However removing that didn't change the behaviour.
15:35hiredmaneyeris: there is more in the file right?
15:35eyerisRight
15:36hiredmanyou have a map somewhere that says something like {true }
15:36hiredman,(hash-map true)
15:36clojurebotjava.lang.IllegalArgumentException: No value supplied for key: true
15:36eyerisOh. Why is the exception on line 0 then?
15:36hiredman*shrug*
15:36eyeris:)
15:36technomancysweet; imenu support merged into clojure-mode
15:36ChouserI'd look at the rest of the stack trace. might get a useful line number deeper in
15:37hiredman,(identity {true })
15:37clojurebot1
15:37hiredmanhuh?
15:37hiredman,(identity {true})
15:37clojurebot1
15:37Chouserheh
15:37hiredman,(do {true })
15:37clojurebot1
15:37hiredmanwtf
15:38hiredman,(do {:a })
15:38clojurebot1
15:38gnuvince,(keys {:a})
15:38clojurebot1
15:38gnuvince,(values {:a})
15:38clojurebot1
15:38gnuvincepeculiar...
15:38WizardofWestmarcis 1 the new 42?
15:39hiredmanlooks like it must be partly a clojurebot bug
15:39hiredmanat a repl with a recent svn I get
15:39hiredmanuser=> (do {:a })
15:39hiredman{}
15:39hiredmanwhich is not 1
15:39Chouser,(= 1 {})
15:39clojurebotfalse
15:39Chouser,(= 1 (do {:a}))
15:39clojurebot1
15:39gnuvince,(= 1 {:a})
15:39clojurebot1
15:39eyerisThe stack trace doesn't mention any other lines in my file. However it ends with '... 10 more lines'
15:39WizardofWestmarc,(+ 5 5)
15:39clojurebot10
15:39Chousereyeris: you're in slime?
15:39eyerisIs there a switch to make it show the entire backtrace?
15:40WizardofWestmarc... so not EVERYTHING is borked
15:40eyerisChouser: no, running from the cmd line
15:40Chousereyeris: oh, then the 10 more lines should be there too
15:41Chouserjava prints the stack with frames in order, but broken into chunks that are printed in reverse order
15:41ChouserI think it thinks it's being helpful.
15:41hiredman,(do {:a :b 1})
15:41clojurebot3
15:42Chousukehuh?
15:42hiredmanWord
15:43eyerisApparently the problem really is with that (ns) form
15:43eyerisI get the same error if I try to run that alone
15:44hiredmanoh
15:44hiredmanand when you use :use you don't quote the following forms
15:46eyerisI don't understand.
15:47hiredman(:use '(compojure.http
15:48hiredman-> (:use (compojure.http
15:49eyeris(ns wiscaid (:use (compojure.http [servlet routes])))
15:49eyerisThat results in the same error
15:50eyerisI thought I had to quote the prefix list
15:50hiredmannot with ns
15:50eyerisThen why would that line fail?
15:51karmazillathe vector?
15:51hiredmanalso
15:51hiredmanyeah
15:51hiredmanthe vector
15:51eyerisoh
15:51eyerisrigh
15:51eyerisI just figured that out
15:51hiredman(ns wiscaid (:use (compojure.http servlet routes)))
15:51eyerisas you were typing it
15:51eyerisWhy does :require use a vector?
15:51hiredmanbecause require is different
15:52mrsolohi how do i pass java staticmethod as argument?
15:52hiredmanyou don't
15:52mrsolocan i partial it even?
15:52hiredmanno
15:52hiredmanyou use #()
15:52eyerishiredman Nice answer :)
15:52hiredman#(some/staticmethod %)
15:53hiredmanclojurebot: why are you doing this to me?
15:53clojurebotwhy not?
15:53karmazillalol
15:53hiredmanclojurebot: just work correctly!
15:53clojurebotHuh?
15:53mrsolothanks :-)
15:54karmazillahiredman: I didn't break it
15:55hiredmanhmmm
15:56hiredmanhmmm
15:56hiredmanuser=> (seq? {:a})
15:56hiredmanfalse
15:56hiredmanoh, it wouldn't be
15:57Chouserhiredman: {:a} is not a valid form -- I wouldn't expect any kind of consistent results.
15:57gnuvincehiredman: this only hapens in clojurebot.
15:57gnuvinceYou get an exception in the Repl.
15:57hiredmanI am not getting an exception at the repl
15:57karmazillaI didn't get an exception in my REPL
15:58gnuvinceuser=> {:a}
15:58gnuvincejava.lang.ArrayIndexOutOfBoundsException: 1 (NO_SOURCE_FILE:0)
15:58karmazillasvn 1128
15:59karmazilla*1228
15:59hiredmanbut clojurebot should return that exception
15:59gnuvinceI'll update...
15:59gnuvince,(/ 1 0)
15:59clojurebotjava.lang.ArithmeticException: Divide by zero
15:59eyerisThis (ns) form evaluates without a problem alone. But if I put anything else in the file after it, it throws an exception: http://pastebin.ca/1316306
15:59hiredmanah
16:00gnuvinceRevision: 1228
16:00hiredmanthe reader does not throw an exception if {:a} is wrapped in another expression
16:00gnuvinceuser=> {:a}
16:00gnuvincejava.lang.ArrayIndexOutOfBoundsException: 1 (NO_SOURCE_FILE:0)
16:00hiredmantry (seq {:a})
16:00gnuvincenil
16:01gnuvinceeyeris: I'm not sure that you can have multiple :use and :require
16:01hiredmangnuvince: I have
16:01hiredmanactually
16:01hiredmanmaybe I haven't
16:02gnuvincetry using the form: (:use (compojure file-utils jetty) (compojure.http servlet routes))
16:02eyerisSame behaviour
16:02hiredmanI dunno if you can use lists in require like that
16:03gnuvinceThe documentation on ns could probably use a little polish
16:03hiredmanA libspec is a lib name or a vector containing a lib name followed by options expressed as sequential keywords and arguments.
16:03hiredmanhttp://clojure.org/api#toc449
16:03eyerisRight. To me that means I need a vector if I want to use the :as keyword.
16:04eyerisPerhaps I can't use that in the :require macro.
16:04jbondesoni figured out what's happening with the (float large-rational), it's trying to do naive float conversion by turning the numerator and denominator into floats individually, and if they're too big? Infinity. And as we all know (/ Infinity Infinity) => NaN
16:04hiredmantry [dk.bestinclass clojureql :as sql]
16:04eyerisBut if the documentation says "Use :require in the ns macro in preference to calling this directly." then it should spend it's time on the (ns) docs instead of the (require) docs :()
16:05eyerishiredman That gives a different exception: Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: Keyword
16:05hiredmanok
16:05hiredmanyes, prefix lists
16:07eyerisHuh?
16:08Chousertry adding a :verbose after eash :use or :require, and see if that tells you anything useful.
16:08Chouser(:use :verbse (compojure...))
16:09hiredmanhuh
16:09eyerishttp://pastebin.ca/1316317
16:09hiredman(ns foo.bar (:require (baz [bloop :as b])))
16:09hiredman^- works fine here
16:09hiredmanno exceptions
16:11eyerisDoes that paste suggest the problem is in /org/danlarkin/json/decoder?
16:12danlarkineyeris: can you successfully require each of those packages individually?
16:13eyerisI'm trying that now.
16:14eyerisNo
16:15danlarkineyeris: and which namespace can't you require?
16:16eyerisHere are the results of that: http://pastebin.ca/1316323
16:16eyerisOh, I think the require may work.
16:16eyerisIt's hard for me to tell what is throwing the exception because the stacktrace says wiscaid.clj:0
16:16eyerisHowever there is no code on line 0
16:17eyerisOr, rather, there is an empty (ns)
16:17eyerisunless maybe those comment lines aren't actually comments inside of a macro?
16:18danlarkincan you to just (require :verbose '(org.danlarkin [json :as json])) from the REPL?
16:18eyerisNope. Removing those comments and moving the (ns wiscaid) line down a few lines still results in the wiscaid.clj:0 backtrace
16:18eyerisYes
16:18eyerisI can
16:20eyerisJust so we are clear, this is the file I am working with: http://pastebin.ca/1316334
16:21eyerisIf I take out everything after the last (require), I get 0 errors
16:21hiredmanuh
16:21hiredmanthe last two imports
16:21hiredmanthe vectors
16:21hiredmanlose them
16:21eyerisuhg
16:22eyerisI should have caught that
16:22eyerisThat silly backtrace for wiscaid.clj:0 confused me :/
16:23eyerisThanks for your patient help with it.
16:24hiredman~#clojure
16:24clojurebotthis is not IRC, this is #clojure. We aspire to better than that.
16:29hiredmanChouser: as someone who has made fancy smancy clojure graphics in the past, perhaps some sort of "how to contribute" flow chart is in order CA -> clojure.contrib -> rich -> clojure.core
16:31hiredmanclojurebot: do you know anything about Chouser?
16:31clojurebotChouser might make night
16:36jbondesonso to get a true rational -> float/double you have to round-trip through BigDecimal
16:40Chouserclojurebot: what does that even mean?
16:40hiredmanit's a quote
16:40hiredmansomeone said it
16:40Chouserheh. ok.
16:41jbondesonalright clojurebot lets see if you can handle this...
16:41jbondeson,(let [float2 #((. (java.math.BigDecimal. (.numerator %1)) divide (java.math.BigDecimal.(.denominator %1) ) 100 java.math.RoundingMode/HALF_EVEN))] (let [sqrt2 #(loop [x %2 i 0] (if (> i %3) x (recur (/ (+ x (/ %1 x)) 2) (inc i))))] (float (sqrt2 (/ 41 20) 2 7))))
16:41jbondeson>_>
16:42jbondesonclojurebot: did i kill you?
16:42hiredmanwoa
16:42jbondesononly takes 4ms on mine =/
16:43hiredmanjava it taking 33.50% of cpu time
16:43hiredmanshould have timed out by now
16:44jbondesonthat should be fairly short
16:44jbondesononly does 9 iterations of floating point math
16:44jbondesonerr
16:44jbondesonrational
16:44jbondesonGAH!
16:44hiredmannah
16:44jbondesonboticide
16:44hiredmanthat was me
16:44jbondesonwhew
16:44hiredmanI killed it
16:45jbondesonwell, i guess we know how to kill clojurebot: math
16:46hiredmanmost disappointing
16:46jbondesonthat was supposed to be an example of how to take a massive rational and make a float out of it (fairly) quickly
16:46hiredman,(let [float2 #((. (java.math.BigDecimal. (.numerator %1)) divide (java.math.BigDecimal.(.denominator %1) ) 100
16:46clojurebotEval-in-box threw an exception:EOF while reading
16:46hiredman java.math.RoundingMode/HALF_EVEN))] (let [sqrt2 #(loop [x %2 i 0] (if (> i %3)
16:46hiredman x (recur (/ (+ x (/ %1 x)) 2) (inc i))))] (float (sqrt2 (/ 41 20) 2 7))))
16:46hiredmanwhoops
16:47hiredman,(let [float2 #((. (java.math.BigDecimal. (.numerator %1)) divide (java.math.BigDecimal.(.denominator %1) ) 100 java.math.RoundingMode/HALF_EVEN))] (let [sqrt2 #(loop [x %2 i 0] (if (> i %3) x (recur (/ (+ x (/ %1 x)) 2) (inc i))))] (float (sqrt2 (/ 41 20) 2 7))))
16:47clojurebot1.4317821
16:47hiredmanweird
16:47eyerisI want to import a Java class jxl.write.Number but it clashes with java.lang.Number. How can I resolve this?
16:47kefkaclojurebot, when killed, should bounce back with "Yaaaaouch! Seafood soup is NOT on the menu!"
16:47cooldude127haha
16:47jbondesonseconded
16:47cooldude127hiredman: make it happen :)
16:47hiredmaneyeris: I think there is something in contrib for aliasing imports
16:48jbondesonhmmm, and my example was even wrong!
16:48kefkalet me try something
16:48jbondesongah
16:48kefkaclojurebot: die
16:49kefkaclojurebot: die is "Yaaaouch! Seafood soup is NOT on the Menu!"
16:49kefkaclojurebot: die
16:49kefkaNo... I don't know how to use it.
16:49cooldude127clojurebot is not happy
16:49kefka,(happy?)
16:51jbondesoni didn't do it this time!
16:54WizardofWestmarcjbondeson: but you're in the room, and we've proven repeatedly your various presence breaks stuff ;-)
16:54WizardofWestmarc*very
16:54WizardofWestmarcnfc why I put in various
16:55jbondesoni am an agent of destruction to computing equipment
17:06jbondesonit's a good thing that the repls for SBCL and Clojure are different, because i have restarted slime a half dozen times with SBCL and wondered what the hell was going on.
17:18technomancyhuh; sloccount doesn't know about clj files
17:39eyerisIs there a Clojure interface to anything like tempnam()?
17:41walterseyeris: File/createTempFile ?
17:43eyerisThanks. I'm a lisp *and* java newb.
17:43eyerisa.k.a hopeless :)
17:43waltersheh, yeah; learning the libraries is one of the hardest parts of a new language
17:43FibWhat does (ints) in clojure.core do? I can't find it in docs...
17:46ChouserI think it coerces to an array of primitive ints.
17:46Chouserthough I can't get it to return anything other than nil at the moment.
17:51jbondeson`while i was disconnected did anyone answer your question Fib?
17:52WizardofWestmarcif "returns nil" then yes <_<
17:53ChouserLooks like the docstring is meant to be "Casts to int[]"
17:53ChouserI wonder if definline is completely broken now, though.
17:53jbondeson`yeah
17:53WizardofWestmarcit's been broken for a while then
17:53jbondeson`it calls into java to cast to int[]
17:54WizardofWestmarcIIRC my clojure build is from early in the month
17:54WizardofWestmarcI'm not against current head by any stretch
17:54ChouserI can't do my own definline's, and the ones in clojure.core don't seem to work.
17:57jbondeson`ints looks to only be useful to re-cast an array handed from java, you can't use it on any of the persistent seqs
17:57Chouserright, I think it's mainly for use as a type-hint
17:57Chouserto create an array you want into-array or make-array
17:58Chouser,(into-array Integer/TYPE [1 2 3])
17:58Chouserclojurebot: ping?
17:58Chousukeseems dead :(
17:58jbondeson`i killed him a while ago and he hasn't been the same since =)
17:59jbondeson`err =(
17:59jbondeson`i wasn't happy, really!
18:00jbondeson`my api fu is really crappy, i somehow missed (bigdec)
18:01Chouserhm, looks like definline may have broken with AOT compilation.
18:02WizardofWestmarc... really?
18:02jbondeson`that was quite a bit ago
18:02WizardofWestmarcthat's from like, december or so
18:02WizardofWestmarche announced it nov 13 on the GG
18:03ChouserI'll try out git bisect, see what it tells me.
18:12eyerisDoes anyone here know how to set the mime type using compojure?
18:13Chouserdefinline broke at rev 1065, Oct 12
18:13WizardofWestmarcreally?
18:13WizardofWestmarcwow that's a while ago
18:39karmazillahiredman: I knew it. There really was a good reason for (set? (.keySet {})) => false
18:40erohtardo objects created using proxy behave like closures wrt defined vars ?
18:41karmazillaerohtar: yes
18:41erohtarkarmazilla: so from the object created via proxy, i should be able to get the same values of the vars?
18:41erohtarkarmazilla: or do i have to bind them locally inside the object?
18:43karmazilla,(.run (let [x 10] (proxy [Runnable] [] (run [] (println x)))))
18:43Chousererohtar: from the bodies of proxy methods you may directly refer to locals in the enclosing block.
18:43Chouserlike karmazilla just did. :-)
18:44Chouserbut I wouldn't call them 'vars' because a Var is something else.
18:44erohtarchouser: ok, so i do have to create a local binding
18:44karmazillaexcept... I'm still not quite friends with clojurebot
18:44erohtarchouser: i actually mean Vars
18:44erohtarchouser: i want the proxy object to reference Vars
18:45karmazillauhm... vars are global, no?
18:45erohtarkarmazilla: i thought so too
18:46Chouserusually, yes, especially ones called "defined vars" I would think
18:46erohtarbut im seeing a different result
18:46erohtarwhen a method is called on the proxy object, the values of the Vars are not visible
18:47ChouserIf I say (def foo-var 5), the only way to see a different value is if someone does 'binding' or 'def' again.
18:49erohtaryes, ok - so here's the scenario
18:49erohtari have a var called GLOBVAR lets say
18:49erohtarit starts out as "la la la"
18:49erohtari use binding, and set it to "X"
18:50erohtarwithin that, i call proxy, and an object P is created
18:50Chouserthat binding is local to the thread where its called.
18:50erohtarwhen a method is called on P, what value should GLOBVAR be?
18:50erohtarits all happening on the same thread so far
18:51erohtarmy impression was since its within the binding form's call-stack, it should be "X"
18:51Chouserif the call to the method is within the dynamic scope of the binding, it should be "X", otherwise it should be "la la la"
18:51erohtarhmm
18:51erohtarit doesnt appear that way - maybe im doing something wrong
18:52IslandAceasl?
18:52IslandAcejust kiddin''....
18:52karmazillabinding re-establishes the old values when you exit its scope, but you can always capture the _values_ with a let
18:53erohtarright i think whats happening is that my proxy object is actually a subscriber to a message queue
18:53erohtarand its possible that the proxy doing things in a new thread (or something)
18:54IslandAceSo... anyone dabbling with any stripes and clojure integration?
18:54erohtarwhich is why im losing the bindings
18:54erohtarwould that cause me to lose the bindings?
18:58Chouseryes, if the body of the method is executed in another thread, it'll see the root binding
19:12_hrrldI've seen some java code that does import foo.bar.* is there a clojure equivalent of this wildcard behavior?
19:12Chouser_hrrld: no
19:12cooldude127_hrrld: no, i don't think there is
19:13hiredman~*
19:13clojurebot* is just for when you are lazy and sloppy
19:13_hrrldI don't know much about Java, but this seems desirable... does it end up not being a bid deal?
19:14cooldude127_hrrld: not really a big deal at all
19:14Chouser_hrrld: I've not done much Java, but I find it hard to read Java examples when they use import *
19:14ChouserI can't tell where to find the docs for the classes they're using.
19:14clowsChouser: you get used to it after a while :)
19:15_hrrldI guess there are errors when you're missing imports anyway...
19:15cooldude127_hrrld: you usually know what classes you're using
19:16_hrrldYar, agreed. At the moment I'm just translating some existing Java examples.
19:21hiredmantechnomancy: "I happen to have a fresh install..."
19:21hiredmanbrilliant
19:21hiredmanwhat makes him think it isn't a one man show?
19:21technomancyjira is so bloody complicated.
19:22technomancyit's like the KDE 3.x fellas got a hold of it. ("Oh, a blank space? I'm sure we can find something to fill it with. Perhaps a button? or a drop-down?")
19:22jliChouser, what window manager do you use?
19:22Chouserion3
19:23jliah, okay.
19:26IslandAceforced to use jira at work... you get used to it, but my g*d why hasn't anyone written *the-definitive* issue/bug management system? i feel tempted (stop me and tell me i'm stupid and everybody has different reqs, and, whatever...)
19:26cooldude127IslandAce: have you seen pivotal tracker?
19:26technomancyIslandAce: clearly the problem is that nobody's tried to do it in clojure.
19:26IslandAcehey, you guys noticed it's friday? time for an after-work pirate style grogg
19:26IslandAcetechnomancy: ;-)
19:27IslandAcecooldud127: no
19:27technomancymy favourite bug tracker is called "grep -r TODO"
19:27cooldude127IslandAce: they approached it with simplicity, i'm quite a fan
19:28IslandAcei'll pitch that at the place that pay me from time to time...
19:28technomancyIslandAce: ditz is another fun one; you keep your issues with your source tree so when you merge branches, the fix conditions of the issues get merged too
19:28IslandAcephb: grep? is that java or dot net?
19:28technomancyhaven't tried ditz much myself, but the premise seems sound
19:29technomancyheh
19:31IslandAcehmm.. pivotal tracker seems interesting. too bad they just (taken 4 months) switch us all over to jira + confluence. feel my pitch will be shorter than an elevator ride.
19:32IslandAce(... my pitch *time* will be...)
19:33technomancyI've actually had really good luck with Trac
19:35IslandAcetech: they moved us away from trac. which we loved (or at least didn't hate). sigh.
19:36technomancythe confluence/jira emacs mode eases the pain some for me
19:36IslandAcepivotal seems cool, but also contains a deal-breaker - it seems to be "hosted only" and no way to do a local setup. won't fly with the phb's - our stuff is so crucial everyone and their mother-in-law would hack into any server just to take a look at our oh-so-important code...
19:37technomancyyeah, it certainly doesn't help
19:38IslandAcetech: thanks for the tip - hadn't heard about that (stupid though - doesn't everything have an emacs mode? should've thought about that...
19:39IslandAcehey, btw, anyone know about a grogg mixer emacs mode?
19:39technomancyIslandAce: you might be able to modify the coffee-pot mode
19:40technomancyIslandAce: http://emarsden.chez.com/downloads/coffee.el
19:40IslandAcehmm... could be good for an irish coffee...
19:42technomancyhttp://www.faqs.org/rfcs/rfc2324.html
19:42IslandAcetechnomancy: gives me cool ideas to build in the hardware segment... didn't i read something about robotic bartenders or something the other day...? hmm...
19:43technomancy"A coffee pot server MUST accept both the BREW and POST method equivalently. However, the use of POST for causing actions to happen is deprecated."
19:43IslandAcehttp://www.hackszine.com/blog/archive/2009/01/bar2d2_mobile_droid_bartender.html
19:44IslandAcetechnomancy: well, then, how do you GET the coffee when it's brewed?
19:44IslandAcetechnomancy: sorry, i'm all out of wit. damn this week was a long one.
19:44technomancyIslandAce: well the technology lags a bit behind the theory, as usual.
19:45IslandAcetechnomancy: a bit like ramdrives, space elevators and jon stewart then....
19:45technomancyThis really does not get old: "Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot". The resulting entity body MAY be short and stout."
19:49erohtarhow do i get access to command line arguments in a clojure script?
19:49IslandAcetechnomancy: yeah, too little hacker humour these days. everybody's to wound up fighting corporate policies on youtube usage that we don't have time to come up with these fantastic rfc's...
19:49Chouser*command-line-args*
19:49jbondesonyou need a main function and then you just add the args there
19:49jbondeson(defn -main [args] ...)
19:50jbondesonor that
19:50jbondeson*crossarms*
19:50erohtarchouser: thanks a lot!
19:50technomancyIslandAce: Oh, I don't know about that. (http://github.com/technomancy/bludgeon/tree/master)
19:50IslandAcetechnomancy: kudos!
19:54IslandAcetechnomancy: I'm questioning the BLUDGEON_PAGES .. eh.. what's it called in Ruby? thing. 500 pages isn't enough, I feel, to really maim someone. Go with 750 (and a good quality paper) and I think you've crossed the line into aggravated assault.
19:55technomancyIslandAce: some more research is definitely needed to calibrate that number. I based it on the weight of a Chicago phone book, which the Chicago police department has identified as a murder weapon in a certain case.
19:55karmazillaprinted on both or just one side of the paper?
19:55jbondesonthis is about the oddest conversation i've heard in a while.
19:55technomancyIslandAce: if you have any hard research findings to provide a better number, please send a patch.
19:55technomancy(I won't tell the cops.)
19:56IslandAcetechnomancy: give me a couple of hours...
19:56technomancykarmazilla: one-sided since that's pretty normal for source printouts
19:56IslandAcekarmazilla: i don't think that'll matter that much though - depends a little bit if you've got a laser or an ink printer of course, but hardly significant
19:57IslandAcejbondeson: well, always glad to be of assistance. i did ask (didn't I? I usually do) for some more vodka in exchange for my silence.
19:57technomancyIslandAce: it matters for calculating the line-numbers => pages ratio though
19:57danlarkinis ouroboros too annoying a name to type/pronounce for my software?
19:57jbondesonyou stay the hell away from my booze! >=|
19:58karmazillaFor reasons unknown, I came to print the Oracle SQL reference once. On both sides of the paper, and there was still plenty of it to give your partner in crime half of it
19:58technomancydanlarkin: I like it.
19:58IslandAcedanlarkin: depends if you want someone to recommend it to someone else via verbal communication...
19:58technomancycan't be worse than conkeror. =)
19:59jbondeson...
19:59technomancy"I didn't know you used KDE." / "No, no... the gecko-based one. With a C."
19:59danlarkinok, ouroboros or barchetta?
19:59IslandAcetechnomancy: i thought it sounded familiar...
19:59IslandAcedanlarkin: i vote barchetta. that sounds violent.
20:00danlarkinalthough I'm worried barchetta may be a registered trademark of Fiat, in which case I can't use it :-/
20:00karmazillaon wierd project names: http://rubyhoedown2008.confreaks.com/12-giles-bowkett-archaeopteryx-a-ruby-midi-generator.html
20:00karmazillawell, rather, _a_ weird project name
20:01IslandAce"Fiat Barchetta" is a registered trademark. Don't know about just "barchetta"
20:01technomancymeans "Little Boat"... what's this project do?
20:02IslandAcetechnomancy: floats your boat
20:02technomancynice
20:02danlarkinit's my rewrite/port of django to clojure
20:02jbondesonyou can tell that programmers suck at marketing just by looking at how they name projects
20:02IslandAcedanlarkin: that requires a seriously cool name... let's meditate a bit over that.. (and pour another grogg)
20:02technomancyambitious.
20:03danlarkinI want someone else to choose the name
20:03danlarkinI can't even name functions, jeez
20:03technomancyjormandjung is another name for ouroboros iirc
20:03IslandAcedanlarkin: what abut simply "clango"?
20:04jbondesoncjango?
20:04jbondesoncljango
20:04danlarkinno way
20:04technomancyclango sounds loud and common-lisp-ish
20:04danlarkinyeah, no clj- or -jure names
20:04IslandAcehey.. they're pretty cool jeans...
20:04karmazillaBentou
20:04jbondesonits been a jvm staple to just tack on j to ... everything
20:05danlarkinkarmazilla: as in lunch? :) yummmm
20:05karmazillaDjango sounds like dango, which is japanese stick food and bentou is like a lunch box
20:05jbondesonproject names that make me hungry are the worst
20:06danlarkinkarmazilla: actually django sounds like "jang go"
20:06technomancymythology is a great source for names
20:06karmazillabut, is that a food?
20:07IslandAcecarrillo
20:07danlarkincheek?
20:07danlarkin"cheek" sounds like a bad name for software to me
20:07danlarkinhaha
20:08technomancyoh, I've got it: "grimmshado" <= http://penny-arcade.com/comic/2009/1/19/
20:08jbondesonhmmm wish you could set a global math context instead of wrapping everything in a "with-precision"
20:08danlarkinhmmmm how does "syrinx" sound
20:08jbondesonsounds painful
20:08IslandAcedanlarkin: sci-fiish
20:09IslandAcedanlarkin: carrillo (besides meaning cheek in spanish) is a lunar crater
20:09jbondeson"just-use-the-damn-project"
20:09danlarkinhttp://en.wikipedia.org/wiki/Syrinx_(disambiguation)
20:10IslandAcedanlarkin: kongla
20:10IslandAcedanlarkin: valau
20:10technomancyvalhalla
20:10IslandAcedanlarkin: mavala
20:10danlarkinha, my friends were in a band called valhalla in highschool
20:10IslandAcedanlarkin: eturia
20:10technomancychinchilla
20:11technomancyok, done being "helpful" =)
20:11danlarkinIslandAce: are you just doing consonant-vowel-consonant-vowel?
20:11danlarkin:)
20:12IslandAcewe had a band called "uranium". tag line "radioactive rockers" (in swedish). we sounded absolutely aweful. but quite loud.
20:12IslandAcedanlarkin: well...
20:13IslandAcedanlarkin: actually, i'm a bit more interested in the code than the name... django on clojure sounds promising. what parts are you porting?
20:15danlarkinIslandAce: well, hopefully all of it eventually, at least what makes sense. So far I have the url dispatching, middleware, settings system, now I'm scratching my head on what to do with templating
20:16technomancydanlarkin: the obvious way is pretty compelling from what I've used of it so far
20:16technomancy(what compojure implements)
20:16IslandAcedanlarkin: nothing on the models/orm layer?
20:17danlarkinIslandAce: well I thought I should tackle the things I know most about first
20:17technomancythough compojure could use a lot more work on form helpers, particularly for nested data structures
20:17IslandAcedanlarkin: a solid idea indeed.
20:18technomancyno need to reinvent the wheel though; compojure's html is a separate library that you could build on with another framework.
20:18danlarkinI've spent time investigating the django ORM and.... it's preeeeeeetty complicated. Not to mention inherently object-oriented :)
20:19IslandAcehopefully we'll see a rapid evolvement of clojure web frameworks soon - when all talented people start pooling their talent into one framework so us less-talented people can get to work... :-)
20:19IslandAcei feel the whole bludgeon debate sort of died out..?
20:19danlarkintechnomancy: django has this interesting idea of "template loaders" -- which are just classes that know how to load templates from different places, usually it's the file system, but really it could be anywhere, HAM radio, email, S3 whatever...
20:20technomancydanlarkin: people actually use this?
20:20IslandAcei'd love to be able to load a template over ham radio. haven't used my 10 meter antenna in at least a decade...
20:20danlarkintechnomancy: so I was thinking of extending that to allow any templating system, the template loader function would have to deal with both ends peculiarities
20:20danlarkinmeaning one could possibly use compojure's html stuff, clj-html, whatever
20:20danlarkinraw strings
20:21technomancy(load-template "irc://freenode.net/#clojure/technomancy")
20:21danlarkinbut I haven't fleshed it out yet
20:23danlarkin*ideally* one could write a project with templates coming from many template-loaders, butttt I'm still trying to think of some way that makes sense for them all to play well together
20:23danlarkinmaybe I should turn my music down and think about it :)
21:30rzezeskiHas anyone else noticed that 'merge' works on data structures other than maps, but that the doc string for merge discusses it's behavior strictly in terms of maps. I wonder if this doc should change to be more general, or if the merge function should check that the arguments are indeed maps?