#clojure log - Jan 23 2009

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

0:09 durka42: hiredman: does the ~syntax require extra setup?

0:11 hiredman: no

0:11 I just pushed it around the time you were looking for the repo

0:11 durka42: it only seems to work when i address it to clojurebot

0:11 hiredman: the top of git log should be something about "~"

0:12 durka42: oh i missed that last commit

0:12 hiredman: if it isn't, you don't have "~"

0:21 eyeris: What is the proper way to iterate over a collection, binding both the seq entry and the index into the seq?

0:22 hiredman: (map vector [:a :b :c] (range 3))

0:23 ,(map vector [:a :b :c] (range 3))

0:23 clojurebot: ([:a 0] [:b 1] [:c 2])

0:23 jbondeson: finally! got an ant script just to compile the whole mess

0:24 durka42: ,(indexed [:a :b :c])

0:24 clojurebot: java.lang.Exception: Unable to resolve symbol: indexed in this context

0:24 eyeris: hiredman So that creates a new vector that I can iterate over using doseq?

0:24 hiredman: it creates a new seq of vectors

0:24 eyeris: Right

0:25 hiredman: sure, if you want to use doseq

0:25 eyeris: So then, in the doseq bindings, is there any "destructive binding"?

0:25 hiredman: you mean destructured?

0:25 eyeris: Or do I have to use the (first) and (last) to bind a symbol to the original seq entry and the index?

0:25 Cark: ,(doseq [[name index] (map vector [:a :b :c] (iterate inc 0))] (prn (str index name)))

0:25 clojurebot: "0:a" "1:b" "2:c"

0:26 hiredman: you could just use map instead of doseq there

0:26 eyeris: Thanks! The [name index] is what I meant by "destructive binding"

0:26 What is that called in clojure terms?

0:27 hiredman: destructured binding

0:27 eyeris: Ok

0:30 WizardofWestmarc: hm, this is strange, I have a vector of vector pairs that's giving me some weird issues when trying to run reduce against it

0:30 hiredman: what is the rror?

0:30 cooldude127: WizardofWestmarc: let's see some code!

0:30 WizardofWestmarc: so I do (reduce (fn [a b] a) vecofvecs)

0:30 and it only spits out the first vector inside the larger one

0:30 hiredman: ...

0:30 jbondeson: you don't want to see his code, he's a dirty ex-pythoner ;)

0:31 cooldude127: WizardofWestmarc: that's right

0:31 hiredman: WizardofWestmarc: that is how reduce works

0:31 jbondeson: yeah

0:31 WizardofWestmarc: well, here's the other thing

0:31 cooldude127: WizardofWestmarc: first arg is the accumulator, which starts with the first item in the sequence

0:31 jbondeson: you need to collect inside the function if you wanted to do that

0:31 WizardofWestmarc: good point

0:31 however

0:31 the example that caused me to try it

0:31 cooldude127: WizardofWestmarc: if you keep returning the accumulator, it won't change

0:31 WizardofWestmarc: (def totalwords (reduce fn([[_ freq1] [_ freq2]] (+ freq1 freq2)) sortedlist))

0:32 jbondeson: that counts

0:32 cooldude127: the second items in all the vectors

0:32 durka42: hiredman: i got clojurebot to promise to deliver messages. i'll work on fulfilling the promise tomorrow

0:32 jbondeson: and destructures

0:32 WizardofWestmarc: again, this is a vec of vecs [["xyz" 1] ["def" 5]] it blows up

0:32 hiredman: WizardofWestmarc: you obviously mispasted that

0:32 or mistyped it

0:32 cooldude127: no he didn't, it's wrong

0:32 hold on, let me fix it

0:33 WizardofWestmarc: oh, duh

0:33 I see one typo

0:33 I lost it in a repl crash

0:33 hiredman: fn is outside the parens

0:33 WizardofWestmarc: yeah noticed

0:33 hiredman: WizardofWestmarc: note the doubling up if the brakcets

0:33 WizardofWestmarc: but the error I get when my code isn't dumb is claiming I'm trying to nth an int

0:33 hiredman: of

0:34 cooldude127: WizardofWestmarc: (reduce (fn [acc [_ freq]] (+ acc freq)) 0 sortedlist)

0:34 try that

0:34 hiredman: man, my internet sucks

0:34 jbondeson: your intertubes are clogged, call a plumber

0:34 cooldude127: lol

0:34 hiredman: nah, it'ss just clearwire

0:35 WizardofWestmarc: ok, that worked

0:35 and I get it

0:35 cooldude127: good

0:35 WizardofWestmarc: so I'd HAVE to use the initialval to make it work

0:35 cooldude127: you only get a vector for the accumulator the first time

0:35 WizardofWestmarc: to return a scalar value, yes

0:35 hiredman: WizardofWestmarc: http://clojure.org/special_forms <-- the bit about let holds true in most binding forms in clojure

0:35 WizardofWestmarc: right

0:36 my mistake was missing the fact of how it was using the accumulator

0:36 I don't normally do reduce w/anything more then basic forms

0:36 cooldude127: WizardofWestmarc: yeah, glad that's cleared up

0:36 reduce isn't the obvious functional idiom

0:36 WizardofWestmarc: just stuff like adding a mass list of numbers generated somehow or the like

0:36 cooldude127: s/the/the most/

0:36 yeah

3:08 zakwilson: Am I correct in assuming that pmap works best when used with a CPU-intensive function and a small collection?

3:11 Cark: i don't know for the small collection part, but yes for the cpu intensive function

3:31 Lau_of_DK: Top of the morning gents

3:43 zakwilson: Good morning, Lau_of_DK

3:43 AWizzArd: Hi

3:44 zakwilson: Hi AWizzArd

6:57 AWizzArd: Schon so einiges an Deutschen hier ;-)

7:04 red_fish: I think I found a bug in http://clojure.org/refs http://paste.pocoo.org/show/100966/

7:04 a race condition

7:07 AWizzArd: Can you say more about it?

7:12 vy: Why I couldn't require swank.core in here: http://paste.pocoo.org/show/100970/

7:13 Chousuke: vy: do you have a swank-clojure/swank/swank/ directory?

7:13 vy: you might try just adding swank-clojure/ into the classpath

7:14 instead of the swank subdir

7:14 since it seems to be part of the package structure.

7:14 vy: Hrm... Let me try that.

7:14 Chousuke: also, depending on where the swank.clj is, you might need to require 'swank.swank instead (to match swank/swank.clj)

7:15 vy: This 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)

7:16 AWizzArd: seems that is already progress

7:16 red_fish: can you please tell us more about the potential bug in refs?

7:16 vy: Yup, it obviously did. But this time it appears be requiring me to write swank.swank.util, which is quite ugly IMHO.

7:17 AWizzArd: vy: when you open the utl.clj file... what (ns ..) does it establish?

7:17 It says (ns swank.util ..) right?

7:18 So if the dir that contains the subdir swank is in your CP, then swank.swank.util seems to be right

7:18 Chousuke: is your swank-clojure recent?

7:18 vy: Oops! You're right, it probably says clojure/ns, which should be clojure.core/ns.

7:19 Chousuke: Yep, but it doesn't support the clojure to clojure.core transfer.

7:19 Chousuke: huh

7:19 mine works just fine :/

7:19 vy: Huh?

7:20 Am I trying to fix something already fixed in the HEAD?

7:20 Chousuke: last commit in the git repo was on Jan 13

7:20 vy: Brr!

7:29 Chousuke: But still (require 'swank-clojure-autoload) requires a pre-set swank-clojure-jar-path and swank-clojure-extra-classpaths.

7:30 Chousuke: well, yeah

7:31 just set them? :/

7:31 vy: I do, but the README is missing mentioning about that gotcha, despite I submitted 2 repetitive bug reports about it.

7:32 Chousuke: Hrm... Would you mind sharing some of your .emacs lines related with SLIME and Clojure?

7:34 Chousuke: vy: I doubt it's really helpful, but here: http://github.com/Chousuke/dotfiles/blob/56eafa24c73fdfaa974c434fad1080f090ef0300/Aquamacs-customizations.el

7:35 I wish I knew how to make that 'viper-in-more-modes things work with clojure-mode and/or slime though :(

7:36 it only works for elisp, and apparently it's *supposed* to work with slime too, but it doesn't.

7:36 and I have no clue why

8:30 gnuvince: Hi

8:48 red_fish: AWizzArd: It's a problem with LinkedBlockedQueue

8:48 AWizzArd: It can stay in dosync and the resulting coll is out of order

8:48 it can't stay

8:55 rhickey: I found a race condition in the example of ref (http://clojure.org/refs) http://paste.pocoo.org/show/100985/

8:56 rhickey: the output collection can be out of order

8:58 rhickey: red_fish: thanks, I'll check it out

9:09 red_fish: that's a naming problem - was never designed to maintain order

9:12 red_fish: I clarified the docs

9:14 rfgpfeiffer: there is an edge case with sets as functions

9:14 (#{true false nil} nil)

9:16 Chousuke: hmm

9:16 rhickey: rfgpfeiffer: only if you don't understand how they behave when used as functions

9:17 Chousuke: that might be a slight gotcha but I wouldn't consider it a real problem

9:18 rhickey: you always have to be more careful treating accessors as predicates when the values can be false/nil:

9:18 (get {:a nil} :a)

9:20 There was a time when (get #{:a} :a) -> true, and therefor (get #{nil} nil) -> true, but just returning booleans has a lot less utility

9:21 user=> (filter #{\a \b \c \d} "fred")

9:21 (\d)

9:23 vy: Isn'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.

9:23 rhickey: vy: no, it's not, otherwise yes, that would be nice.

9:24 * rhickey tried to get multiple values to work efficiently in early Clojure prototypes

9:25 rfgpfeiffer: I wrote some test cases for properties of algebraic structures like monoids. Is this something for contrib?

9:26 rhickey: rfgpfeiffer: could you post a description of your work on the group?

9:29 rfgpfeiffer: test if something behaves like a monoid: http://gist.github.com/51026

9:44 rhickey: rfgpfeiffer: I'd like to try that, but it's mssing some defs - closure-under? a-associative?

9:46 jbondeson: so 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.

9:47 it 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

9:47 rfgpfeiffer: rhickey: http://gist.github.com/51030

9:50 actually, seqs are not a monoid, because the neutral element nil is not a seq

9:51 rhickey: rfgpfeiffer: neat - I think you might a different name than zero - maybe none or empty ?

9:51 gnuvince: rfgpfeiffer: is that a requisite or just something statically typed languages need to have?

9:51 rfgpfeiffer: neutral, maybe

9:53 gnuvince: It is for test cases

9:54 gnuvince: When you think about your data in terms of abstract algebra(like seqs), you can unify your test cases in terms of abstract algebra

9:57 jbondeson: it is officially too early in the morning for me to be thinking that abstract ;)

9:58 karmazilla: is there such a thing as concrete algebra?

9:59 rfgpfeiffer: yeah

9:59 1+1=2

9:59 pretty concrete

9:59 cooldude127: very concrete

10:00 jbondeson: only for small values of 1 though

10:00 karmazilla: I can follow that

10:00 cooldude127: let's define small

10:01 karmazilla: ,(def small 1)

10:01 clojurebot: Titim gan �ir� ort.

10:01 cooldude127: clojurebot: what does that mean?

10:01 clojurebot: excusez-moi

10:01 rfgpfeiffer: natural numbers form a monoid with +. 0 is a neutral element

10:01 cooldude127: quit dodging my questions

10:02 jbondeson: ,(let [big+ #(+ 1 (+ %1 %2))] (big+ 1 1))

10:02 clojurebot: 3

10:03 jbondeson: see!

10:03 cooldude127: DIFFERENT OPERATION

10:03 jbondeson: oh

10:03 fine

10:04 cooldude127: lol

10:05 rfgpfeiffer: the natural numbers only form a semigroup with big+, because (big+ 0 0) isn't 0

10:06 see? its easy

10:06 jbondeson: yes, but that's to be expected from large values of 0

10:07 cooldude127: oh god

10:20 Chouser-away: rhickey: are we allowed to use 'definline'?

10:21 cooldude127: lol

10:26 bstephenson: gm 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:30 vy: Shouldn'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:31 cooldude127: vy: yes

10:32 i noticed that the other day

10:48 Chouser: vy: fixed, thanks.

10:51 cooldude127: woooo

10:52 vy: Ok, I won't talk about porting documentation to a more consistent format (LaTeX, DocBook, etc.) stuff.

10:53 Chouser: vy: why not?

10:53 vy: AFAIS, developers ignore it.

10:54 Chouser: See http://groups.google.com/group/clojure/msg/18f3147d875b236d

10:55 Chouser: sure enough. :-)

11:00 eyeris: Is there any policie or opposition to including examples on the /api page?

11:00 policy*

11:01 Or is the Wiki the better place for that?

11:05 Chouser: the api page is directly created from the docstrings. That's the closest thing I have to an answer to your question.

11:05 sorry it's not very close.

11:05 eyeris: That's helpful. Now all I have to do is submit a patch to those and see if it gets denied :)

11:05 I think I will work on the Wiki before doing that though.

11:06 Chouser: I thought I saw some other wiki where somebody was trying to provide a comprehensive set of examples for all clojure functions.

11:08 eyeris: Was this it? http://en.wikibooks.org/wiki/Clojure_Programming/By_Example

11:17 hiredman: clojurebot: where are the examples?

11:17 clojurebot: examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples

11:18 eyeris: Sweet

11:20 drewr: What's the current recommended practice on created custom exception classes? I thought I remember that proxy is verboten.

11:20 Chouser: drewr: proxy doesn't help because the name of your new class isn't very useful

11:21 drewr: so one obvious option is gen-class

11:22 drewr: I had some thoughts on an alternate mechanism: http://paste.lisp.org/display/72867

11:22 drewr: Yeah, I basically want to do "class MyError(StandardError): pass" in Python.

11:22 Chouser: drewr: 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:23 drewr: I keep doing (throw (Exception. "...")) which doesn't seem helpful to consumers of my libs.

11:24 They have no granularity in their catching.

11:24 danlarkin: I'm +1 for a common idiom for custom exception classes

11:25 right, throwing (Exception. "..") isn't as helpful as it could be

11:25 hiredman: clojurebot: exceptions?

11:25 clojurebot: I don't understand.

11:25 hiredman: clojurebot: exceptions is http://wuhrr.wordpress.com/2007/11/22/java-exceptions-list/

11:25 clojurebot: 'Sea, mhuise.

11:25 Chouser: danlarkin: my question is, does the stuff in my "musings" provide sufficient features to take the place of actual Exception subclasses in many cases

11:26 hiredman: next to you can pick a more suitable exception from the list to throw

11:26 instead of Exception

11:27 clojurebot: exceptions is also http://java.sun.com/javase/6/docs/api/java/lang/Exception.html

11:27 clojurebot: You don't have to tell me twice.

11:27 hiredman: ^- lists most of the known subclasses

11:28 danlarkin: yes, but sometimes an exceptional case doesn't fit into one of the existing subclasses

11:29 drewr: Chouser: I'd love to see something along those lines become conventional.

11:30 jbondeson: anybody having problems with the latest clojure-contrib?

11:31 danlarkin: Chouser: seems like a lot of work to solve a problem that's already solved... with custom exception classes

11:31 Chouser: drewr: 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:31 danlarkin: it has extra features beyond Java exceptions. :-)

11:32 and doesn't require pre-compilation like Java a custom Java exception currently does.

11:34 it's actually not very much code -- I could put it in contrib and see if anybody ends up using it.

11:34 any suggestions for better names than 'handling' and 'handle'?

11:34 of the equiv. of 'try' and 'catch'?

11:35 'attempt' and 'absorb' :-P

11:36 danlarkin: with-errors and handle?

11:36 naming sucks :-/

11:38 drewr: Naming has caused me to completely give up on projects before.

11:40 Nafai: drewr: Heh. :)

11:41 drewr: Yo Nafai!

11:41 Nafai: Hey drewr

11:48 Chouser: hm, I think I could still use 'catch' and 'finally', thought that might be more confusing than it's worth

11:57 shoover: Chouser: is this something like CL's handler-case, handler-bind, restart-case?

12:00 Chouser: shoover: you tell me. :-)

12:00 I don't know CL well enough to know.

12:00 I think I said last time this came up that I would read up on those.

12:01 shoover: :) it took me a long time to read that chapter in Practical Common Lisp

12:01 Chouser: Is PCL online for free anywhere?

12:02 might be easier than reading the hyperspec

12:02 shoover: clojurebot: CL conditions is http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html

12:02 clojurebot: In Ordnung

12:03 Chouser: shoover: thanks

12:03 shoover: handler-case is like a try/catch--stack unwinds to the handler that matches the exception

12:03 handler-bind is a dynamic binding thing that lets you provide handler to run at the stack level where the error happens

12:03 then there's restart-case, but I'm running out of steam

12:04 Chouser: s'okay. I'll read that chapter and/or the hyperspec.

12:04 It's more fun to create than to learn, but the creations are better if you learn first.

12:06 shoover: true that. my sense is that you're building the thing, but maybe CL will provide understanding to help with names (or hurt)

12:07 Chouser: right. If it's possible to build something that works identically or very nearly so, reusing the names would be very helpful.

12:07 if 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:13 CL has a hierarchy of condition classes, just like Java has a hierarchy of exception classes.

12:13 I wonder if that tends to be as shallow in CL as it is in Java.

12:14 supporting that would make my code a good deal more complicated, I think, if it's even possible.

12:16 technomancy: clojurebot: forget slime-installer

12:16 clojurebot: slime is icky

12:16 technomancy: clojurebot: slime-installer is http://github.com/technomancy/clojure-mode/blob/0f28b61de90ce8a09d75bf1668ef3f1c200f9c52/clojure-mode.el#L560

12:16 clojurebot: Ik begrijp

12:17 hiredman: Chouser: the gview widget is neat

12:22 Chouser: hiredman: oh, from my blog?

12:23 hiredman: Chouser: yes

12:23 Chouser: I need to update that with a note about clojure.inspector

12:23 which has some surprisingly similar code in it

12:26 ,(inspect-tree {:a [4 5 6] :b [1 2 3] :c [7 8 9]})

12:26 clojurebot: java.lang.Exception: Unable to resolve symbol: inspect-tree in this context

12:26 Chouser: ,(use 'clojure.contrib.inspector)

12:26 clojurebot: java.io.FileNotFoundException: Could not locate clojure/contrib/inspector__init.class or clojure/contrib/inspector.clj on classpath:

12:26 Chouser: bah

12:26 ,(use 'clojure.inspector)

12:27 clojurebot: nil

12:27 Chouser: ,(inspect-tree {:a [4 5 6] :b [1 2 3] :c [7 8 9]})

12:27 clojurebot: java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it.

12:27 hiredman: hwa

12:27 Chouser: heh. anyway, something like that

12:33 rfgpfeiffer: ,2

12:33 hiredman: ,(identity 2)

12:33 clojurebot: 2

12:34 rfgpfeiffer: ,(+ 3 4)

12:34 clojurebot: 7

12:34 jbondeson: sooo... anyone with commit access to clojure-contrib want to remove the private def of mod from math.clj?

12:34 last night it was added to clojure.core

12:35 Chouser: jbondeson: is it in your way?

12:36 jbondeson: i just modified it locally and rebuilt, i was just letting people know.

12:36 took me a while to figure out what happened.

12:36 Chouser: ah, ok.

12:43 technomancy: so 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:56 Chouser: technomancy: :-)

13:30 karmazilla: ,(let [s (.keySet {:a 1})] [(set? s) (ifn? s)])

13:30 clojurebot: Excuse me?

13:30 karmazilla: clojurebot hates me

13:31 hiredman: oops

13:32 sorry, when you were trying to break clojurebot I made him ignore you

13:32 karmazilla: aww

13:32 jbondeson: so, i have a fun one.

13:32 karmazilla: I promise I won't break him again... willfully

13:33 jbondeson: i have a rational that returns "NaN" when trying to float it

13:33 hiredman: karmazilla: try now

13:33 jbondeson: and the denominator isn't 0...

13:34 karmazilla: ,(let [s (.keySet {:a 1})] [(set? s) (ifn? s)])

13:34 clojurebot: java.lang.reflect.InvocationTargetException

13:34 hiredman: ,(.keySet {:a 1})

13:34 clojurebot: java.lang.reflect.InvocationTargetException

13:35 hiredman: (let [s (set (keys {:a 1}))] [(set? s) (ifn? s)])

13:35 jbondeson: i guess with ratios that have 10k characters in the string representation it just dies

13:35 which is odd

13:35 hiredman: ,(let [s (set (keys {:a 1}))] [(set? s) (ifn? s)])

13:35 clojurebot: [true true]

13:36 karmazilla: the point I'm trying to make is that the code I pasted gives [false false]

13:36 hiredman: no, it gives an exception

13:37 karmazilla: in what version of Clojure? I'm on trunk

13:37 hiredman: ah

13:37 latest svn does return [false false]

13:38 looks like .keySet no longer returns a set

13:38 or maybe it does

13:38 it is an inner class

13:38 karmazilla: it looks like an oversight to me. I think it should be [true true], but maybe there's A Very Good reason

13:39 hiredman: user=> (set? (.keySet {:a 1}))

13:39 false

13:39 karmazilla: maybe you should stop calling java methods

13:40 and use (comp set keys)

13:40 karmazilla: why? Java interop is part of what makes clojure practical and useful to me

13:41 jbondeson: how long of a clojure expression will clojurebot take, hireman?

13:41 hiredman: jbondeson: only one way to find out

13:41 jbondeson: \m/

13:41 ,(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:41 clojurebot: 1.4317821

13:41 jbondeson: ,(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:41 clojurebot: NaN

13:41 jbondeson: there we go

13:42 trying to calculate a rational sqrt

13:42 and it fails to convert back to a float

13:42 hiredman: karmazilla: rhickey_ and Chouser seem to be out, so you could take it to the group

13:44 karmazilla: hmm... but every change I've ever proposed to Clojure has been rejected. Don't know if I dare

13:44 jbondeson: oh well, i'll look into that after lunch

13:44 hiredman: karmazilla: there is always a first time

13:47 jawolfe: Hi all

13:47 I 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:49 I guess several of them are for Rich; are you here currently?

13:51 Anyway, if anyone else wants to discuss, I have a number of proposals for core, and I'd like to hear people's opinions

13:51 - Faster set operations (http://groups.google.com/group/clojure/browse_thread/thread/29609929e94f279c?hl=en#)

13:52 - 0-arg distinct? returns true, not an exception (so (apply distinct? nil) = true)

13:52 - rewrite concat so that (apply concat seq) doesn't evaluate the first three elements of seq

13:52 - make every?, not-every?, some, not-any? take multiple seq args like map, i.e., (every? not= [1 2 3] [2 3 4])

13:52 - allow arguments to merge-with after the first to be lists of pairs.

13:53 - consider aliases when reading namespace-qualified keywords (http://groups.google.com/group/clojure/browse_thread/thread/dbf2cd9130eb06a3?hl=en#)

13:53 If anyone likes or dislikes any of these, I'd like to hear it ... I'll be hanging around here for a while.

13:58 duck1123: I liked that 0-arg distinct one

13:58 nil contains no duplicates, why shouldn't it return true

13:59 jawolfe: exactly, thanks.

14:00 duck1123: so, (every? not= [1 2 3] [2 3 4]) => true?

14:01 jawolfe: That would be the idea.

14:01 Just a shortcut for (every? identity (map f ....))

14:01 That's the one I care about the least

14:03 duck1123: yeah, I'm not sure how well that one would work out

14:03 jawolfe: there's no down-side, really, since every? currently only accepts two arguments

14:03 But there is a short idiom for the same thing

14:04 duck1123: wasn't there talk about giving map-like functionality to a whole bunch of functions? What ever happened to that?

14:04 jawolfe: I'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&

14:05 Hi, Rich?

14:05 * rhickey is in meeting

14:06 Cark: what would be a nice tool to investigate a memory leak ,

14:06 jawolfe: OK, thanks ... can I ask you a few quick questions later?

14:06 Cark: ?

14:06 jawolfe: Cark: try YourKit

14:06 duck1123: doesn't the ns-qualifying work for ::keywords?

14:07 Cark: jawolfe : thanks !

14:07 duck1123: I tried that the other day and it was doing exactly that

14:07 jawolfe: you can get the free version http://www.yourkit.com/eap/index.jsp

14:07 hiredman: duck1123: he is talking about aliases

14:07 jawolfe: Yes, :: works

14:07 hiredman: yes

14:07 hiredman: like you (require '[ foo.bar :as foo])

14:08 duck1123: right I did ::date/Date and it turned into :clojue.contrib.date/Date

14:08 jawolfe: Then, you still must :foo.bar/keyword

14:08 oooh

14:08 hiredman: :foo/blarg is not the same as :foo.bar/Blarg

14:08 er

14:08 jawolfe: really ?

14:08 hiredman: jawolfe: I am explaing the current state of play

14:08 or trying to

14:08 oh, you are talking to duck1123

14:09 jawolfe: hiredman: duck1123 is correct

14:09 ::foo/blarg does what I want

14:09 duck1123: one issue down :)

14:09 hiredman: well, something new everyday

14:09 jawolfe: Very cool ... just need docs for that now :)

14:10 I'll resurrect my thread on the group to make sure others hear about it

14:10 duck1123: thanks!

14:10 duck1123: np, I didn't know it did that till the other day when I was trying to help out cooldude

14:13 danlarkin: heyyyoo lots of updates to clojure-mode, hooray

14:14 technomancy: danlarkin: yeah, glad to see the maintainer is coming back online

14:14 danlarkin: did you see my post about M-x clojure-install ?

14:14 danlarkin: no, point me to it?

14:15 technomancy: danlarkin: http://groups.google.com/group/clojure/browse_thread/thread/dfce84232ea8cf7a/e3320bc433eb910a?lnk=gst&q=slime#e3320bc433eb910a

14:16 danlarkin: just a response to all the "how do you install slime" questions we seem to get in here.

14:17 danlarkin: technomancy: 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:18 technomancy: danlarkin: given that they're synched automatically, I think so

14:18 the 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:18 kefka: If 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:19 technomancy: danlarkin: I like being able to list only three dependencies: git, jvm, and ant; none of this legacy stuff.

14:19 kefka: ,(isa? (sorted-map) java.util.TreeMap)

14:19 clojurebot: false

14:19 Chouser: I use git and the official google code repos

14:19 danlarkin: technomancy: well it's not legacy, it's still in use!

14:20 technomancy: danlarkin: half tounge-in-cheek, but I was also referring to slime's use of CVS

14:21 (yuck yuck)

14:21 danlarkin: technomancy: but aside from nit-picking git/svn for clojure&contrib, I like it

14:23 technomancy: danlarkin: cool. waiting to see what jochu says about it.

14:23 hiredman: kefka: that sounds like a real pain in the ass

14:24 kefka: hiredman: I think the best way is to convert it to something that implements TreeMap

14:24 in the Java API

14:24 Chouser: (doc subseq)

14:24 clojurebot: sc 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:27 Chouser: ,(apply sorted-map (interleave (range 10) (iterate inc 100)))

14:27 clojurebot: {0 100, 1 101, 2 102, 3 103, 4 104, 5 105, 6 106, 7 107, 8 108, 9 109}

14:27 Chouser: ,(first (subseq (apply sorted-map (interleave (range 10) (iterate inc 85))) > 4))

14:27 clojurebot: java.lang.NoClassDefFoundError: clojure/core$bound_fn__4473$fn__4475

14:27 Chouser: hm. that worked for me.

14:28 kefka: anyway, that looks like your building block.

14:28 kefka: Chouser: If you're treying to answer my problem, I actually need O(log N) performance

14:28 Chouser: 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:29 Chouser: subseq does this

14:30 kefka: Chouser: Ok, cool.

14:30 Chouser: subseq takes a sorted collection and a key, returns a seq starting at the given key's location

14:30 I think. :-)

14:31 I mean, that's what it returns, and I think it's O(log N) to get the seq started.

14:32 kefka: Chouser: Yeah. I guess I assumed subseq would behave like CL's subseq

14:32 ,(subseq "foobar" 2 4)

14:32 clojurebot: java.lang.NoClassDefFoundError: clojure/core$bound_fn__4473$fn__4475

14:33 Chouser: clojurebot's got some kind of issue with subseq.

14:33 kefka: Chouser: Well, it doesn't work at the repl either.

14:33 Chouser: because "foobar" is not a sorted collection

14:33 Chouser: right

14:36 kefka: Chouser: What is Clojure's "best practices" analog of subseq?

14:36 clojurebot: svn rev 1224; Added doc string to ns macro, patch from mb

14:36 svn rev 1225; Added doc strings for many *vars*, patch from Jarkko

14:36 svn rev 1226; made :default a keyword arg to defmulti, added support for docstring and metadata map, patch from mb

14:36 svn rev 1227; added mod, patch from Mark Engelberg

14:36 svn rev 1228; made (stream astream) identity

14:37 hiredman: ,(first (subseq (apply sorted-map (interleave (range 10) (iterate inc 85))) > 4))

14:37 clojurebot: [5 90]

14:37 hiredman: hmmm

14:37 better make sure you are running a recent svn

14:37 Chouser: kefka: on a seq or a vector or... ?

14:38 ,(take 3 (drop 4 "commonlisp"))

14:38 clojurebot: (\o \n \l)

14:48 jawolfe: Chouser: did you see my thread on faster set operations?

14:49 Chouser: jawolfe: by reordering arguments based on size, right?

14:49 jawolfe: Chouser: yeah

14:49 Chouser: no, I didn't.

14:49 jawolfe: http://groups.google.com/group/clojure/browse_thread/thread/29609929e94f279c?hl=en#

14:49 Chouser: er, wait, that's not right. I must have.

14:49 jawolfe: haha

14:50 Anyway, what are your thoughts on that ?

14:52 Chouser: seems fine. I've not used clojure.set much, but I don't know any reason why your suggestions would be bad.

14:53 jawolfe: ok, thanks.

14:53 as a "meta" question ... I've had several threads like this that I think are good ideas

14:53 And nobody on the group disagrees

14:53 But, Rich never chimes in with approval (or disapproval)

14:54 What's the right thing to do here?

14:54 Chouser: that's a good question

14:54 jawolfe: Should I drop it? Keep bumping the thread? Or come here to troll for Rich (you can guess which I decided on :) )

14:55 Or just post the issue anyway, I guess, as a final option

14:55 (which is what I did for the .hashCode bug)

14:55 danlarkin: job cuts at sun: http://www.theregister.co.uk/2009/01/23/sun_first_cuts/ :(

14:57 technomancy: speaking of sun, does clojure work fine on openjdk, or is it recommended to only use sun's version?

14:57 Chouser: jawolfe: 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:58 WizardofWestmarc: well, it ran on Azule which isn't pure sun jvm correct?

14:58 jawolfe: Chouser: OK, so do I take a lack of response as "no thanks"

14:58 Chouser: jawolfe: or perhaps as a "not yet"?

14:58 jawolfe: Chouser: 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:59 duck1123: I have to give credit to _anyone_ that can keep up with every message to the group, especially someone as busy as rich

14:59 jawolfe: Chouser: if "not yet", then should I bring it up again later? If so, when?

14:59 WizardofWestmarc: yeah, the group's putting up something like 1800 posts/month now

15:00 Chouser: jawolfe: 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:00 jawolfe: Chouser: 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:00 technomancy: up to 1355 ML members now; nice

15:00 jawolfe: Chouser: OK, but the two threads I'm talking about already have one of those at the end of the initial message:)

15:00 WizardofWestmarc: ML members?

15:00 mailing list?

15:00 technomancy: mailing list

15:00 jawolfe: Chouser: OK to bump them by adding it again?

15:00 WizardofWestmarc: crazy

15:00 technomancy: WizardofWestmarc: google still considers it "low traffic" for some reason

15:01 Chouser: if he says "no", there's no point is bringing it up anymore. if he says "yes", your path forward is clear.

15:01 WizardofWestmarc: ...really?

15:01 technomancy: http://groups.google.com/group/clojure <= in the sidebar

15:01 WizardofWestmarc: 'cause it's keeping pace with the Django group

15:01 Chouser: if still no response, well, your guess is as good as mine

15:01 jawolfe: Chouser: OK, thanks.

15:01 rhickey: jawolfe: did I not say that your stuff wa sbest for contrib for now?

15:02 jawolfe: rhickey: yes, you did, specifically with respect to map-when and so on

15:02 rhickey: i simply can't take every suggestion for core

15:02 jawolfe: rhickey: i know

15:02 there were four specific things for core i posted after that

15:02 all changes to existing functions

15:02 rhickey: not now

15:03 jawolfe: ok, thanks.

15:03 how about faster set operations?

15:03 duck1123: I like that contrib is the staging area for stuff that may eventually end up in core

15:04 jawolfe: duck1123: I like that too

15:04 but certain things, like making (distinct?) return true ...

15:04 gnuvince: Speaking on contrib, would greatest/least be an interesting addition?

15:04 jawolfe: it doesn't make sense to add a new version to contrib just for this change

15:04 WizardofWestmarc: It makes sense, see how stuff works in practice before determining if it's worth putting in core. Plus I like a small core

15:05 jbondeson: i like your greatest least gnuvince, i know i'll be using it in my apps. but i'm not a registered contributor sooooo...

15:05 gnuvince: Chouser: what do you think?

15:06 jawolfe: gnuvince: what do you think about maximal-elements ?

15:06 jbondeson: ok, so now that i'm back from lunch, anyone consider themself knowledgable about the rational datatypes for math?

15:06 gnuvince: jawolfe: it that an existing lib?

15:06 jawolfe: it's on my list of proposed utilities for contrib

15:07 gnuvince: Do you have code anywhere?

15:07 jawolfe: http://groups.google.com/group/clojure/browse_thread/thread/134642cc76de17f7/97ac071e5d1e739c?hl=en&

15:07 jbondeson: does approximately the same thing, but rather than grabbing the first max, it grabs everything that is maximal

15:07 jawolfe: you can get least, greatest, least-by, greatest-by from it ...

15:07 gnuvince: jawolfe: here's my code: http://github.com/gnuvince/clojure-greatest-least/blob/777edc6acfe016cb33f77d027cf5b6be2f5d888f/greatest-least.clj

15:08 duck1123: I 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:09 jawolfe: gnuvince: same basic idea

15:09 technomancy: duck1123: slime's C-c C-d d doesn't cut it for you?

15:09 jawolfe: sometimes I want something like a random maximal element though, which is why getting all of them can be nice

15:09 duck1123: Thankfully, reading clojure source code as a means of documentation isn't all that painful

15:10 gnuvince: jawolfe: an random maximal element?

15:10 duck1123: technomancy: 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:11 technomancy: duck1123: yeah, a weekly "what's new" column would be awesome

15:11 jawolfe: gnuvince: i.e., (let [richest (maximal-elements second {:bob 10 :bill 20 :sarah 20})] (random-element richest))

15:12 gnuvince: So it'd return either [:bill 20] or [:sarah 20]?

15:12 jawolfe: or maybe I want all the richest people: (map first (maximal-elements second {:bob 10 :bill 20 :sarah 20}))

15:12 yeah

15:12 I actually use that in a few places, when you want to make sure there is fair tie-breaking

15:13 Chouser: If fast set operations are also "not now", what do you think about putting them in contrib

15:13 I don't like the idea of duplicating functionality, but orders of magnitude performance improvement can be useful ...

15:15 gnuvince: how are least and greatest different from (min ...) and (max ...) ?

15:16 gnuvince: jawolfe: min and max work with numbers only.

15:16 ,(max "hello" "world")

15:16 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

15:16 jawolfe: gnuvince: ah, right

15:17 gnuvince: > (greatest "hello" "world")

15:17 "world"

15:18 jawolfe: gnuvince: my maximal-elements only works with numbers too, I guess

15:18 gnuvince: Yes

15:18 ,(> "hello" "world")

15:18 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

15:18 jawolfe: gnuvince: maybe you could add "all-greatest-by", ...

15:18 gnuvince: My implementation works with compare

15:18 jawolfe: gnuvince: although then there will be 8 :)

15:19 gnuvince: jawolfe: I'll do that.

15:19 Do you have a github account?

15:19 jawolfe: gnuvince: nope, not yet ... learning git as we speak

15:19 gnuvince: ok

15:20 jawolfe: gnuvince: 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:20 if you want to post yours instead

15:20 that would make sense to me .

15:20 gnuvince: jawolfe: I'll see about adding a function to return all the greatest/least elements

15:20 Then I'll submit it to Chouser for consideration

15:21 jawolfe: gnuvince: thanks.

15:21 gnuvince: Thank you; I hadn't thought about the issue of multiple greatest values.

15:24 eyeris: Should 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:24 Chouser: eyeris: yes, that's out of date

15:27 this is cool: http://www.trampolinesystems.com/blog/machines/2009/01/22/jruby-clojure/

15:29 danlarkin: Chouser: yeah I saw that... very rad

15:29 eyeris: clojurebot where are the examples?

15:30 Chousuke: clojurebot: examples

15:30 clojurebot: examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples

15:30 Chousuke: eyeris: don't forget the :

15:30 eyeris: Yeah, I normally just /msg him

15:30 or her

15:31 whatever :)

15:31 mibu: is 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:32 danlarkin: (doc name)

15:33 clojurebot: Returns the name String of a symbol or keyword.; arglists ([x])

15:33 eyeris: What mistake am I making in my (ns) usage that would cause this exception? http://pastebin.ca/1316279

15:33 danlarkin: mibu: name

15:33 mibu: danlarkin: thanks

15:34 hiredman: eyeris: drop the (:refer-clojure) bit

15:34 clojure.core is refered automatically (unless stuff)

15:35 eyeris: Ok. That makes sense. However removing that didn't change the behaviour.

15:35 hiredman: eyeris: there is more in the file right?

15:35 eyeris: Right

15:36 hiredman: you have a map somewhere that says something like {true }

15:36 ,(hash-map true)

15:36 clojurebot: java.lang.IllegalArgumentException: No value supplied for key: true

15:36 eyeris: Oh. Why is the exception on line 0 then?

15:36 hiredman: *shrug*

15:36 eyeris: :)

15:36 technomancy: sweet; imenu support merged into clojure-mode

15:36 Chouser: I'd look at the rest of the stack trace. might get a useful line number deeper in

15:37 hiredman: ,(identity {true })

15:37 clojurebot: 1

15:37 hiredman: huh?

15:37 ,(identity {true})

15:37 clojurebot: 1

15:37 Chouser: heh

15:37 hiredman: ,(do {true })

15:37 clojurebot: 1

15:37 hiredman: wtf

15:38 ,(do {:a })

15:38 clojurebot: 1

15:38 gnuvince: ,(keys {:a})

15:38 clojurebot: 1

15:38 gnuvince: ,(values {:a})

15:38 clojurebot: 1

15:38 gnuvince: peculiar...

15:38 WizardofWestmarc: is 1 the new 42?

15:39 hiredman: looks like it must be partly a clojurebot bug

15:39 at a repl with a recent svn I get

15:39 user=> (do {:a })

15:39 {}

15:39 which is not 1

15:39 Chouser: ,(= 1 {})

15:39 clojurebot: false

15:39 Chouser: ,(= 1 (do {:a}))

15:39 clojurebot: 1

15:39 gnuvince: ,(= 1 {:a})

15:39 clojurebot: 1

15:39 eyeris: The stack trace doesn't mention any other lines in my file. However it ends with '... 10 more lines'

15:39 WizardofWestmarc: ,(+ 5 5)

15:39 clojurebot: 10

15:39 Chouser: eyeris: you're in slime?

15:39 eyeris: Is there a switch to make it show the entire backtrace?

15:40 WizardofWestmarc: ... so not EVERYTHING is borked

15:40 eyeris: Chouser: no, running from the cmd line

15:40 Chouser: eyeris: oh, then the 10 more lines should be there too

15:41 java prints the stack with frames in order, but broken into chunks that are printed in reverse order

15:41 I think it thinks it's being helpful.

15:41 hiredman: ,(do {:a :b 1})

15:41 clojurebot: 3

15:42 Chousuke: huh?

15:42 hiredman: Word

15:43 eyeris: Apparently the problem really is with that (ns) form

15:43 I get the same error if I try to run that alone

15:44 hiredman: oh

15:44 and when you use :use you don't quote the following forms

15:46 eyeris: I don't understand.

15:47 hiredman: (:use '(compojure.http

15:48 -> (:use (compojure.http

15:49 eyeris: (ns wiscaid (:use (compojure.http [servlet routes])))

15:49 That results in the same error

15:50 I thought I had to quote the prefix list

15:50 hiredman: not with ns

15:50 eyeris: Then why would that line fail?

15:51 karmazilla: the vector?

15:51 hiredman: also

15:51 yeah

15:51 the vector

15:51 eyeris: oh

15:51 righ

15:51 I just figured that out

15:51 hiredman: (ns wiscaid (:use (compojure.http servlet routes)))

15:51 eyeris: as you were typing it

15:51 Why does :require use a vector?

15:51 hiredman: because require is different

15:52 mrsolo: hi how do i pass java staticmethod as argument?

15:52 hiredman: you don't

15:52 mrsolo: can i partial it even?

15:52 hiredman: no

15:52 you use #()

15:52 eyeris: hiredman Nice answer :)

15:52 hiredman: #(some/staticmethod %)

15:53 clojurebot: why are you doing this to me?

15:53 clojurebot: why not?

15:53 karmazilla: lol

15:53 hiredman: clojurebot: just work correctly!

15:53 clojurebot: Huh?

15:53 mrsolo: thanks :-)

15:54 karmazilla: hiredman: I didn't break it

15:55 hiredman: hmmm

15:56 hmmm

15:56 user=> (seq? {:a})

15:56 false

15:56 oh, it wouldn't be

15:57 Chouser: hiredman: {:a} is not a valid form -- I wouldn't expect any kind of consistent results.

15:57 gnuvince: hiredman: this only hapens in clojurebot.

15:57 You get an exception in the Repl.

15:57 hiredman: I am not getting an exception at the repl

15:57 karmazilla: I didn't get an exception in my REPL

15:58 gnuvince: user=> {:a}

15:58 java.lang.ArrayIndexOutOfBoundsException: 1 (NO_SOURCE_FILE:0)

15:58 karmazilla: svn 1128

15:59 *1228

15:59 hiredman: but clojurebot should return that exception

15:59 gnuvince: I'll update...

15:59 ,(/ 1 0)

15:59 clojurebot: java.lang.ArithmeticException: Divide by zero

15:59 eyeris: This (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:59 hiredman: ah

16:00 gnuvince: Revision: 1228

16:00 hiredman: the reader does not throw an exception if {:a} is wrapped in another expression

16:00 gnuvince: user=> {:a}

16:00 java.lang.ArrayIndexOutOfBoundsException: 1 (NO_SOURCE_FILE:0)

16:00 hiredman: try (seq {:a})

16:00 gnuvince: nil

16:01 eyeris: I'm not sure that you can have multiple :use and :require

16:01 hiredman: gnuvince: I have

16:01 actually

16:01 maybe I haven't

16:02 gnuvince: try using the form: (:use (compojure file-utils jetty) (compojure.http servlet routes))

16:02 eyeris: Same behaviour

16:02 hiredman: I dunno if you can use lists in require like that

16:03 gnuvince: The documentation on ns could probably use a little polish

16:03 hiredman: A libspec is a lib name or a vector containing a lib name followed by options expressed as sequential keywords and arguments.

16:03 http://clojure.org/api#toc449

16:03 eyeris: Right. To me that means I need a vector if I want to use the :as keyword.

16:04 Perhaps I can't use that in the :require macro.

16:04 jbondeson: i 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:04 hiredman: try [dk.bestinclass clojureql :as sql]

16:04 * jbondeson hits his head on his desk

16:04 eyeris: But 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:05 hiredman That gives a different exception: Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: Keyword

16:05 hiredman: ok

16:05 yes, prefix lists

16:07 eyeris: Huh?

16:08 Chouser: try adding a :verbose after eash :use or :require, and see if that tells you anything useful.

16:08 (:use :verbse (compojure...))

16:09 hiredman: huh

16:09 eyeris: http://pastebin.ca/1316317

16:09 hiredman: (ns foo.bar (:require (baz [bloop :as b])))

16:09 ^- works fine here

16:09 no exceptions

16:11 eyeris: Does that paste suggest the problem is in /org/danlarkin/json/decoder?

16:12 danlarkin: eyeris: can you successfully require each of those packages individually?

16:13 eyeris: I'm trying that now.

16:14 No

16:15 danlarkin: eyeris: and which namespace can't you require?

16:16 eyeris: Here are the results of that: http://pastebin.ca/1316323

16:16 Oh, I think the require may work.

16:16 It's hard for me to tell what is throwing the exception because the stacktrace says wiscaid.clj:0

16:16 However there is no code on line 0

16:17 Or, rather, there is an empty (ns)

16:17 unless maybe those comment lines aren't actually comments inside of a macro?

16:18 danlarkin: can you to just (require :verbose '(org.danlarkin [json :as json])) from the REPL?

16:18 eyeris: Nope. Removing those comments and moving the (ns wiscaid) line down a few lines still results in the wiscaid.clj:0 backtrace

16:18 Yes

16:18 I can

16:20 Just so we are clear, this is the file I am working with: http://pastebin.ca/1316334

16:21 If I take out everything after the last (require), I get 0 errors

16:21 hiredman: uh

16:21 the last two imports

16:21 the vectors

16:21 lose them

16:21 eyeris: uhg

16:22 I should have caught that

16:22 That silly backtrace for wiscaid.clj:0 confused me :/

16:23 Thanks for your patient help with it.

16:23 * danlarkin shakes fist

16:24 hiredman: ~#clojure

16:24 clojurebot: this is not IRC, this is #clojure. We aspire to better than that.

16:29 hiredman: Chouser: 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:31 clojurebot: do you know anything about Chouser?

16:31 clojurebot: Chouser might make night

16:36 jbondeson: so to get a true rational -> float/double you have to round-trip through BigDecimal

16:40 Chouser: clojurebot: what does that even mean?

16:40 hiredman: it's a quote

16:40 someone said it

16:40 Chouser: heh. ok.

16:41 jbondeson: alright clojurebot lets see if you can handle this...

16:41 ,(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:41 >_>

16:42 clojurebot: did i kill you?

16:42 hiredman: woa

16:42 jbondeson: only takes 4ms on mine =/

16:43 hiredman: java it taking 33.50% of cpu time

16:43 should have timed out by now

16:44 jbondeson: that should be fairly short

16:44 only does 9 iterations of floating point math

16:44 err

16:44 rational

16:44 GAH!

16:44 hiredman: nah

16:44 jbondeson: boticide

16:44 hiredman: that was me

16:44 jbondeson: whew

16:44 hiredman: I killed it

16:45 jbondeson: well, i guess we know how to kill clojurebot: math

16:46 hiredman: most disappointing

16:46 jbondeson: that was supposed to be an example of how to take a massive rational and make a float out of it (fairly) quickly

16:46 hiredman: ,(let [float2 #((. (java.math.BigDecimal. (.numerator %1)) divide (java.math.BigDecimal.(.denominator %1) ) 100

16:46 clojurebot: Eval-in-box threw an exception:EOF while reading

16:46 hiredman: java.math.RoundingMode/HALF_EVEN))] (let [sqrt2 #(loop [x %2 i 0] (if (> i %3)

16:46 x (recur (/ (+ x (/ %1 x)) 2) (inc i))))] (float (sqrt2 (/ 41 20) 2 7))))

16:46 whoops

16:47 ,(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:47 clojurebot: 1.4317821

16:47 hiredman: weird

16:47 eyeris: I want to import a Java class jxl.write.Number but it clashes with java.lang.Number. How can I resolve this?

16:47 kefka: clojurebot, when killed, should bounce back with "Yaaaaouch! Seafood soup is NOT on the menu!"

16:47 cooldude127: haha

16:47 jbondeson: seconded

16:47 cooldude127: hiredman: make it happen :)

16:47 hiredman: eyeris: I think there is something in contrib for aliasing imports

16:48 jbondeson: hmmm, and my example was even wrong!

16:48 kefka: let me try something

16:48 jbondeson: gah

16:48 kefka: clojurebot: die

16:49 clojurebot: die is "Yaaaouch! Seafood soup is NOT on the Menu!"

16:49 clojurebot: die

16:49 No... I don't know how to use it.

16:49 cooldude127: clojurebot is not happy

16:49 kefka: ,(happy?)

16:51 jbondeson: i didn't do it this time!

16:54 WizardofWestmarc: jbondeson: but you're in the room, and we've proven repeatedly your various presence breaks stuff ;-)

16:54 *very

16:54 nfc why I put in various

16:55 jbondeson: i am an agent of destruction to computing equipment

17:06 it'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:18 technomancy: huh; sloccount doesn't know about clj files

17:39 eyeris: Is there a Clojure interface to anything like tempnam()?

17:41 walters: eyeris: File/createTempFile ?

17:43 eyeris: Thanks. I'm a lisp *and* java newb.

17:43 a.k.a hopeless :)

17:43 walters: heh, yeah; learning the libraries is one of the hardest parts of a new language

17:43 Fib: What does (ints) in clojure.core do? I can't find it in docs...

17:46 Chouser: I think it coerces to an array of primitive ints.

17:46 though I can't get it to return anything other than nil at the moment.

17:51 jbondeson`: while i was disconnected did anyone answer your question Fib?

17:52 WizardofWestmarc: if "returns nil" then yes <_<

17:53 Chouser: Looks like the docstring is meant to be "Casts to int[]"

17:53 I wonder if definline is completely broken now, though.

17:53 jbondeson`: yeah

17:53 WizardofWestmarc: it's been broken for a while then

17:53 jbondeson`: it calls into java to cast to int[]

17:54 WizardofWestmarc: IIRC my clojure build is from early in the month

17:54 I'm not against current head by any stretch

17:54 Chouser: I can't do my own definline's, and the ones in clojure.core don't seem to work.

17:57 jbondeson`: 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:57 Chouser: right, I think it's mainly for use as a type-hint

17:57 to create an array you want into-array or make-array

17:58 ,(into-array Integer/TYPE [1 2 3])

17:58 clojurebot: ping?

17:58 Chousuke: seems dead :(

17:58 jbondeson`: i killed him a while ago and he hasn't been the same since =)

17:59 err =(

17:59 i wasn't happy, really!

18:00 my api fu is really crappy, i somehow missed (bigdec)

18:01 Chouser: hm, looks like definline may have broken with AOT compilation.

18:02 WizardofWestmarc: ... really?

18:02 jbondeson`: that was quite a bit ago

18:02 WizardofWestmarc: that's from like, december or so

18:02 he announced it nov 13 on the GG

18:03 Chouser: I'll try out git bisect, see what it tells me.

18:04 * technomancy never passes up an opportunity to bisect

18:12 eyeris: Does anyone here know how to set the mime type using compojure?

18:13 Chouser: definline broke at rev 1065, Oct 12

18:13 WizardofWestmarc: really?

18:13 wow that's a while ago

18:39 karmazilla: hiredman: I knew it. There really was a good reason for (set? (.keySet {})) => false

18:40 erohtar: do objects created using proxy behave like closures wrt defined vars ?

18:41 karmazilla: erohtar: yes

18:41 erohtar: karmazilla: so from the object created via proxy, i should be able to get the same values of the vars?

18:41 karmazilla: or do i have to bind them locally inside the object?

18:43 karmazilla: ,(.run (let [x 10] (proxy [Runnable] [] (run [] (println x)))))

18:43 Chouser: erohtar: from the bodies of proxy methods you may directly refer to locals in the enclosing block.

18:43 like karmazilla just did. :-)

18:44 but I wouldn't call them 'vars' because a Var is something else.

18:44 erohtar: chouser: ok, so i do have to create a local binding

18:44 karmazilla: except... I'm still not quite friends with clojurebot

18:44 erohtar: chouser: i actually mean Vars

18:44 chouser: i want the proxy object to reference Vars

18:45 karmazilla: uhm... vars are global, no?

18:45 erohtar: karmazilla: i thought so too

18:46 Chouser: usually, yes, especially ones called "defined vars" I would think

18:46 erohtar: but im seeing a different result

18:46 when a method is called on the proxy object, the values of the Vars are not visible

18:47 Chouser: If I say (def foo-var 5), the only way to see a different value is if someone does 'binding' or 'def' again.

18:49 erohtar: yes, ok - so here's the scenario

18:49 i have a var called GLOBVAR lets say

18:49 it starts out as "la la la"

18:49 i use binding, and set it to "X"

18:50 within that, i call proxy, and an object P is created

18:50 Chouser: that binding is local to the thread where its called.

18:50 erohtar: when a method is called on P, what value should GLOBVAR be?

18:50 its all happening on the same thread so far

18:51 my impression was since its within the binding form's call-stack, it should be "X"

18:51 Chouser: if 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:51 erohtar: hmm

18:51 it doesnt appear that way - maybe im doing something wrong

18:52 IslandAce: asl?

18:52 just kiddin''....

18:52 karmazilla: binding re-establishes the old values when you exit its scope, but you can always capture the _values_ with a let

18:53 erohtar: right i think whats happening is that my proxy object is actually a subscriber to a message queue

18:53 and its possible that the proxy doing things in a new thread (or something)

18:54 IslandAce: So... anyone dabbling with any stripes and clojure integration?

18:54 erohtar: which is why im losing the bindings

18:54 would that cause me to lose the bindings?

18:58 Chouser: yes, if the body of the method is executed in another thread, it'll see the root binding

19:12 _hrrld: I've seen some java code that does import foo.bar.* is there a clojure equivalent of this wildcard behavior?

19:12 Chouser: _hrrld: no

19:12 cooldude127: _hrrld: no, i don't think there is

19:13 hiredman: ~*

19:13 clojurebot: * is just for when you are lazy and sloppy

19:13 _hrrld: I don't know much about Java, but this seems desirable... does it end up not being a bid deal?

19:14 cooldude127: _hrrld: not really a big deal at all

19:14 Chouser: _hrrld: I've not done much Java, but I find it hard to read Java examples when they use import *

19:14 I can't tell where to find the docs for the classes they're using.

19:14 clows: Chouser: you get used to it after a while :)

19:15 _hrrld: I guess there are errors when you're missing imports anyway...

19:15 cooldude127: _hrrld: you usually know what classes you're using

19:16 _hrrld: Yar, agreed. At the moment I'm just translating some existing Java examples.

19:19 * technomancy notices a suggestion to use JIRA on the mailing list... hope no one takes that seriously.

19:21 hiredman: technomancy: "I happen to have a fresh install..."

19:21 brilliant

19:21 what makes him think it isn't a one man show?

19:21 technomancy: jira is so bloody complicated.

19:22 it'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:22 jli: Chouser, what window manager do you use?

19:22 Chouser: ion3

19:23 jli: ah, okay.

19:26 IslandAce: forced 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:26 cooldude127: IslandAce: have you seen pivotal tracker?

19:26 technomancy: IslandAce: clearly the problem is that nobody's tried to do it in clojure.

19:26 IslandAce: hey, you guys noticed it's friday? time for an after-work pirate style grogg

19:26 technomancy: ;-)

19:27 cooldud127: no

19:27 technomancy: my favourite bug tracker is called "grep -r TODO"

19:27 cooldude127: IslandAce: they approached it with simplicity, i'm quite a fan

19:28 IslandAce: i'll pitch that at the place that pay me from time to time...

19:28 technomancy: IslandAce: 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:28 IslandAce: phb: grep? is that java or dot net?

19:28 technomancy: haven't tried ditz much myself, but the premise seems sound

19:29 heh

19:31 IslandAce: hmm.. 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:32 (... my pitch *time* will be...)

19:33 technomancy: I've actually had really good luck with Trac

19:35 IslandAce: tech: they moved us away from trac. which we loved (or at least didn't hate). sigh.

19:36 technomancy: the confluence/jira emacs mode eases the pain some for me

19:36 IslandAce: pivotal 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:37 technomancy: yeah, it certainly doesn't help

19:38 IslandAce: tech: thanks for the tip - hadn't heard about that (stupid though - doesn't everything have an emacs mode? should've thought about that...

19:39 hey, btw, anyone know about a grogg mixer emacs mode?

19:39 technomancy: IslandAce: you might be able to modify the coffee-pot mode

19:40 IslandAce: http://emarsden.chez.com/downloads/coffee.el

19:40 IslandAce: hmm... could be good for an irish coffee...

19:41 * technomancy <3 RFC2324

19:42 technomancy: http://www.faqs.org/rfcs/rfc2324.html

19:42 IslandAce: technomancy: 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:43 technomancy: "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:43 IslandAce: http://www.hackszine.com/blog/archive/2009/01/bar2d2_mobile_droid_bartender.html

19:44 technomancy: well, then, how do you GET the coffee when it's brewed?

19:44 technomancy: sorry, i'm all out of wit. damn this week was a long one.

19:44 technomancy: IslandAce: well the technology lags a bit behind the theory, as usual.

19:45 IslandAce: technomancy: a bit like ramdrives, space elevators and jon stewart then....

19:45 technomancy: This 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:49 erohtar: how do i get access to command line arguments in a clojure script?

19:49 IslandAce: technomancy: 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:49 Chouser: *command-line-args*

19:49 jbondeson: you need a main function and then you just add the args there

19:49 (defn -main [args] ...)

19:50 or that

19:50 *crossarms*

19:50 erohtar: chouser: thanks a lot!

19:50 technomancy: IslandAce: Oh, I don't know about that. (http://github.com/technomancy/bludgeon/tree/master)

19:50 IslandAce: technomancy: kudos!

19:54 technomancy: 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:55 technomancy: IslandAce: 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:55 karmazilla: printed on both or just one side of the paper?

19:55 jbondeson: this is about the oddest conversation i've heard in a while.

19:55 technomancy: IslandAce: if you have any hard research findings to provide a better number, please send a patch.

19:55 (I won't tell the cops.)

19:56 IslandAce: technomancy: give me a couple of hours...

19:56 technomancy: karmazilla: one-sided since that's pretty normal for source printouts

19:56 IslandAce: karmazilla: 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:57 jbondeson: 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:57 technomancy: IslandAce: it matters for calculating the line-numbers => pages ratio though

19:57 danlarkin: is ouroboros too annoying a name to type/pronounce for my software?

19:57 jbondeson: you stay the hell away from my booze! >=|

19:58 karmazilla: For 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:58 technomancy: danlarkin: I like it.

19:58 IslandAce: danlarkin: depends if you want someone to recommend it to someone else via verbal communication...

19:58 technomancy: can't be worse than conkeror. =)

19:59 jbondeson: ...

19:59 technomancy: "I didn't know you used KDE." / "No, no... the gecko-based one. With a C."

19:59 danlarkin: ok, ouroboros or barchetta?

19:59 IslandAce: technomancy: i thought it sounded familiar...

19:59 danlarkin: i vote barchetta. that sounds violent.

20:00 danlarkin: although I'm worried barchetta may be a registered trademark of Fiat, in which case I can't use it :-/

20:00 karmazilla: on wierd project names: http://rubyhoedown2008.confreaks.com/12-giles-bowkett-archaeopteryx-a-ruby-midi-generator.html

20:00 well, rather, _a_ weird project name

20:01 IslandAce: "Fiat Barchetta" is a registered trademark. Don't know about just "barchetta"

20:01 technomancy: means "Little Boat"... what's this project do?

20:02 IslandAce: technomancy: floats your boat

20:02 technomancy: nice

20:02 danlarkin: it's my rewrite/port of django to clojure

20:02 jbondeson: you can tell that programmers suck at marketing just by looking at how they name projects

20:02 IslandAce: danlarkin: that requires a seriously cool name... let's meditate a bit over that.. (and pour another grogg)

20:02 technomancy: ambitious.

20:03 danlarkin: I want someone else to choose the name

20:03 I can't even name functions, jeez

20:03 technomancy: jormandjung is another name for ouroboros iirc

20:03 IslandAce: danlarkin: what abut simply "clango"?

20:04 jbondeson: cjango?

20:04 cljango

20:04 * technomancy is not a fan of names that just add clj to another word

20:04 danlarkin: no way

20:04 technomancy: clango sounds loud and common-lisp-ish

20:04 danlarkin: yeah, no clj- or -jure names

20:04 IslandAce: hey.. they're pretty cool jeans...

20:04 karmazilla: Bentou

20:04 jbondeson: its been a jvm staple to just tack on j to ... everything

20:05 danlarkin: karmazilla: as in lunch? :) yummmm

20:05 karmazilla: Django sounds like dango, which is japanese stick food and bentou is like a lunch box

20:05 jbondeson: project names that make me hungry are the worst

20:06 danlarkin: karmazilla: actually django sounds like "jang go"

20:06 technomancy: mythology is a great source for names

20:06 karmazilla: but, is that a food?

20:07 IslandAce: carrillo

20:07 danlarkin: cheek?

20:07 "cheek" sounds like a bad name for software to me

20:07 haha

20:08 technomancy: oh, I've got it: "grimmshado" <= http://penny-arcade.com/comic/2009/1/19/

20:08 jbondeson: hmmm wish you could set a global math context instead of wrapping everything in a "with-precision"

20:08 danlarkin: hmmmm how does "syrinx" sound

20:08 jbondeson: sounds painful

20:08 IslandAce: danlarkin: sci-fiish

20:09 danlarkin: carrillo (besides meaning cheek in spanish) is a lunar crater

20:09 jbondeson: "just-use-the-damn-project"

20:09 danlarkin: http://en.wikipedia.org/wiki/Syrinx_(disambiguation)

20:10 IslandAce: danlarkin: kongla

20:10 danlarkin: valau

20:10 technomancy: valhalla

20:10 IslandAce: danlarkin: mavala

20:10 danlarkin: ha, my friends were in a band called valhalla in highschool

20:10 IslandAce: danlarkin: eturia

20:10 technomancy: chinchilla

20:11 ok, done being "helpful" =)

20:11 danlarkin: IslandAce: are you just doing consonant-vowel-consonant-vowel?

20:11 :)

20:12 IslandAce: we had a band called "uranium". tag line "radioactive rockers" (in swedish). we sounded absolutely aweful. but quite loud.

20:12 danlarkin: well...

20:13 danlarkin: actually, i'm a bit more interested in the code than the name... django on clojure sounds promising. what parts are you porting?

20:15 * technomancy is going to wait to see how clojure+terracotta shakes out before investing any time in ORM-type stuff

20:15 danlarkin: IslandAce: 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:16 technomancy: danlarkin: the obvious way is pretty compelling from what I've used of it so far

20:16 (what compojure implements)

20:16 IslandAce: danlarkin: nothing on the models/orm layer?

20:17 danlarkin: IslandAce: well I thought I should tackle the things I know most about first

20:17 technomancy: though compojure could use a lot more work on form helpers, particularly for nested data structures

20:17 IslandAce: danlarkin: a solid idea indeed.

20:18 technomancy: no need to reinvent the wheel though; compojure's html is a separate library that you could build on with another framework.

20:18 danlarkin: I've spent time investigating the django ORM and.... it's preeeeeeetty complicated. Not to mention inherently object-oriented :)

20:19 IslandAce: hopefully 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:19 i feel the whole bludgeon debate sort of died out..?

20:19 danlarkin: technomancy: 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:20 technomancy: danlarkin: people actually use this?

20:20 IslandAce: i'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:20 danlarkin: technomancy: 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:20 meaning one could possibly use compojure's html stuff, clj-html, whatever

20:20 raw strings

20:21 technomancy: (load-template "irc://freenode.net/#clojure/technomancy")

20:21 danlarkin: but I haven't fleshed it out yet

20:23 *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:23 maybe I should turn my music down and think about it :)

20:37 * danlarkin hears crickets

21:30 rzezeski: Has 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?

Logging service provided by n01se.net