#clojure log - Oct 26 2010

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

0:21 sproust: Clojurians! I want to build the ultra-bleeding edge swank-clojure goodness.

0:22 How do I proceed? The various leiningen commands (e.g. compile) don't appear to produce any jar goodness.

0:22 amalloy: sproust: lein jar?

0:22 or lein uberjar; i dunno how much swank-clojure needs

0:23 sproust: Ha! Never mind, fixed. Takk

0:24 So much goodness the Conj was!

0:27 bhenry: sproust: indeed!

0:30 ivey: amalloy: are you doing karma for sexpbot?

0:31 amalloy: ivey: no firm plans. if i find some time i might. if you want to do it instead, feel free

0:31 sproust: Anyone has an idea when the videos will come out?

0:31 ivey: i think it'll need mongo, and i don't have that installed. so i'd have to do that.

0:31 amalloy: ivey: i had to install mongo to test $ seen. it's not that bad on ubuntu

0:32 ivey: macosx here, but shouldn't be a problem. probably a brew recipe for it. and my server is gentoo, so that will probably be awful, like most things.

0:32 don't know why i didn't go with ubuntu.

1:07 amalloy: ivey: well, until pretty recently i was on windows. can't really take the moral high ground here

1:11 bhenry: ivey brew install mongodb

1:11 ivey: bhenry: yeah it was really that easy. my gentoo box is still chugging away though.

1:11 amalloy: i'll do karma.

1:12 bhenry: it takes a while to build.

1:12 ivey: couldn't figure out how to unmask spidermonkey

1:12 ... there's something you don't say everyday

1:14 ubii: ivey: are you a ruby convert?

1:14 ivey: ubii: yup

1:14 how can you tell?

1:14 amalloy: ubuntu has some issues with xulrunner.so - sounds like osx wins this round

1:15 ivey: amalloy: brew is just so awesome.

1:15 defn: NoSQL databases are awesome.

1:15 amalloy: ivey: i'm very pleased with apt, since this is the first package that hasn't worked out of the box

1:15 ubii: thought I recognized your nick from one of the ruby channels

1:15 ivey: ubii: ah. yeah I was on the merb core team, and i hang out in engineyard channels.

1:16 ubii: yeah, I remember, back before merb joined (merged with) the dark side :)

1:18 slowing trying to make the transition from ruby to clojure

1:19 amalloy: ubii: wimp. more fun if you do it quickly :)

1:19 (not that i intend to go terribly fast when i try ruby)

1:20 ubii: well, ruby pays the bills right now, so that unfortunately is where my focus is :(

1:20 ivey: you a contractor ubii, or FT somewhere

1:20 ?

1:20 clojurebot: #<ClassCastException java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;>

1:21 ubii: freelance consultant

1:21 defn: ubii: did we meet at conj?

1:21 rdeshpande: ubii: funny, i'm in the exact same situation

1:21 ubii: ruby paying the bills but learning clojure when im not on the clock

1:22 ubii: defn: unfortunately, I was not able to make it to conj

1:22 defn: bummer

1:22 tomoj: can't believe I missed it :(

1:22 ubii: looking forward to watch the videos when the come out

1:22 s/watch/watching

1:23 ivey: you still doing the consulting thing?

1:24 ivey: ubii: i decided eating regularly wasn't so important, so I started a company

1:24 finally freeing up some time to work on some open source stuff though

1:24 ubii: sorry, that is what I meant, I remember hearing about you starting one with a buddy or something

1:25 ivey: yeah, that's why i left merb core

1:25 ubii: rdeshpande: what type of ruby development do you do?

1:26 rdeshpande: ubii: almost entirely rails

1:26 ivey: just curious - was there a lot of tension around the decision to merge with rails?

1:26 ubii: rdeshpande: hmm, haven't touched rails in years

1:26 rdeshpande: ivey: or was it mostly unanimous?

1:27 ivey: some. there's still a merb-core that is being maintained

1:27 but all the major players were on board

1:27 rdeshpande: ubii: what type of work are you doing?

1:29 ubii: rdeshpande: I primarily used IOWA as a web framework

1:29 I think I represent 50% of the IOWA community, behind wyhaines :)

1:30 rdeshpande: cool

1:30 ubii: IOWA predates rails and is a component-based web framework, unlike rails, which is MVC-based

1:31 rdeshpande: right

1:31 i'd heard about it but never looked into it

1:32 jackdempsey: funny how things go. just shot myself in the foot with ruby and mutable state

1:32 clojure's lookin nicer as the days go by

1:33 ubii: most of the work that I do is building database-driven websites for financial clients, such as mutual fund firms

1:33 not the most exiting, but it pays the bills

1:33 * jackdempsey throws in the "ruby contractor learning clojure" to the mix

1:33 rdeshpande: ubii: you're not in NYC, are you?

1:34 ubii: nope, live in the midwest

1:34 amalloy: jackdempsey: i think java/hadoop is shooting me in the foot with mutable data right now, but java is too foggy to see through so i'm not sure

1:34 rdeshpande: ah ok

1:34 i wonder why clojure is attracting so many ruby people

1:34 jackdempsey: amalloy: hehe sucks

1:35 defn: because ruby people aren't "comfortable" people, they've seen glimpses of lisp, they like to learn things

1:35 the list goes on

1:35 jackdempsey: rdeshpande: i think we're interested with new languages, but maybe are yearning for something a little more structured while maintaining elegance?

1:35 ubii: I am very interested in digging more into clojure and the available associated web frameworks

1:35 rdeshpande: compojure is really nice so far

1:35 defn: there's not a single reason why anyone changes languages

1:35 rdeshpande: whoever worked on labrepl did an excellent job too

1:35 ivey: rdeshpande: ruby is half-way to functional, and is a decent lisp without parens.

1:35 rdeshpande: true.

1:35 ivey: and a lot of people got to ruby vi smalltalk, directly or indirectly.

1:36 defn: ruby is definitely not a lisp

1:36 ubii: ruby has never appealed to me like lisp and now clojure does

1:37 ivey: defn: http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp

1:37 rdeshpande: im attracted by the greater probability for correctness

1:38 jackdempsey: rich also seems sharp as hell, and i like looking into what smart people are doing

1:38 albino: doesn't a language need hygienic macros to be considered a lisp?

1:39 defn: ivey: is ruby homoiconic?

1:40 ivey: defn: no, which is the biggest reason it's not truly a Lisp. you can get a decent AST though

1:40 defn: ivey: i wont belabor the point -- but there are more reasons than that listed in the comments on the link you just posted

1:40 ivey: the point is, a lot of what makes lisp exciting works in ruby. it's a gateway drug.

1:40 defn: ivey: sure, i just wouldn't make the jump to calling it a lisp

1:41 ubii: well, it isn't doing much for me lately, which is why I am jonesing for clojure :)

1:43 amalloy: for me (a java expat) clojure has all the lispy features i loved discovering in CL but isn't such a pain to work with

1:48 ivey: another reason: lots of ruby devs are rediscovering traditional editors, and at least half are going emacs. so they're learning elisp. another gateway drug.

1:49 rdeshpande: ivey: ive actually used vim for the last 10 years but im giving emacs a try

1:50 slime was much easier to get running than vimclojure, and i figure if the configs are in lisp then what the hell

1:51 jackdempsey: rdeshpande: good luck to you. i don't think i could go back to emacs

1:51 but yea vimclojure is kinda eh

1:51 rdeshpande: jackdempsey: you went from emacs -> vim?

1:51 jackdempsey: pico -> emacs -> textmate -> vim

1:52 ubii: ivey: just curious, is there a clojure web framework similar Sinatra, which is well suited for building light-weight web APIs

1:52 LKkk: #java is invite only :(

1:52 rdeshpande: ubii: compojure

1:52 ubii: wait, going from emacs to vim, isn't that a step backwards? :)

1:53 jackdempsey: hehe

1:53 trust me, i thought i'd never make that choice. but, it surprisingly fit me

1:53 defn: ubii: moustache

1:53 ubii: http://github.com/cgrand/moustache

1:54 rdeshpande: ahh, moustache looks even more fitting

1:54 ubii: thx, I will check it out

1:54 defn: np

1:54 amalloy: clojurebot: moustache?

1:54 clojurebot: No entiendo

1:54 amalloy: clojurebot: moustache is http://github.com/cgrand/moustache

1:54 clojurebot: Alles klar

1:56 ubii: I just wrote a small Sinatra app for one of my clients to do email campaign monitoring (tracking) and thought about trying to rewrite it using clojure

1:56 defn: ubii: give it a whack with enlive/hiccup and moustache

1:57 ubii: enlive and hiccup are html templating libraries, correct?

1:59 defn: yeah

2:00 ivey_off: gentoo on a 256M slice is a terrible idea

2:01 ubii: had one for awhile, then for some reason went with Arch

2:02 bytesource: Hi all! I am currently reading the chapter on HBase of 'Clojure in Action'. I downloaded HBase but have no idea of how to install it on Linux. I couldn't find a simple manual either on the web. Does anybody know how to do the install? I am using Leiningen and Emacs.

2:02 zkim: hey guys, working on a REPL in 30 seconds intro for the clojuredocs home page, would appreciate some feedback: http://github.com/zkim/clojuredocs/issues#issue/24

2:06 amalloy: zkim: a step on installing gem?

2:07 otherwise i have to say it's well-written and i like the tone

2:08 zkim: amalloy: you think it's fair to assume that at this stage in the game people would either have rubygems installed, or be able to figure it out on their own?

2:08 amalloy: i didn't :P

2:08 zkim: hehe

2:08 amalloy: but then, i started with lein

2:09 zkim: hrm

2:09 I'm just thinking about how far back to go

2:09 ivey: defn: karma is channel-specific?

2:09 zkim: so no gem, what about ruby?

2:09 ivey: or bot specific?

2:10 ubii: well, if they have don't have it installed and don't know how, then I think that it is safe to assume that they will exceed the 30 seconds :)

2:10 zkim: ubii: hah

2:11 ubii: sorry, was just being a smarta$$

2:13 zkim: amalloy: what about the script install method of cake? side step the whole gem problem.

2:13 amalloy: i dunno, i haven't tried that method

2:15 zkim: amalloy: cool, well thanks for the feedback, as far as the tone I was going for a ruby / fantom homepage kind of feel

2:27 replaca: zkim: hmmm, but if somebody is super new they may not know "REPL"

2:31 zkim: replaca: agreed, when I was throwing it together I had a minimum level of developer in mind and a length target, I'd hate to make it too much longer, but maybe some text to the effect of 'this assumes some level of knowledge, etc'

2:32 I'd like to get the user running exprs as quickly as possible, and then maybe include a bit more background info in the 5 min

2:33 replaca: if it were you starting over in clojure again, would it throw you off to go through those steps to get to a page that would explain more?

2:44 replaca: zkim: oh, I was just think of adding (command prompt) or some such

2:44 otherwise it looks great

2:45 zkim: ah

2:48 replaca: yeah good point, how bout linking REPL to the wikipedia article or some clojure page describing the REPL?

2:56 replaca: zkim: hmmm, i'm just thinking of text on the button so they know when they want to press it

2:57 I think it's fine for a beginner to just think of the repl as a "command prompt" and not know what the initials stand for

2:59 zkim: like if I saw a button that said "GLRX in 30 seconds" the only reason I'd press it is curiosity

2:59 zkim: replaca: I see, that makes sense

2:59 replaca: How about: New to Clojure? Get started in 30 seconds.

3:00 replaca: now you're cookin'!

3:00 zkim: Run code in 30 seconds.

3:00 hmmm

3:00 replaca: yeah, something like one of those "Get running in 30 seconds" ...

3:00 something along those lines

3:00 zkim: replaca: cool, specific copy's still in flux but the idea's in there

3:01 replaca: thanks

3:01 replaca: zkim: np

3:13 finally closing the 40 open emacs buffer relating to my conj preso - time to move on!

3:15 angerman: how do i turn a hash-map into a sorted map?

3:18 replaca: angerman: (into (sorted-map) {:b 1 :c 2})

3:28 zkim: replaca: hope it came out well on the video, first I had heard of fill-queue and I'm sure I missed some other gems

3:29 replaca: zkim: we'll see. It was difficult to hear how well I was getting the microphone. Could you hear me OK way in the back?

3:30 zkim: replaca: yeah, no problems from where I was sitting

3:30 replaca: zkim: cool, glad to hear it :) (pun intended!)

3:30 zkim: replaca: heh

4:00 TobiasRaeder: morning everybody

4:00 AWizzArd: Hoi Tobi

4:48 angerman: Hmm... why does amap not hand me the element fro the array?

5:11 how do i typehint aset?

5:11 the one in amap?

5:11 Chousuke: you can use ^objects

5:12 or ^ints or whatever.

5:12 angerman: I'm tying ^ints

5:12 but I keep getting the reflection warning.

5:13 Chousuke: hm :/

5:13 are you also using (int ...) with the index and element?

5:17 angerman: http://gist.github.com/646584

5:17 that's what I'm tying to do.

5:17 and It tells me that the call to aset cannot be resolved.

5:23 that macro is a copy from the clojure source

5:24 I just made using an expression being feed the value from the array

5:24 the one in the clojure source just evaluates the expression but doesn't feed it the value from the source array

5:26 I now went around the macro.

5:26 it's kind of weird though that I cannot get that aset reflection out :/

6:14 _na_ka_na_: /msg NickServ identify qazzaq

6:25 Sweetshark: _na_ka_na_: you better change you password asap

6:26 _na_ka_na_: sad .. i thot my msg wouldn't have been sent coz I'm not identified.. perils of changing irc clients

7:42 fliebel: morning

7:43 micrypt: Hi, I'm getting a rather odd error... is there a syntax for marking a function as "public" in a separate file?

7:43 fliebel: Still playing with zippers over here. How do I get to the start of a zipper? Just (root (seq-zip))? Or call up in a loop?

7:45 micrypt: I don't think functions are private, unless you make them so. So they can't get any more public. Or if you're trying to use another file's provate functions: don't, but if you must #'symbol will do the trick I think.

7:52 micrypt: fliebel: Thanks. I seem to be having issues using a function declared in a separate file inside a new function. "java.lang.Exception: Unable to resolve symbol: **** in this context ". I sadly don't know enough Clojure to figure out what's wrong. :P

7:53 fliebel: micrypt: I don't understand what you're doing. You're doing (defn a [] (defn b []))?

7:54 Solution to my problem btw: (last (take-while identity (iterate z/up *1)))

7:57 micrypt: fliebel: I have a (defn a[] .... ) in a separate file in a separate namespace. Then after ":use"-ing the namespace in another file, I attempted (defn b[] (a ...)).

7:57 fliebel: ...and it blew up.

7:59 fliebel: micrypt: Simplify the problem until only one thing is left to go wrong. Get on the repl and try requiring it there.

8:00 micrypt: fliebel: It works in the repl. That's where I got properly puzzled.

8:02 fliebel: micrypt: Ok, so it has nothing to do with the defined function, but with the code using it. Are you by any chance having a circular dependency? These bite hard :(

8:04 e.g. a requires b and b requires a, by the time b is running, a is only in it's first line so it hasn't run its code yet.

8:04 *its

8:04 micrypt: fliebel: I do have both (ns nsa (:use nsb)) and then (ns nsb (:use nsa)) in each file.

8:04 fliebel: Okay, sounds like that might be it.

8:05 fliebel: micrypt: Right, that doesn't work. Make an nsc that is required by both instead ;)

8:05 micrypt: fliebel: Thanks a lot. :)

8:09 l_a_m: hi

8:10 someone use clojure on GAE ?

8:13 mrBliss: is there something like (Class/forName ..) that works with "java.lang.Integer" AND "java.lang.integer" (Note the lower case i in integer)?

8:13 bobo_: l_a_m: ive done some small things

8:20 l_a_m: bobo_: great

8:20 bobo_: i've got a method to initialize database

8:21 bobo_: how can i do to call this method on website startup ? when i deploy a new version

8:21 bobo_: only once

8:21 mrBliss: l_a_m: defonce?

8:22 l_a_m: mrBliss: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/defonce

8:23 ?

8:23 mrBliss: like that : (defonce server (run-jetty (var handler) {:port 8080}))

8:23 mrBliss: yeah

8:23 I don't know how you're gonna initialize your db

8:25 bobo_: l_a_m: did you look at the libraries for gae? there are some helper stuff there i belive

8:25 l_a_m: mrBliss: (init-db)

8:25 bobo_: and yes, defonce sounds like a good way to do it

8:25 mrBliss: l_a_m: does it return anything?

8:25 l_a_m: mrBliss: no

8:27 mrBliss: random idea: (defonce db-ready? (do (init-db) true))

8:33 fliebel: I know this one -> is the treading macro/trush, but what is the one called that stops as soon as it hits false or nil? -?> it was I believe?

8:34 mrBliss: fliebel: correct: clojure.contrib.core/-?>

8:34 fliebel: mrBliss: Thanks :)

8:38 l_a_m: mrBliss: thanks

8:38 mrBliss: works fine

8:39 mrBliss: np

8:44 fliebel: Why isn't there prepend-child in clojure.zip?

9:14 alexyk: g'morning clojurers!

9:16 I have a function which takes optional arguments; it's called from a customer-facing one, and the latter one has to get those arguments just for the callee. How do I just grab all of "my" enclosing arguments and give it to callee? http://paste.pocoo.org/show/281658/ -- I have now just repeat them all by name

9:21 mrBliss: alexyk: maybe something like (defn tokyo-read-reps [db-pathname & [proto str-load?] :as db-args] (let..


9:21 alexyk: mrBliss: nice

9:21 mrBliss: awesome, it both ensures I get the right amount of arguments and gives me a shortcut to pass along

9:23 * alexyk observes clojurers are mostly asleep still

9:26 alexyk: dysinger: why are you loading stuff into couchdb when mongo is 1000x faster and distributed too?

9:37 raek: ,(fn [db-pathname & [proto str-load?] :as db-args] nil)

9:37 ->(fn [db-pathname & [proto str-load?] :as db-args] nil)

9:37 sexpbot: java.lang.Exception: Unsupported binding form: :as

9:38 chouser: [proto str-load? :as db-args]

9:38 raek: you cannot use :as at the "top level" of a parameter list

9:38 also, if you have a & args parameter, the function takes any number of extra arguments

9:39 ->((fn [a & [b c :as d]] {:a a, :b b, :c c, :d d}) 0 1 2 3 4)

9:39 sexpbot: ⟹ {:d (1 2 3 4), :c 2, :b 1, :a 0}

9:39 alexyk: :(

9:40 raek: the idea is to call tokyo-open with as little copying of top-level args as possible

9:41 chouser: so you mean (tokyo-open db-pathname db-args) right?

9:41 raek: alexyk: it is common to do something like this: (defn foo ([x] (foo x 1)) ([x y] (foo x y 2)) ([x y z] ...))

9:42 that way, the function only has the arities you specify

9:42 alexyk: raek: ok

9:44 raek: in some situation, you could do someting like (defn bar [& args] ... (apply foo args) ...)

9:44 alexyk: raek: yeah, was thinking of that, but need at least the first argument

9:44 raek: if you just want to pass all the arguments as-is to the other fn

9:47 _fogus_: To help with the new Clojure wiki... http://code.google.com/p/confluence-el/ Confluence mode for Emacs.

9:50 TobiasRaeder: can anyone explain me the use of identity? i dont seem to understand why id use it

9:51 hugod: vic!@123!

9:52 mefesto: TobiasRaeder: i believe one use is in higher order functions that allow the user to supply a function that will somehow change the data. identity is useful when you don't need to change it

9:52 ivey: _fogus_: do you know if that's in elpa?

9:52 TobiasRaeder: @mefest ah, makes sense. thank you

9:53 _fogus_: ivey: I do not use ELPA, so I do not know. Sorry

9:55 jweiss: some at the conj (i think it was stuart halloway) asked for people who know JIRA - i was a jira admin and would like to help - but not sure who to email

9:55 s/some/someone

9:59 fliebel: How do I figure out if a string contains a number? Can be floating point as well, so Integer. in a try isn't going to work.

10:00 s450r1: jweiss: I think it was Stuart Halloway, too. I bet you can email him.

10:00 jweiss: s450r1: i don't know where to find his email address. checked the thinkrelevance website but couldn't find there

10:01 baoist: fliebel: wouldn't regex work?

10:02 jweiss: s450r1: i think i found it - google confirms my guess :)

10:03 raek: fliebel: can it be all possible clojure numeric types, or just doubles?

10:03 s450r1: jweiss: great... I just found one in a github README :-)

10:03 fliebel: raek: anything that is commonly considerd a number, so probably no need to find ratios ;)

10:04 raek: I guess you could decide to use one specific type (for example BigDecimal), or use the clojure reader

10:06 fliebel: raek: So something like (number? (read-string "123.4"))

10:59 duncanm: is there a list of clojure base protocols?

11:02 which protocol should i extend if I want it to be Comparable?

11:04 cberg: Hi! Can anybody tell me how to open a resource from the classpath using clojure-contrib.io/reader?

11:07 duncanm: cberg: you might want to use clojure.java.io instead, i think that's the new name of the library

11:11 cberg: duncanm: Thanks. I guess I need to take a closer look at the changes introduced with 1.2...

11:12 I see they no longer mention reading resources from the classpath in the docstring.

11:22 cemerick: duncanm: Comparable is a java interface, not a protocol.

11:23 jondistad: goodmike_mh and I have been tasked with spiking out a process for unified clojure contrib builds (basically this page: http://dev.clojure.org/display/design/Common+Contrib+Build) and are interested in feedback and/or any ideas you all might have already had

11:26 the process after initial setup seems like it can be pretty straightforward: github post-commit hook (or hudson polling) to run builds, publishing snapshot or full releases accordingly if they pass (repo location tbd)

11:26 kotarak: jondistad: why different build tools? Isn't maven enough?

11:27 jondistad: kotrak: i'm not in a position to make that decision ;) but i think the answer is going to be no

11:27 goodmike_mh: FYI, there's also background info on the Google Group: Stu Halloway's initial post and some responses: http://groups.google.com/group/clojure-dev/browse_thread/thread/8d11cdd6d27ceb13

11:28 jondistad: kotarak: granted, most things can run on maven's back, which simplifies things a bit

11:28 cemerick: jondistad: I was planning on posting a msg to the dev list with my thoughts later today

11:28 goodmike_mh: Stu proposed using "pom.xml as the data of record"

11:29 cemerick: Perhaps you guys have it well in hand though :-)

11:29 kotarak: "data of record"?

11:29 cemerick: goodmike_mh: all that really means is that you can use the pom for deployment purposes.

11:29 goodmike_mh: Right.

11:30 Multiple tools "are capable of producing/consuming this as necessary."

11:30 kotarak: Hmm, I would expect to use one build tool (whatever it may be) across all contrib should simplify things.

11:30 goodmike_mh: In particular, we want to reach out to library authors.

11:30 jondistad: kotarak: it'll almost definitely be maven on the back end

11:31 meaning in hudson

11:31 and requiring a pom.xml reinforces that

11:31 kotarak: jondistad: then why something else at the "front end"?

11:31 goodmike_mh: It looks like chouser and fogus are here: your libraries, and cemerick's, were mentioned in our call with Stu.

11:32 cemerick: kotarak: presumably, we won't be able to pry lein out of some people's hands, etc.

11:32 kotarak: cemerick: pff... Then I want gradle, Lau wants cake, ....

11:32 goodmike_mh: can't we all just get along?

11:32 cemerick: oy

11:32 goodmike_mh: :-)

11:33 jondistad: kotarak: personally, i'll likely use leiningen and have it generate a pom for official builds

11:33 kotarak: goodmike_mh: sure. Just asking silly questions, which was jondistads intent, I believe. ;)

11:33 cemerick: goodmike_mh, jondistad: you guys are with relevance?

11:33 goodmike_mh: yes

11:33 jondistad: kotarak: but i don't mind making the extra effort to peronalize my experience when i work locally

11:34 cemerick: jondistad: The result of `lein pom` is not sufficient to drive a build

11:34 jondistad: yeah, i'll have to edit it

11:34 kotarak: jondistad: re clojars: at the moment things are at build.clojure.org/snapshots etc. Why change that? Or something more "official" like maven central?

11:34 vibrant: sooo...

11:35 normally i would do a class Unit, and then inherit Tank from it, and inherit Humvee from it - and what do I do in Clojure?

11:35 jondistad: kotarak: it probably won't change, unless we discover a reason it needs to

11:36 kotarak: this is all brainstorming at the moment

11:36 nickik: how can i make lein use /src/<WhatEverIWant>/<src files>/ instead of /src/<project name>/<src files>?

11:39 raek: nickik: the namespace foo.bar corresponds to src/foo/bar.clj . you can choose whatever namespace names you like. the one leiningen creates is just to get beginners started.

11:41 vibrant: in clojure, you tend to do as much as possible without types

11:41 vibrant: raek; yeah reading multimethods documentation now

11:41 raek: a good start would simply be to put everyting in maps

11:41 nickik: raek: thx, kind of obvious if I would start thinking

11:44 vibrant: raek; so the elite way to do it is with defrecord?

11:44 kotarak: vibrant: yes

11:44 vibrant: can you suggest the best book about programming clojure?

11:44 raek: records could be seen as typed maps

11:44 kotarak: vibrant: then you might want to investigate protocols and multimethods

11:45 raek: they are primarily used when you need dynamic dispatch on type

11:45 vibrant: raek; so that's my case i guess, and i guess ican just accomplish the same thing by dispatching on a :type key in maps right?

11:45 raek: yes

11:46 kotarak: vibrant: see function "type"

11:46 duncanm: cemerick: so is there an equivalent? if i want my defrecord to be conj-able into a (sorted-map), how should i extend that record type?

11:47 cemerick: duncanm: implement Comparable in your defrecord

11:47 duncanm: cemerick: don't i do that with extend-type?

11:47 kotarak: cemerick: btw, is there a possibility to start a durable repl session in nREPL?

11:47 chouser: or provide a comparator to your sorted-map-by that makes sense for your records

11:48 cemerick: duncanm: you do it in your original defrecord declaration, not via extend-type; check out the docs :-)

11:48 kotarak: define "durable"?

11:48 kotarak: cemerick: between connections.

11:48 cemerick: kotarak: so that current ns, *1, *2, *e, etc are persisted across JVM runs?

11:49 duncanm: cemerick: ah, right

11:49 dpritchett: having a fun time trying to connect to swank on my new prgrmr.com slice

11:49 kotarak: cemerick: not JVM runs, but connections to the system.

11:49 cemerick: oh, I see.

11:49 dpritchett: anyone here a customer?

11:49 kotarak: cemerick: I send a command, get things back, close connection, reconnect, send a command, ...

11:49 cemerick: kotarak: not possible now; perhaps a reasonable enhancement though

11:50 kotarak: are you using nrepl already?

11:50 kotarak: cemerick: well, a necessary one I would think. How do you want to provide a continuous repl session otherwise?

11:50 cemerick: I working on it.

11:50 cemerick: there are some obstacles. Mainly missing client on Windows.

11:50 cemerick: kotarak: most other clients don't disconnect frequently. :-)

11:51 missing client?

11:51 kotarak: cemerick: ?? How can they be continous connection eg. via a mq?

11:51 cemerick: program I invoke to send stuff to the network socket.

11:51 cemerick: ah, well, nrepl isn't using a broker at the moment

11:51 kotarak: read: netcat

11:52 cemerick: yes. I know. But wasn't that a long-term goal to make at least available?

11:53 cemerick: Definitely. I just wasn't planning on talking about persistent connections, as you put it, until that was seriously in the works.

11:53 That said, let me look at it, and I'll see what can be done in socket-land.

11:53 kotarak: Ah. Ok. Well. I'll need it before. ;P

11:53 cemerick: Indeed. As will textmate, and similar.

11:54 * dpritchett looks forward to vimclojure and nrepl getting together

11:55 kotarak: cemerick: It should not be thaaat difficult. That's what I do now: http://bitbucket.org/kotarak/vimclojure/src/tip/server/src/main/clojure/vimclojure/repl.clj

11:56 cemerick: No, certainly not difficult. I'm not going to make it the default across the board, though.

11:56 kotarak: cemerick: No. I'd thought about some command to specifically request such a session and then also one to stop it again.

11:57 cemerick: kotarak: can you retain an opaque connection ID between evaluations/connections?

11:57 kotarak: cemerick: yes, see the repl-id stuff in the above link. The id is passed as a parameter to the nail. Could be part of the protocol (optional of course).

11:58 "repl" "the-generated-id-whatever-it-may-look-like"

11:58 cemerick: Sure. Yes, I'll add that sometime this week.

11:59 kotarak: cemerick: cool :)

11:59 cemerick: also, an :ns arg on requests, to specify which namespace to eval the associated code in

12:00 kotarak: cemerick: yes. that saves thousands of explicit in-ns's...

12:01 * kotarak doesn't want to adulate himself, but he put some thought in this style of repl server.

12:02 * kotarak thinks, it should have been "... doesn't want to blow in his own horn..."

12:05 alpheus`: Are there any tools that can help me track down the cause of a java.lang.OutOfMemoryError?

12:07 chouser: alpheus`: jvisuamvm should do nicely

12:08 dnolen: https://visualvm.dev.java.net/

12:09 alpheus`: thanks, and chouser, I'm bummed I couldn't figure out how to sign my digital copy of joy of clojure

12:10 drewr: does visualvm do anything more than jconsole?

12:13 dnolen: drewr: never used jconsole, but visualvm has a nice ui and is really easy to understand.

12:13 Raynes: drewr: I don't think you can profile in jconsole.

12:13 You can in visualvm.

12:14 $learn jvisualvm https://visualvm.dev.java.net/

12:14 sexpbot: My memory is more powerful than M-x butterfly. I wont forget it.

12:27 alpheus`: Does visualvm take a long time calibrating? All I get is a blank grey window.

12:29 abrenk: alpheus`: Are you on linux with e.g. awesome as window manager? Then see https://bbs.archlinux.org/viewtopic.php?pid=497161

12:30 alpheus`: linux/xmonad, yes

12:30 abrenk: alpheus`: then you need to run "AWT_TOOLKIT=MToolkit jvisualvm"

12:32 alpheus`: perfect, thanks

12:53 dpritchett: woo! properly tunneled into `lein swank` on my xen slice!

13:00 ivey: defn: ping

13:01 dpritchett: looks like my 60-second function is still executing 10 minutes later. maybe there's something i don't know about tunneling into swank

13:11 Sweetshark: Hi all, is there a way to run multiple clojure RTs in one jvm? or to have completely different scopes?

13:12 cemerick: Sweetshark: no, reified environments aren't possible

13:12 the question is, why do you need them?

13:13 Sweetshark: cemerick: is it possible to completely reset the clojure jvm?

13:13 defn: ivey: PONG

13:13 Sweetshark: s/jvm/RT/

13:13 sexpbot: <Sweetshark> cemerick: is it possible to completely reset the clojure RT?

13:14 cemerick: Sweetshark: You can ns-unmap everything in all namespaces

13:14 ivey: defn: thoughts on sexpbot karma...per-channel, or per-server? I went per-channel, but wanted another opinion.

13:14 defn: absolutely per channel

13:14 cemerick: but that doesn't impact e.g. stuff that's running on various threads

13:14 Sweetshark: why do you want to reset the runtime?

13:14 ivey: k. in that case, Raynes has a pull request ready to go

13:14 defn: ivey: nice! well done, sir.

13:14 Sweetshark: cemerick: I would like to use clojure as a scripting envirnmoent in OpenOffice.org, and I think it would be desirable there to have different scripts independant from each other ...

13:14 Raynes: ivey: It needs to be per-server as well.

13:14 chouser: really, the clojure runtime is the JVM runtime. can you completely reset the JVM?

13:15 defn: ivey: if you want another fun one you could build a little markov :)

13:15 ivey: defn: http://github.com/Raynes/sexpbot/pull/20 in case you're interested

13:15 defn: Raynes: why's that?

13:15 ivey: Raynes: it is.

13:15 Raynes: defn: So that george on freenode and george on ninthbit don't have the same amount of karma.

13:15 ivey: it's nick, server, channel

13:15 as the key

13:15 defn: *nod*

13:15 Raynes: In that case, excellent work. I'll pull it in in a little while.

13:16 defn: ivey: i like the deref reader macro to get karma

13:16 Raynes: defn: That's the prefix, actually.

13:17 It'll be $karma in the running bot.

13:17 sexpbot's default prefix is @, so that's what he used in his testing.

13:18 defn: Raynes: ah i see

13:18 cemerick: Sweetshark: I guess I don't see the use case; assuming scripts are actually code that are going to be eval'ed, script A running while script B is running isn't bad in and of itself.

13:19 Raynes: I'm going to add regular $inc and $dec commands to complement the fancy (inc ..) and (dec ..) hooks he made, so that it'll be more accessible to non-clojurian end-users as well.

13:19 defn: Raynes: i didn't see you out at Stuart's -- thought you were coming to the BBQ

13:19 cemerick: Sweetshark: I'd suggest using Clojure in the simplest way possible, and if you run into a problem, then introduce whatever is necessary to resolve it.

13:19 ivey: Raynes: good idea

13:20 dpritchett: is swank-clojure particularly bandwidth-heavy?

13:20 Raynes: defn: I was already getting sick. The less interactions I had with other people at that point the better. I didn't want to infect everybody. Besides that, I figured it would be a good opportunity to go out and eat and check out brier creek.

13:21 defn: chouser: http://github.com/jarpiain/cljc

13:21 Sweetshark: cemerick: I was thinking along the lines of two scripts from totally different sources defn'ing the same symbol .. Maybe I should just create anonymous namespaces around the scripts by default ...

13:26 kotarak: Any pointers to 1.3 optimisation hints?

13:26 chouser: defn: huh.

13:26 cemerick: Sweetshark: That seems entirely reasonable, and there's a static .remove method in Namespace so that you can drop your temporary ns upon the script's exit.

13:26 Of course, that script can just as easily have an in-ns form, and cause havoc.

13:27 I'd check out the sandboxes in the irc bots for tips in this area.

13:27 ,(in-ns 'blahlbah)

13:27 ->(in-ns 'blahblah)

13:27 sexpbot: java.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/in-ns)

13:27 cemerick: Sweetshark: ^^

13:27 clojurebot: ping?

13:27 ohpauleez: kotarak: I think if you just look at the wiki certain things are obvious, but I don't know about deep internals

13:28 use primitives and primitive support, protocols where appropriate, don't be dynamic is you don't have to be

13:28 Sweetshark: cemerick: Another thing that might be problematic: Running a script, finishing that and the def's are still hanging around in the RT. Even if that causes no naming conflicts, having keeping all that around in the runtime might be a memory leak (while documents are very shortlived, the jvm will usually hang around a long time (as with quickstarters it survives long and with suspend common on desktops even longer)

13:28 cemerick: sandboxing sounds interesting ...

13:28 cemerick: Sweetshark: right, see Namespace.remove (doesn't look like there's a clojure fn that correspond to it, but no matter)

13:29 kotarak: ohpauleez: you mean this? http://dev.clojure.org/display/doc/Enhanced+Primitive+Support

13:29 Chousuke: ns-unmap?

13:29 cemerick: Chousuke: he wants to have untrusted scripts running in a temp ns.

13:29 The nuclear option seems warranted.

13:30 Chousuke: hm, right.

13:30 ohpauleez: kotarak: http://dev.clojure.org/display/design/Home

13:30 some of these have made it in, others are being designed

13:30 defn: zkim: you around?

13:31 chouser: like "huh." or "huh?"

13:31 dpritchett: any idea why this would use 100% cpu on my laptop but only 4% cpu on a xen slice? it finishes in 60 secs locally and is still running remotely. (ns euler-clj.core │Tasks: 102 total, 1 running, 101 sleeping, 0 stopped, 0 zombie (:require clojure.contrib.def))

13:31 whoops wrong paste

13:31 zkim: defn: yeah, what's up?

13:31 dpritchett: i meant this function: http://github.com/dpritchett/euler-clj/blob/master/src/euler_clj/core.clj#L360

13:31 ohpauleez: kotarak: also the link you posted is good

13:31 defn: zkim: im getting some complaining from clojuredocs on rake db:migrate

13:32 dpritchett: maybe it's a RAM thing? My local dev vm has double the memory of my slice

13:32 zkim: defn: pm me, we'll get it figured out

13:32 defn: kk

13:32 * Sweetshark knows that enabling to run untrusted clojure scripts sounds evil and perverted. But it is still a lot better than letting people use VBA or StarBasic, right?

13:32 * cemerick almost fell over skimming cljc

13:33 duncanm: when i filter a map, i don't get back a map, do i? i get back a seq!

13:33 ohpauleez: kotarak: Except the :static doesn't exist anymore

13:33 kotarak: ohpauleez: I was just about to write that. :)

13:33 Chousuke: hm.

13:33 does clojure.org link to dev.clojure.org? :/

13:33 nickik: duncanm: a map implements seq but yes its true you get vectors of key value

13:35 duncanm: and select-keys / dissoc are opposites, right? like filter and remove

13:36 hiredman: nickik: maps don't implement seq

13:36 you can get a seq over a map

13:37 nickik: not? but sequencable?

13:37 cemerick: Sweetshark: godspeed, man :-D

13:37 * Sweetshark should really polish and publish the 25-line "create a Hello World! document in OpenOffice.org Writer" clojure file that would take ~200 lines of Java code ...

13:38 cemerick: Presumably, you shouldn't need more than the sandboxes defined in either of the bots. I can't imagine they're not properly reusable.

13:38 hiredman: nickik: you can call seq on a map

13:38 Raynes: ivey: Do you intend to add those commands? I can do it myself if you don't want to. Just wondering before I pull.

13:39 ivey: Raynes: I can but not until tonight

13:39 up to you

13:39 Raynes: No hurry.

13:39 I wouldn't get it done any faster.

13:41 duncanm: is there a reason why Maps need to have select-keys/dissoc, and not polymorphicly use filter/remove?

13:42 chouser: the contract of filter/remove is that they return lazy seqs

13:42 dpritchett: has anyone successfully run clojure in a 256mb ubuntu instance?

13:42 i'm completely at a loss for where to start looking for RAM improvements

13:42 maybe i shouldn't have gone for a 64-bit install

13:43 hiredman: on osx I've never got the jvm to use less then 60mb

13:43 Raynes: dpritchett: I've tinkered with memory optimizations in sexpbot: http://github.com/Raynes/sexpbot/blob/master/sexpbot-opt contains some useful options that you can research. It really just depends on what you're trying to run.

13:43 dnolen: dpritchett: I had some basic compojure stuff running on a 256mb slice and I didn't have too many problems.

13:44 dpritchett: in my case it was a memoized collatz function from project euler

13:44 could store up to 1,000,000 values, but small ones

13:44 dnolen: dpritchett: oh you're running euler stuff on a 256mb slice, to what purpose ? :)

13:45 dpritchett: dnolen: i guess there's no real reason to run it on my slice... i have two windows laptops that run ubuntu VMs for my clojure work. i thought an always-on slice would help make development more comfortable for me

13:45 looks like the combination of 64-bit ubuntu and 256 mb of ram was a bad idea

13:45 my dev VMs are 32-bit ubuntu with 512mb ram

13:46 i had hoped to build an app on aleph eventually, i just wanted to kick the tires first

13:46 i guess euler #14 kicks too hard

13:47 dnolen: dpritchett: yeah slices are fine for running aleph/web apps, bu probably too underpowered for the kind of GC some of the elegant Euler solutions require.

13:48 dpritchett: i am doing a loop-recur accumulator that checks against my memoized "what's the solution at f(x)" test function

13:48 ah well

13:48 i'm gonna reinstall 32bit ubuntu and then quit trying euler on this thing

13:49 project euler is the only thing i've written more than 10 lines of clojure for so it was my go-to test

13:51 thanks dnolen, i plan to visit your posterous blog when i get more into aleph

13:52 goodmike_mh: dpritchett: Good luck with Project Euler!

13:52 dnolen: dpritchett: if you do, don't look at the code to closely, all my aleph code is now completely out of date :) it's only good as conceptual reference.

13:52 dpritchett: aleph's wiki docs are now quite good.

13:53 dpritchett: dnolen: i'm starting out by porting a simple socket.io service i wrote in coffeescript/node.js. it can't be *too* hard since i saw a websocket demo on the aleph README

13:53 dnolen: dpritchett: yeah in fact I think it's ridiculously simple. the whole channels seq thing is too cool.

14:03 Raynes: amalloy: I commented on that pull request with a suggestion.

14:03 amalloy: yeah, just saw it

14:04 Raynes: amalloy: If it does work, you can go ahead and nuke the commented out version.

14:04 amalloy: Raynes: not sure that for really applies there, since it will return a seq. you could do (last (for [f fns :while blah])) but that seems yucky

14:05 Raynes: amalloy: What about some?

14:06 some should work, and would avoid unnecessary computation.

14:06 dpritchett: so if i run a repl and then i start netty(aleph) from within the repl i'm now using two JVMs and lots of ram, right?

14:06 i see two java processes at any rate

14:06 amalloy: Raynes: some will return the first matching thing, and you want the last one, right?

14:11 Raynes: amalloy: If I stop talking, it probably means the power went out. Serious severe weather event commencing.

14:11 amalloy: I'm trying to remember exactly how nil-comp works.

14:12 amalloy: i think the best fully-lazy version involves (last (take-while identity))

14:12 Raynes: it's just (comp) but short-circuiting on the first false result

14:14 Raynes: amalloy: Right. Either way, I definitely want to avoid unnecessary computation.

14:15 amalloy: Raynes: really? it's not actually calling the functions, just scanning through them

14:15 Raynes: amalloy: I'm not opposed to the (last (for ..)) idea.

14:15 You could, of course, use take-while and map.

14:15 amalloy: Raynes: map is tricky because what value to pass into map depends on the previous computation

14:16 i'll put some more thought into doing it lazily, but i'm surprised you care about the time spent iterating through a sequence and not doing anything with it

14:17 Raynes: I don't particularly care about how much time it takes as much as the fact that there are ways to do it without iterating through the whole thing.

14:17 I'm content with this reduce version, however.

14:18 I'm just saying: if you can think of a way to do it lazily, jump on it.

14:18 amalloy: okay

14:19 there's sure to be an elegant way, i just didn't spend much time on it since it didn't seem likely to matter. i'll get back to it

14:21 Raynes: amalloy: for with :while and :let might do the trick.

14:22 Actually, it wouldn't.

14:22 I keep forgetting that you have to maintain the previous result.

14:22 amalloy: yeah

14:22 Raynes: That's what makes it complicated.

14:23 amalloy: i think nil-comp already exists in the standard library and you just want to map fns into closures around the constant data

14:35 otoh, actually creating a nil-safe function would involve a reduce on the fn list anyway, so it wouldn't be any better

14:37 Raynes: amalloy: We'll just leave it the way it us for now. As long as it works, it isn't that important.

14:39 amalloy: Raynes: yeah, i wasn't sure where nil-comp was actually being used, so i didn't test it directly. i did launch him and get forecasts and so forth though

14:42 Raynes: amalloy: It's a crucial part of on-send-message hooking. The mute plugin is a relevant usage case.

14:50 amalloy: Raynes: he only listens to mute/unmute from admins. what do i have to do to tell him i'm an admin so i can test it?

14:53 LOPP: a

14:54 nickik: b

14:56 Raynes: amalloy: Look in the :users key in the configuration.

14:57 amalloy: ah

14:59 Raynes: amalloy: Eventually, configuration will be entirely redone. I plan to add a web interface to sexpbot's configuration in hopes that people would never have to touch the configuration files.

14:59 LOPP: so why is the channel #java invite only?

15:00 do they have secret arcane knowledge they don't want us to have? :D

15:02 amalloy: LOPP: try ##java?

15:02 it seems to be open, and as full of idiots as you could hope

15:03 LOPP: ##java: Cannot join channel (+r) - you need to be identified with services

15:03 what's that

15:03 amalloy: have you registered your nick?

15:03 LOPP: no

15:03 how do I do that?

15:03 nDuff: LOPP, read the message the IRC server provided when you first connected.

15:04 LOPP, alternately, /msg NickServ HELP

15:04 amalloy: Raynes: i don't think mute is working, but i'm not sure i have the syntax right

15:04 nDuff: LOPP, alternately, /join #freenode and ask there.

15:04 amalloy: is it just @mute?

15:11 cpfr: hey I have a private function in a java class I really need to access

15:11 what's the least painful way to do this

15:12 amalloy: cpfr: um, don't? or make the method non-private?

15:12 Raynes: amalloy: @mute should do it.

15:13 cpfr: amalloy, not my java class

15:13 Raynes: It should just mute the channel you're in.

15:13 amalloy: Raynes: and after @mute he should never say anything, incl reponses to eg @ping?

15:13 TheAnimal: Then you are screwed

15:14 Raynes: Why would you ever want to access a private method?

15:14 amalloy: cpfr: not actually screwed, but you should seriously rethink why you want to call a private method of a class you don't own. what is it that you can't do with the class's public api?

15:15 hiredman: ping?

15:15 cpfr: amalloy, this is a function that builds a dictionary. it isn't available anywhere else

15:16 raek: cpfr: http://clojuredocs.org/clojure_contrib/clojure.contrib.reflect/call-method

15:17 Raynes: Seems like the power is about to go byebye.

15:17 amalloy: cpfr: (a) if this class is well-known can you provide a link to the api/source? (b) why are you asking in #clojure instead of #java? (c) reflection can do this, if you have appropriate security settings

15:17 raek: be aware that your code could break without any notice

15:21 cpfr: amalloy, since I want to do this all from clojure

15:21 http://opennlp.sourceforge.net/api/opennlp/tools/parser/AbstractBottomUpParser.html#buildDictionary(opennlp.tools.util.ObjectStream, opennlp.tools.parser.HeadRules, int)

15:22 raek, what would make it break?

15:22 amalloy: cpfr: private methods are subject to change at any time, because nobody is suppoed to be using them

15:22 Raynes: It's not a public API. It's implementation detail that the author can change on a whim in any way that would destroy your code.

15:23 People make methods private for the purpose of keeping people from using them.

15:23 cpfr: amalloy, I am well aware of the risks

15:23 angerman: hmmm.... I guess I need to do some optimizations. 15min is not close enough to real time

15:23 Raynes: Not to just annoy users. :p

15:23 cpfr: I have already commented that this is hacky

15:24 and it looks like in the latest version the library makes the method public

15:24 amalloy: cpfr: what's wrong with the static version?

15:24 cpfr: in my version its private static

15:24 amalloy: Raynes: i learned something funny from java. the month after december is named undecimber

15:25 Raynes: amalloy: :>

15:26 amalloy: because apparently some lunar calendars usually have 12 months, but occasionally 13

15:26 TheAnimal: if you want to access private method then decompile the class and copy the code into your own method

15:26 amalloy: there's even a duodecember for month 14, but java doesn't support that :(

15:30 Raynes: amalloy: I'm going to run for a little while. Tornado warning for my county.

15:31 amalloy: *shudder* tornados. glad i'm on the west coast; those guys are scary

15:52 a_strange_guy: hi, clojurians

15:53 does anyone build the latest clojure-contrib master against thelatest clojure master?

15:56 tonyl: afternoon

15:57 drewr: sk

15:57 whoops, launchbar invocation e_fail

15:58 tonyl: :P

16:25 LOPP: what's the difference between ' and #'

16:26 tonyl: ' is the same as the fn quote and #' is the same as the fn var

16:27 _na_ka_na_: hello, any readymade function which converts a java.util.Map to clojure.lang.PersistentHashMap ??

16:27 nDuff: (as documented at http://clojure.org/reader)

16:28 ohpauleez: _na_ka_na_: You can probably use zipmap

16:28 tonyl: nDuff: exactly

16:28 _na_ka_na_: i found (into {} (java.util.HashMap.)) works :)

16:28 quoll: anyone here familiar with setting up Aquamacs to work with Clojure?

16:29 ohpauleez: _na_ka_na_: Ah, cool

16:29 _na_ka_na_: ,(into {} (java.util.HashMap.))

16:29 clojurebot: {}

16:29 drewr: _na_ka_na_: clojure.lang.PersistentHashMap is a java.util.Map, so you may not need to do an actual conversion

16:29 _na_ka_na_: ohpauleez: I only hope into works in future versions also

16:30 ,(assoc (java.util.HashMap.) :id 10)

16:30 clojurebot: java.lang.ClassCastException: java.util.HashMap cannot be cast to clojure.lang.Associative

16:30 ohpauleez: _na_ka_na_: it will, see drewr's comment

16:30 _na_ka_na_: drewr: ^^

16:30 ,(assoc (into {} (java.util.HashMap.)) :id 10)

16:30 clojurebot: {:id 10}

16:30 ohpauleez: it's implemented on top of HashMap, is what he's saying

16:30 drewr: _na_ka_na_: assoc is a clojurey thing -- why wouldn't you use a clojure map there?

16:31 _na_ka_na_: drewr: I'm using a Java API which returns j.u.Map

16:31 now after getting that I want to assoc things to it the clojure way

16:31 drewr: sure, then into should be fine

16:32 _na_ka_na_: cool

16:33 drewr: if you need to give a lib a Map, you can use the POCO PersistentHashMap

16:37 vibrant: i'm wondering how to store all those maps

16:39 technomancy: rolling them up into poster tubes has always worked well for me.

16:39 _na_ka_na_: drewr: in this instance I'm passing the API a clojure {} .. when it expects a j.u.Map .. and its working

16:41 KirinDave: Is there a way to tell if something will respond to a deref message?

16:41 err, or rather be invoked by deref properlt

16:41 I have something coming into a function which may or may not be deref-able.

16:41 amalloy: ,(instance? clojure.lang.IDeref (atom 0))

16:41 clojurebot: true

16:41 amalloy: ,(instance? clojure.lang.IDeref [])

16:41 clojurebot: false

16:41 ohpauleez: _na_ka_na_: {} is implemented on top of Map

16:41 KirinDave: Well

16:41 Yeah, dude.

16:41 But..

16:41 ohpauleez: ,(.isEmpty {})

16:41 clojurebot: true

16:42 amalloy: KirinDave: you want something nicer?

16:42 KirinDave: amalloy: I suppose.

16:43 drewr: _na_ka_na_: that's what I was saying with my comment about PersistentHashMap (it extends APersistenMap which implements j.u.Map)

16:44 ,(->> clojure.lang.PersistentHashMap supers (some #{java.util.Map}))

16:44 clojurebot: java.util.Map

16:45 amalloy: drewr: isn't instance? a bit easier there?

16:45 _na_ka_na_: drewr: hmm now i get you .. but it seems the other way round of j.u.Map -> clojure doesn't work

16:46 ,(instance? java.util.Map {})

16:46 amalloy: _na_ka_na_: right, cause j.u.Map doesn't implement PersistentMap

16:46 clojurebot: true

16:47 _na_ka_na_: amalloy: too bad I need to (into {}) it then .. wasting CPU cycles

16:47 pjstadig: ,(get (doto (java.util.HashMap.) (.put :a :b)) :a)

16:47 clojurebot: :b

16:47 pjstadig: you can get and seq and do all kinds of stuff

16:47 it's not persistent though, so you can't add to it with assoc

16:47 drewr: amalloy: sure, just pasted what I had in my repl

16:48 _na_ka_na_: pjstadig: yes exactly

16:48 pjstadig: if you want persistent, then you have to into it

16:49 duncanm: in destructuring syntax, if i have a MapEntry, is there a way to get the (key e) (val e) without knowing what the key is?

16:50 like, (let [{k v} {:a 1}] (println k v)) doesn't seem to work

16:50 ,(let [{k v} {:a 1}] (println k v))

16:50 clojurebot: java.lang.Exception: Unable to resolve symbol: v in this context

16:50 duncanm: hmm

16:50 jarpiain: ,(let [[k v] {:a 1}] [k v])

16:50 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap

16:50 jarpiain: ,(let [[k v] (seq {:a 1})] [k v])

16:50 clojurebot: [[:a 1] nil]

16:51 duncanm: so i just have to seq the MapEntry??

16:51 jarpiain: ,(let [[[k v]] (seq {:a 1})] [k v])

16:51 clojurebot: [:a 1]

16:51 duncanm: eek

16:51 Chousuke: hmmh

16:52 I would use (juxt key val) :P

16:52 duncanm: Chousuke: how?

16:52 Chousuke: ,((juxt key val) {:a 1})

16:52 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry

16:52 Chousuke: hmmh

16:53 never mind. :(

16:53 amalloy: ,((juxt key val) (first (seq {:a 1})))

16:53 clojurebot: [:a 1]

16:53 drewr: ,(instance? clojure.lang.PersistentHashMap java.util.Map)

16:53 clojurebot: false

16:53 duncanm: yeah, it'd be nice if there's destructuring synatx for this

16:53 _na_ka_na_: ,((juxt key val) (seq {:a 1}))

16:53 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentArrayMap$Seq cannot be cast to java.util.Map$Entry

16:53 amalloy: duncanm: just seq it and then destructure that

16:53 _na_ka_na_: ,((juxt key val) (first {:a 1}))

16:53 clojurebot: [:a 1]

16:54 duncanm: amalloy: then it's like what jarpiain wrote above

16:54 drewr: ,(instance? java.util.Map {})

16:54 clojurebot: true

16:54 drewr: derp, shows how much I have to use instance?

16:55 amalloy: yeah, i don't use instance? much either

16:55 ,(map? (java.util.HashMap.))

16:55 clojurebot: false

16:55 amalloy: boo

16:55 duncanm: oh, boo!

16:57 jweiss: if i intern a fn in a namespace, and refer to that thing i interned elsewhere, it seems i have to have run the code that does the interning before the referring code will even compile. any way around that?

16:57 vibrant: humm... what about default values for struct-map fields?

16:57 kotarak: jweiss: declare

16:58 vibrant: factory functions

16:58 jweiss: kotarak: yeah i guess i could do that, the things i'm interning are read from a data file, but since my referring code makes assumptions about what's in there, i could do the same by declaring

16:59 vibrant: kotarak; so hum... & rest and i dig in rest and if something is missing i set the default?

16:59 kotarak: jweiss: although I read "interning" which smells a little bit

17:00 vibrant: ? I'm not sure I understand your question.

17:00 jweiss: kotarak: i'm trying to generate a clojure xmlrpc client for a python xmlrpc server. i have a list of method names and args, i parse it and intern calls to a java xmlrpc client. this way i have real clojure fn's to call. is that not idiomatic for this sort of thing?

17:01 vibrant: kotarak; (defstruct bullet :angle :velocity) where i want velocity to be 50 by default, so how do i write the factory func?

17:02 amalloy: vibrant: maybe :or in the map destructuring

17:02 kotarak: vibrant: (defn make-bullet [& {:keys [angle velocity] :or {angle 45 velocity 950}] (struct bullet angle velocity))

17:03 amalloy: yes, exactly that

17:03 vibrant: thanks :)

17:03 kotarak: jweiss: do you have to do that at runtime or do you know that upfront?

17:04 jweiss: kotarak: i don't have to do it at runtime. the server is not going to change. but i do not want to manually code all the functions, there's 100 of them

17:05 kotarak: jweiss: that's what macro are for.

17:05 KirinDave: Man, I am all about mapping keys

17:05 Makes me nervous.

17:06 kotarak: jweiss: (defxmlrpc <spec-goes-here>) generates all functions. Everything compiles.

17:06 jweiss: kotarak: i tried that first but had trouble getting it right. i'll try again. if you know of an example somewhere that'd help a bunch :)

17:07 KirinDave: I'm surprised map-keys doesn't exist

17:07 jweiss: do i loop a call a macro to expand to defn? do i call a macro that loops a call to a macro to expand to defn?

17:07 bhenry: KirinDave: what would map-keys do?

17:07 kotarak: jweiss: http://github.com/duelinmarkers/clj-record/blob/master/src/clj_record/core.clj#L190

17:08 KirinDave: bhenry: For a map of k -> v and a a function f, produces a new map where f(k) -> v for each pair

17:08 kotarak: jweiss: just a sec

17:08 KirinDave: Is it in contrib and I just don't know about it/

17:08 amalloy: KirinDave: yeah, i think it is

17:09 lemme look

17:09 bhenry: KirinDave: amalloy: , i've seen f(v) that way, but not f(k)

17:09 KirinDave: bhenry: Well usually people use maps for lookup, but if you're using it as a way to store pairs...

17:11 bhenry: what are your keys? (i.e. keywords, strings, etc?)

17:11 mabes: KirinDave: I've looked in contrib for map-keys myself.. never found it. I would be surprised if it wasn't there.. but I usually just add it myself: http://gist.github.com/647817

17:11 KirinDave: bhenry: Well for example

17:11 bhenry: Imagine that you get a java.util.Map

17:11 And you want to make sure all the keys are clojure keywords

17:12 amalloy: KirinDave: huh, i guess you're right

17:12 KirinDave: amalloy: Not that it's easy to find. Contrib is enormous these days.

17:12 kotarak: jweiss: something like this might be feasible: http://paste.pocoo.org/show/281963/

17:12 mabes: we need a (find-fn-by-example) or somthing to search all of contrib

17:16 jweiss: kotarak: thanks! do i have to extract the data of the xmlrpc method names/args into this code? i would expect so if i want it to expand at compile time?

17:16 right now i am reading it from a file

17:17 kotarak: jweiss: you could do like (defmacro defxmlrpc-from-file [file-name] (let [spec (read-spec-from file-name) ....] ...))

17:18 jweiss: kotarak: and the call to that macro would get executed at compile time?

17:19 kotarak: jweiss: yes. But the file-name must be a string.

17:20 jweiss: kotarak: right, not a form because it wouldn't get evaluated. excellent, thanks

17:20 kotarak: jweiss: you are welcome

17:22 arkh: in leiningen directory structure, where should I place local libraries I've written that are used by my project's core.clj?

17:24 raek: arkh: if they are big enough, I guess the common way is to push their jars to clojars and add them to :dependencies in project.clj

17:24 arkh: raek: sorry, I should have specified that I'd like to keep them local, for now (no clojars_

17:25 raek: arkh: for smaller libs that hasn't become their own projects, I guess I yould include their source files in src/

17:25 for sometiing in-between, there's the "checkouts" feature

17:25 * arkh looks up checkouts

17:26 mabes: bhenry: fyi, I commented on the gist http://gist.github.com/647817#comments

17:26 raek: if you have lein projects for those libs, create a dir called checkouts/ in your dependent project, and for each lib, add a symlink to the lib's project directory

17:27 lein will automagically add those libs' sources and dependencies to the classpath

17:27 arkh: raek: I see - cool : ) My "libraries" are small enough that I'll probably just stuff them in ./src for now. I made the mistake of putting them in ./lib earlier

17:28 raek: ah, lib/ itself is not on the classpath

17:28 but all jars in it is

17:28 nickik: is there a standard average function?

17:28 raek: for the classpath, jars work like directories

17:29 KirinDave: Hrrrmmmm

17:29 bobo_: hm,, how do one use post with moustache? how do i get the params?

17:29 KirinDave: This is confusing get-class stuff

17:29 Can someone help me figure out why gen-class isn't making the static makeServer method?

17:29 raek: bobo_: you can dispatch on method like this: ["path"] {:post post-handler, :get get-handler}

17:29 kotarak: bobo_: I think you need the ring params middleware

17:29 raek: bobo_: there is Ring middleware that does the param parsing

17:30 bobo_: http://mmcgrana.github.com/ring/middleware.params-api.html

17:30 (app wrap-params ["foo"] {:post handler})

17:31 KirinDave: C'mon github... save

17:31 Okay

17:31 https://gist.github.com/be11b181842fce78ade5

17:31 I am still not very good with gen-class

17:31 So can someone explainw hat I am doing wrong?

17:32 goodmike_mh: technomancy: Are you around?

17:33 chouser: KirinDave: you're expecting a static method makeServer and not seeing one?

17:33 raek: maybe the metadata should be on the vector

17:33 KirinDave: chouser: Yes

17:33 raek: "Static methods can be specified with ^{:static true} in the

17:33 signature's metadata."

17:33 chouser: KirinDave: yeah, what raek said

17:33 ^:static [makeServer ...]

17:34 KirinDave: Oh

17:34 I see.

17:34 I put it inside the [

17:34 Not outside.

17:34 chouser: and you don't need it on the -makeServer

17:34 KirinDave: Okay

17:36 raek: yeah, (defn ^:static foo ...) is a Clojure-specific thing...

17:37 unrelated to the class/instance method distinction

17:37 KirinDave: Annnd now it refuses to compile

17:37 Saying that a bound var is not bound.

17:37 chouser: progress!

17:37 KirinDave: But it's bound, so...

17:37 Man, compiling. What a drag.

17:37 chouser: no kidding. gen-class is annoying that way

17:38 KirinDave: do you have a very recent clojure? someone on the list mentioned a similar-sounding problem that went away with "today's clojure"

17:38 jweiss: kotarak: that totally worked. thanks again.

17:38 KirinDave: chouser: This is 1.2

17:38 kotarak: jweiss: that's good to hear. :)

17:38 KirinDave: chouser: Stable, but i haven't updated in quite awhile.

17:39 chouser: hm

17:39 KirinDave: Hum

17:40 chouser: what var is unbound?

17:40 bhenry: mabes: i timed them and they were both about the same doing an operation 1000 times.

17:40 they alternated being quicker than the other.

17:40 KirinDave: chouser: I am gisting

17:41 chouser: https://gist.github.com/47de41199aabd74df3c0

17:41 mabes: bhenry: nice, I much prefer your version then... how big was the map?

17:41 KirinDave: chouser: Sorry the trace is at the bottom :\

17:41 bhenry: it was small. i'll try my tests with a bigger one.

17:42 KirinDave: chouser: (protocol-machine ...) takes all enclosed defstate forms and pre-(declare ...)s them

17:42 chouser: I wonder if it's somehow choking on that.

17:42 chouser: I removed the require and it's still choking tho. Weird

17:42 cemerick: whoa, scary macro magic! :-P

17:43 KirinDave: cemerick: Actually I'm super proud of everything but protocol-machine there. I'm pretty convinced what I did was the Right Way given the starting point. But you know me... bull-headed for macros.

17:44 bhenry: mabes: yeah if your map is big transients are the way to go.

17:44 huge difference with 10000 keys

17:45 KirinDave: chouser: Can you see why that might be?

17:46 rata_: hi

17:47 KirinDave: Ahah

17:47 I fixed it.

17:47 kotarak: KirinDave: toplevel forms are compiled completely before anything inside is executed.

17:49 arkh: does -main act as an entry point for execution /only/ if you're using gen-class or will it be the 'main' of the program if you're not using gen-class?

17:49 cemerick: arkh: the former

17:49 arkh: cemerick: thank you

17:50 KirinDave: kotarak: I don't understand how that applies here.

17:50 man, why is it saying this var is unbound when it clearly is not.

17:50 I can load the module just fine.

17:50 It's just during lein compile it freaks out.

17:51 kotarak: KirinDave: ah. ok. sorry wrong error

17:51 AWizzArd: cemerick: do you have a SSD?

17:51 cemerick: ssd?

17:51 AWizzArd: vs. hd

17:51 cemerick: oh; no

17:51 AWizzArd: k

17:54 _na_ka_na_: hellos, I have a java API I need to call.. it expects a j.u.Map (can be nested) ... passing simple un-nested maps like {"a" 10} works .. but if I pass a nested {"a" {"b" 10}} .. it gets converted to {"a" [["b" 10]]} .. any insights or solutions how do to it ?

17:57 when i say it gets converted .. I mean the API finally gets this ..

17:58 cemerick: _na_ka_na_: some code of yours somewhere is making that change; nesting maps works just fine

17:58 ->{:a {:b 10}}

17:58 sexpbot: ⟹ {:a {:b 10}}

17:59 _na_ka_na_: cemerick: I'm passing that nested map .. but the java API is such that when it gets to the real work .. it works with {"a" [["b" 10]]}

18:00 Raynes: $mail amalloy Muting still works, so your version of nil-comp isn't killing bunnies, apparently. I'm going to go ahead and merge it into master. Thanks!

18:00 sexpbot: Message saved.

18:00 _na_ka_na_: but if I pass the API below .. it works fine i.e. with {"a" {"b" 10}}

18:00 ,(doto (java.util.HashMap.) (.put "a" (doto (java.util.HashMap.) (.put "b" 10))))

18:00 clojurebot: #<HashMap {a={b=10}}>

18:01 Raynes: hiredman: ping

18:01 cemerick: _na_ka_na_: not sure what you're getting at; are you saying that the value is being flattened somehow automatically?

18:02 _na_ka_na_: cemerick: yes, and that it gets flattened in the java API, but if I pass a nested j.u.Map as above its all fine

18:02 cemerick: oh; well, if the Java library is flattening it, I'm not sure what you'd hope to do from clojure to fix that...

18:03 you're *certain* that no intervening clojure code you're using is doing the flattening?

18:04 _na_ka_na_: my last option is to write a recursive fn which converts a nested clojure map to a nested j.u.Map as above

18:04 yes I am

18:04 cemerick: Why would this java API know the difference between a j.u.Map and a Clojure persistent map?

18:05 _na_ka_na_: cemerick: in short, I have no idea :) .. i haven't the source of this API

18:05 cemerick: right :-) My point is that it seems highly unlikely that it does.

18:06 KirinDave: This is crazy.

18:06 I'm totally screwed now.

18:06 cemerick: _na_ka_na_: are you calling the library directly, or is there a clojure wrapper for it that you're using

18:06 bobo_: if it takes a j.u.Map and clojure persitent map implements that. i would say the API is broken if it notices a difference?

18:07 _na_ka_na_: cemerick: directly

18:07 cemerick: _na_ka_na_: which library is this?

18:08 _na_ka_na_: its some library at my work place .. I'm asking them for the source

18:08 not any public lib

18:09 KirinDave: So it seems like...

18:09 If you have things using (declare ...) and they get referenced by a gen class making static methods, then you're just done.

18:09 You can't do it.

18:10 cemerick: _na_ka_na_: perhaps the API accepts a j.u.Map, but always flattens values of non-HashMap things. Nutty. Pass in another impl of j.u.Map and see what happens.

18:10 KirinDave: That's almost certainly not the case.

18:10 KirinDave: cemerick: Well, this is behaving really inconsistently.

18:10 Like, the first compile works

18:11 but then subsequent compiles do not.

18:11 I have to erase the classes dir, then it compiles okay

18:11 b

18:11 but I can't load the namespace.

18:11 So something is terribly wrong here, and what precipitated it was ^:static

18:11 cemerick: The gen-class form doesn't impact what's in the namespace.

18:12 i.e. being able to load it or not isn't related to your gen-class decl

18:12 (the namespace, that is)

18:13 KirinDave: cemerick: Well, something I've done with graph.clj is pissing the compiler off

18:13 It's complaining b13 is not bound

18:13 but, well, it clearly is.

18:13 if i load the file and type in b13 with *ns* = clothesline.protocol.graph, it's clearly right

18:15 cemerick: KirinDave: are you sure that protocol-machine is doing what you hope it's doing?

18:16 KirinDave: cemerick: It's not a very complicated macro.

18:16 cemerick: And again, everything worked before I hadded a gen-class with a :^static

18:16 cemerick: THe macro is: https://gist.github.com/b26834d128610b428f2b

18:17 * KirinDave grumbles.

18:17 KirinDave: Maybe coffee will clarify this problem.

18:54 amalloy: Raynes: nice, didn't know about the mail feature

18:55 how do i use it to send mail? i don't yet grok the syntax for defining plugins, so reading the source is tricky

18:56 _na_ka_na_: cemerick: if you're still here I found the issue vv

18:56 ,(instance? java.lang.Iterable {})

18:56 clojurebot: true

18:57 _na_ka_na_: (instance? java.lang.Iterable (java.util.HashMap.))

18:57 ,(instance? java.lang.Iterable (java.util.HashMap.))

18:57 clojurebot: false

18:58 _na_ka_na_: one of the methods has an (instanceof Iterable) chk before the (instanceof Map) chk

18:59 cemerick: _na_ka_na_: Nice. :-/ Bummer.

19:00 amalloy: _na_ka_na_: get the keyset out first?

19:00 er, the entryset

19:01 ,(intance? java.lang.Iterable (.entrySet (java.util.HashMap.)))

19:01 clojurebot: java.lang.Exception: Unable to resolve symbol: intance? in this context

19:01 amalloy: ,(instance? java.lang.Iterable (.entrySet (java.util.HashMap.)))

19:01 clojurebot: true

19:01 _na_ka_na_: amalloy: its not my code :/ its in an API

19:02 now I need to convert my clojure maps to j.u.Maps

19:02 sad day

19:02 amalloy: hm

19:03 tonyl: what api is it?

19:07 amalloy: _na_ka_na_: define an IterableMap class, perhaps, that extends PersistentHashMap and implements Iterable?

19:07 then you don't have to do any copying or deal with j.u.Map, you can just wrap the underlying map with an iterable

19:09 _na_ka_na_: amalloy: I need to go the other way around, i.e. I need a Map which is not iterable .. coz being iterable confuses the API into believing something else

19:09 amalloy: oh i see

19:09 yuck

19:10 tonyl: seems it is is really sandboxed, or is it a java api?

19:10 _na_ka_na_: tonyl: its an internal Java api at my workplace

19:10 defn: ninjudd or lancepantz are you guys around?

19:11 duncanm: if i have a defrecord, and i want to modify how it's printed, which protocol do I implement?

19:14 tonyl: I would say implement the toString method of Object, depends on what you mean printed.

19:14 I haven't done protocols that much though

19:15 cemerick: duncanm: printing doesn't have a protocol yet -- that stuff is all implemented using multimethods right now. Define an implementation of print-method for your record's class.

19:16 duncanm: ahh

19:16 cemerick: see core_print.clj in the clojure project to see how all the core types' printing is implemented

19:18 duncanm: tonyl has a good point though -- think hard about what this string representation is meant to do.

19:41 stuartsierra: building clojure-contrib 1.3.0-alpha2

19:57 clojure-contrib 1.3.0-alpha2 deployed

20:01 tlockney: quick question about Clojure-Java interop: does Clojure not support specifying type parameters on Java types?

20:02 I'm pretty sure I saw that mentioned somewhere, but want to confirm

20:02 qbg: tlockney: are you talking about generics?

20:03 tlockney: qbg: yes. for instance, I need to pass in a map from Java (really from Scala)

20:03 qbg: type parameters don't exist at run time

20:04 tlockney: and we were having problems instantiating instances of IPersistentMap, so thought perhaps we could use java.util.Map

20:04 qbg: yeah, I know, but they do exist at compile time

20:04 which, ya know, sorta kinda matters on the java/scala side ;)

20:04 basically, here's the situation...

20:05 gen-class'ing a base class from clojure, that will then be extended from Java/Scala, but the methods need to take a Map

20:06 qbg: Any reason why they can't just take a Map and not a Map<K,V>?

20:07 tlockney: yes, if you try to extend a class that has a method sig with just Map and not Map<K,V>, the compiler won't accept it

20:10 hmm, I'll try going back to using IPersistentMap and hope I can finagle the instances appropriately

20:13 mister_roboto: tlockney: why are you crossing into clojure in the first place? i'm just curious

20:14 tlockney: mister_roboto: because it's appropriate for our environment :)

20:14 qbg: The extended class really needs to have a parameter of type Map<K,V> instead of Map?

20:14 tlockney: qbg: yeah, it does.

20:15 mister_roboto: tlockney: it doesn't sound like it's that appropriate if you're having a PITA scala/clojure interop problem. i mean, why not just do it all in scala? how is clojure more appropriate in your case?

20:15 tlockney: note that i'm not criticizing, just wondering what sort of situation calls for that, in your opinion

20:16 tlockney: It's a port of Webmachine that Dave Fayram (kirindave) wrote -- Clojure was much simpler for him to map out the http graph that webmachine uses

20:16 qbg: Is it implementing an interface that requires it?

20:16 mister_roboto: tlockney: ok thanks!

20:16 tlockney: but al3x and I are both much more versed in Scala, so we're trying to make the 2 work together.

20:17 we can get past these issues, I'm just trying to make sure I'm not missing something obvs in what looked (at first glance) to be the simplest approach

20:17 qbg: well in Java extending a class or implementing an interface really causes the same checks to be performed

20:18 qbg: the signatures must match

20:18 tomoj: but the java compiler doesn't run

20:18 tlockney: tomoj: it does when you're tying to compile Java :)

20:18 tomoj: aren't you trying to compile a gen-class?

20:18 oh, the base in clojure, extending in scala?

20:18 tlockney: tomoj: no, that's just one part of it

20:19 tomoj: right

20:19 tomoj: had it backwards

20:19 tlockney: tomoj: gen-class'ing from clojure, then extending from Scala

20:19 tomoj: wait, what?

20:19 qbg: You can have a generic class extend a non-generic class as long as you don't change Map to Map<K,V>

20:19 tomoj: is the gen-class the superclass or the subclass?

20:20 tlockney: qbg: maybe it's just the Scala compiler that's blowing up then. I would have sworn Java restricted that as well, but haven't tested it.

20:20 tomoj: the gen-class is the superclass

20:20 tomoj: right, ok

20:21 mister_roboto: tlockney: is webmachine like netkernel? glancing at the web page, it looks similar

20:21 tlockney: mister_roboto: not sure, haven't looked at netkernel

20:22 mister_roboto: actually, I have, but it's been quite a while

20:29 amalloy: tlockney: java compiler will definitely let you use non-parameterized classes. it issues a warning, not an error

20:29 since generics are really just syntactic sugar for the caller doing all the necessary casting anyway

20:31 tlockney: amalloy: ah, hmm... I'll need to go back and look more closely at it. already trying to maneuver around the orig issue in a different way, but maybe I'll circle back shortly

20:32 amalloy: ah, I suspect this was a Scala compiler issue - it wasn't matching up the override with the correct super method, so threw an error on the 'override' keyword

20:33 well, that's an issue for a different channel :)

20:34 amalloy: ah, interesting. java matches the @Override properly

20:36 tlockney: amalloy: yeah, I suspect it has to do with Scala's much more intense type inference here. Something for me to dig into later. now there are more important tasks ahead

20:36 amalloy: *gasp* more important than type safety? how dare you even use a jvm language!

20:37 tlockney: amalloy: hey, watch it. I'm one of those people who likes type safety. I just also happen to be wise enough to understand when it's not helping me :)

20:37 I *am* trying to work with Clojure, after all

20:38 amalloy: tlockney: yeah, i was tickled pink when generics came out. but now i'm working with hadoop in java for work, and generics are killing me

20:38 tlockney: and *gasp* actually likely it most of the time *shameless-grin*

20:38 mister_roboto: tlockney: maybe you should work WITH it and rewrite your stuff in clojure :)

20:38 tlockney: amalloy: you have my deepest sympathies

20:38 amalloy: worked with hadoop?

20:39 tlockney: mister_roboto: yes, and maybe I should take a few weeks off from this little startup thing (cause, you know, we have TONS of time) to learn it that well

20:39 mister_roboto: tlockney: it's probably running too fast now anyway :)

20:40 tlockney: just kidding. good luck with your project

20:40 tlockney: amalloy: nah, just crazy insane usage of generics in Java (note: I am *not* talking about type parameters in Scala -- whole diff ballgame)

20:40 amalloy: yeah, i haven't tried scala

20:40 tlockney: mister_roboto: also, see previous mention of actually being a fan of type safety ;)

20:41 I'm riding dangerous ground talking like this in #clojure, ain't I?

20:41 mister_roboto: lol it's really a nice bunch of people here.

20:41 tlockney: yeah, i'm just teasing

20:42 mister_roboto: unlike #groovy where nobody EVER says a damn word

20:42 or responds

20:43 tlockney: mister_roboto: I try to stay away from Groovy, if I can help it. but that's jsut a personal preference.

20:43 mister_roboto: tlockney: it's slow but you just cannot get nicer integration with java.

20:44 tlockney: mister_roboto: sure you can, it's called Scala (warning: blantant trolling!)

20:45 mister_roboto: tlockney: there is no comparison there. groovy is vastly tighter integration. totally seamless use back and forth of each other's classes. no type problems at all. and very very simple type coercion from groovy's to java. e.g. [""] as String[] stuff like that

20:46 tlockney: mister_roboto: depends on what you consider *nice* ;)

20:46 mister_roboto: tlockney: you just never have any weirdness with type mismatches because it's basically just java with closures, great jdk extensions with higher order functions and dynamic typing

20:47 tlockney: nice as in my groovy code is 1/5 to 1/10 the equiv java lines. with no loss of readability (usually much easier to read in fact)

20:50 i hope clojure 1.3 catches up to scala without having to do lots of performance tricks

20:51 i would dearly love to see it really catch fire and become huge on the jvm

20:53 tlockney: mister_roboto: I'd be happy to see that as well

20:58 tomoj: catches up? :(

20:59 duncanm: sigh

20:59 mister_roboto: well from what i was reading (was it slashdot this morning?) the latest round of [random] benchmarks seems to have clojure at about 1/4x java speed, and scala on par with java

20:59 that was with 1.2

20:59 duncanm: if i have an incanter matrix [[:a b]] and I want to get it to be [[:a :b 1]], there must be a function for that, right?

20:59 mister_roboto: i'll find the article...

21:00 amalloy: ,(update-in [[:a b]] 0 conj 1)

21:00 clojurebot: java.lang.Exception: Unable to resolve symbol: b in this context

21:00 amalloy: ,(update-in [[:a :b]] 0 conj 1)

21:00 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

21:01 amalloy: mutter

21:01 qbg: ,(update-in [[:a :b]] [0] conj 1)

21:01 clojurebot: [[:a :b 1]]

21:01 amalloy: oh thanks

21:02 duncanm: ^^

21:02 tlockney: amalloy: are you sure about what you were saying re: Java generics and @override earlier? http://gist.github.com/648186

21:04 amalloy: oh you're doing it the other way round than i thought

21:04 yes, that's not a valid override

21:04 but if Super had <X, Y> and Sub were raw, it would be okay, which is what i thought you meant

21:04 tlockney: amalloy: ok, so... back to where I thought I was, I guess :)

21:05 amalloy: but I assume you see how the original question came up now. I need to gen the super class in clojure, so the lack of generics support is a problem

21:06 qbg: Scala doesn't let sub be raw?

21:07 amalloy: tlockney: if you use <?,?> instead of <Object, Object> does that work?

21:08 seems like it should

21:08 qbg: amalloy: I don't think so

21:08 tlockney: amalloy: nope.

21:08 mister_roboto: tomoj: here is what i was reading - http://groups.google.com/group/clojure/browse_thread/thread/94cc586631af16f1?pli=1

21:09 tomoj: stu halloway added his 2 cents too

21:12 amalloy: tlockney: i guess it makes a little sense, because if you could do this kind of extension it would become possible to write type-unsafe code without a compiler warning

21:12 tlockney: qbg: sorry, missed your question - no Scala won't take a bare type here

21:13 amalloy: yeah, that's pretty much what I'm guessing is the rationale here

21:13 amalloy: I'm going to go back to try to use Clojure types, even if they are a bit more *interesting* to work with

21:13 amalloy: eg Super x = new Sub<String, String>(); x.foo(10, 12);

21:14 tlockney: thanks for the suggestions everyone

21:15 mister_roboto: tlockney: what about using xml?

21:15 :)

21:16 tlockney: mister_roboto: going for the serious troll, eh? ;)

21:16 mister_roboto: lol

21:26 qbg: I think a median of 4x slower than Java for relatively young benchmarks on a release before the optimization overhaul coming in 1.3 is rather good...

21:27 mister_roboto: qbg: me too. i wasn't complaining so much as hoping it gets closer so the suit types can't use that for a reason to discount clojure

21:28 qbg: Just compare Clojure to Python :p

21:28 mister_roboto: and sometimes you just need the speed. it would be fantastic if there was never a reason to drop to java just for that

21:28 qbg: right

21:30 qbg: java->scala kind of reminds me of c->c++

21:30 qbg: I wonder how of the lack of speed in those benchmarks is from the way they are computed instead of unremovable limitations that Clojure 1.2 puts in place.

21:30 That benchmark code did not look the Functional Fluid Dynamics code...

21:31 mister_roboto: qbg: i'm certainly no expert but i do note that Stu's only comment was that things are changing to make it faster. he didn't dispute the findings, or didn't want to play that game

21:31 qbg: Clojure seems to be going in the direction of C++'s attitude for performance

21:31 mister_roboto: qbg: by c->c++ i mean the explosion in complexity :)

21:33 qbg: i figured if i'm going to take that much time to learn all that new syntax, i might as well learn clojure instead and focus on the concepts without all the syntax

21:34 qbg: Due to lisp exposure, I feel queasy when looking at languages with a ton of syntax

21:48 Muki: hey guys! I'm in serious need of some help. :)

21:49 qbg: Muki: What is it?

21:49 Muki: I've been struggling with my clojure-emacs install for a week now

21:49 I am currently trying to get a hold of leiningen

21:50 and swank-clojure

21:50 I add the dependancy

21:50 run lein deps

21:50 and then swank is not a task

21:52 if I run it with swank-clojure 1.2.0 as a dependancy lein deps finishes

21:52 but then nothing happens

21:52 jweiss: Muki: does it show it downloading swank-clojure.jar?

21:52 is that jar in your lib/dev or lib dir?

21:52 it should have put it there

21:52 bhenry: Muki: what is your os?

21:53 Muki: os x

21:53 no

21:53 it only downloads clojure-contrib

21:53 qbg: What happens if you try swank-clojure 1.2.1?

21:54 jweiss: :dev-dependencies [[swank-clojure "1.2.1"]]

21:54 that's what the line should look like

21:54 Muki: only downloads clojure-contrib

21:55 jweiss: muki - it should be in your dev-dependencies, unless you need to bundle swank with your app

21:55 i don't know if that is causing your problem though

21:56 Muki: I had to point maven to clojure-contrib manually on my drive though

21:56 because beforehand maven wanted super pom for every dependency

21:56 qbg: How did you install leiningen?

21:56 Muki: lein shelscript

21:57 amalloy: and lein self-install?

21:58 Muki: yes

21:58 jweiss: muki - paste your project.clj

21:58 Muki: (defproject org.coljure.appengine/too_hot "1.0-SNAPSHOT"

21:58 :description "This is a test project to learn leiningen."

21:58 :dependencies [[org.clojure/clojure "1.2.0"]

21:59 [org.clojure/clojure-contrib "1.2-SNAPSHOT"]

21:59 [swank-clojure "1.2.1"]]

21:59 :namespaces [too-hot]

21:59 :main too-hot)

22:00 jweiss: muki, i don't know if it'll help, but try moving swank under a :dev-dependencies section (same syntax as :dependencies)

22:00 amalloy: yeah, it shouldn't help, but who knows. also it's a little surprising to depend on a snapshot of contrib; that will force a fetch of contrib.jar every time you build

22:01 jweiss: also i am no lein expert, but there's at least one problem with org.coljure.appengine/too_hot on your first line

22:02 i have never seen dotted and slashed project name, but there's probably a use for that i'm not aware of

22:03 Muki: ok so there's one more thing

22:04 before, whenever I ran lein deps a kilometer of errors showed up

22:04 and the I overrid clojure-contrib to a local file with maven

22:04 after that lein deps finished without errors

22:05 but lein swank never worked :)

22:05 tomoj: Muki: do you own coljure.org?

22:06 Muki: no

22:06 it's what all the tutorials said to use with maven :)

22:06 my biggest concern is to have swank-clojure running

22:06 and NOTHING worked so far

22:06 tomoj: they said to use org.clojure ?

22:07 Muki: es

22:07 yes*

22:07 tomoj: if you put a reverse domain name after defproject, you should own it

22:08 anyway, switch clojure-contrib from 1.2-SNAPSHOT to 1.2.0

22:08 Muki: a question

22:08 tomoj: there is no clojure-contrib 1.2-SNAPSHOT, wherever you got that from was wrong

22:09 Muki: ok

22:09 but if I have clojure and clojure-contrib on my machine

22:09 and want to use those as dependencies

22:09 how do I do that?

22:09 tomoj: why would you want to do that?

22:10 anyway, if you put them in the right place, they will be used

22:10 lein will download clojure, for example, into ~/.m2/repository/org/clojure/clojure/1.2.0/clojure-1.2.0.jar

22:10 no reason to use jars already on your machine unless you're hacking on clojure

22:11 Muki: OK, so what should I do?

22:11 I'm completely new to clojure, coming from Java and Python

22:11 tomoj: just put 1.2.0 instead of 1.2-SNAPSHOT, and run lein deps..

22:12 also move swank-clojure to :dev-dependencies like jweiss said

22:12 if you still get errors, paste the project.clj and the errors (not here! use gist or pastebin or whatever)

22:15 (uh, fix the contrib version, move swank-clojure to :dev-dependencies and _then_ run `lein deps`..)

22:17 Muki: these are the errors after lein swank

22:17 lein deps runs without errors

22:17 http://pastebin.com/HBJ4QPQn

22:18 tomoj: have you written a too_hot.clj?

22:19 or not yet?

22:19 technomancy: arkh: saw your question about -main; you actually don't need AOT to use it as of a week or so ago

22:19 tomoj: if not yet, get rid of :main and :namespaces until you write it

22:19 technomancy: it works with clojure.main -m

22:19 Muki: not yet

22:19 so I just remove main and namespaces then?

22:19 tomoj: right

22:20 Muki: did thath

22:21 tomoj: also, when you do write too_hot.clj, don't name the namespace 'too-hot', it needs at least one dot. foo.bar.too-hot namespace should go in src/foo/bar/too_hot.clj

22:22 Muki: OK but now the error is Exception in thread "main" java.lang.NumberFormatException: For input string: "[PORT=4005]" (NO_SOURCE_FILE:1)

22:22 tomoj: what did you type

22:23 Muki: figured it our

22:23 out

22:23 it should just be "lein swank" right?

22:23 tomoj: technomancy: do you already know about "Unable to resolve symbol: project in this context (swank.clj:7)"?

22:23 Muki: yeah

22:23 technomancy: Muki: if you use "lein new" rather than creating it manually you can avoid these troubles.

22:24 Muki: wow! that was a waste of your time - sorry

22:24 and now I should just M-x slime-connect?

22:24 technomancy: tomoj: doesn't sound familiar

22:24 Muki: from emacs

22:25 technomancy: Muki: yezzz

22:25 tomoj: appears to be caused by an update to swank-clojure.. hmm

22:26 Muki: OK but now suddenly, M-x slime doesn't work

22:26 it says "no match"

22:26 technomancy: tomoj: which lein version?

22:26 tomoj: 1.3.1

22:26 technomancy: Muki: that can't be related to your project.clj changes

22:27 tomoj: maybe my lein too old for swank-clojure 1.3.0-SNAPSHOT..?

22:27 technomancy: tomoj: shouldn't be; I'll try it

22:27 Muki: thanks, I'll investigate this :)

22:28 chaslemley: is there a way to delete clojars after you've uploaded them? I can't find a way

22:28 technomancy: tomoj: repro'd here; I'll take a look

22:29 chaslemley: is it urgent?

22:29 tomoj: https://gist.github.com/a2ee552212e236aedef1

22:29 oh, ok

22:29 chaslemley: nope, not urgent

22:29 technomancy: chaslemley: in that case try emailing clojars-mantainers: http://groups.google.com/group/clojars-maintainers

22:30 tomoj: wonder if I can tell maven to go back a snapshot..

22:30 chaslemley: thanks! i'll do that

22:30 defn: Why is the new fork/join stuff put in clojure.par? What does the par mean?

22:30 * defn smacks himself in the face and immediately realizes it's probably short for parallel

22:31 tomoj: I think it's 'paratrooper'

22:31 'parcheesi'

22:31 defn: heh

22:32 technomancy: parliamentary

22:32 defn: it was inspired by the work of chris parnell

22:32 and knowing how to use it means you're more likely than not a social *par*iah

22:33 tomoj: where's clojure.par anyway?

22:33 1.3.0-SNAPSHOT?

22:34 (er, or is it still -master-SNAPSHOT?)

22:35 defn: i think it's in master-SNAPSHOT

22:40 technomancy: tomoj: fixed; pushing

22:40 thanks for the catch

22:41 tomoj: oh, wow http://build.clojure.org/snapshots/org/clojure/clojure/1.3.0-alpha2-SNAPSHOT/

22:41 defn: technomancy: is *connections* permanently renamed?

22:41 it breaks cake swank and lein swank i think

22:41 technomancy: defn: not on purpose

22:41 defn: ah so that's being reverted?

22:42 technomancy: I am actually not sure what you mean. what broke?

22:42 defn: it might just be cake

22:42 but cake relies on *connections* as of right now, backwards compatibility will be a bit of a pain with the rename

22:42 technomancy: I just got a patch that un-broke clojure 1.3.0

22:43 defn: i mean it's not the end of the world, i think a small patch which does some try/catch and ns-refers magic should fix it

22:43 technomancy: but I didn't read through it carefully

22:43 you could probably move it back

22:43 as long as you run "lein multi test" to make sure it works with all versions

22:43 defn: i think you're right to change it given recent talk at the conj about the earmuffs convention

22:44 but i thought id mention it FWIW

22:44 technomancy: sure

22:46 Raynes: $mail cemerick You'll be proud to know that I am now the sole owner of a printer-scanner-copier multipurpose unit.

22:46 sexpbot: Message saved.

22:47 tomoj: hmm, how do I force lein to check for updates on swank-clojure?

22:48 or is it just that clojars needs to update some index?

22:50 defn: tomoj: blow away your .m2/swank-clojure

22:50 or rename it

22:51 that might be the rough way to do it, but as i understand it you may not get the latest unless you do this due to the jar being named essentially the same thing it was before the update today

22:52 swank-clojure "1.3.0-SNAPSHOT" : If you already have that hanging around I think you'll just get whatever old version of 1.3.0-SNAPSHOT you have lying in .m2/

22:52 tomoj: it got changed from -3.jar to -4.jar

22:52 defn: oh...no kidding?

22:52 tomoj: ah

22:53 "Adding a snapshot dependency to your project will cause Leiningen to actively go seek out the latest version of the dependency once a day when you run lein deps"

22:53 tonyl: hello

23:14 gigi`: hey guys

23:14 I have trouble installing clojure

23:14 I tried every tutorial out there

23:15 is anyone here willing to guide me through it?

23:15 amalloy: gigi`: what OS?

23:15 gigi`: os x

23:15 I have Emacs installed

23:15 and ELPA

23:15 aside from that I'm clean

23:16 hiredman: ping?

23:16 clojurebot: PONG!

23:16 gigi`: and I have clojure.jar and clojure-contrib.jar

23:16 amalloy: hm. i don't have a lot of experience with osx, but i can take a few guesses

23:16 tonyl: maybe a simple setup. run it as a java program.

23:17 gigi`: I'm guessing I should go for slime and slime-repl from ELPA

23:17 I already did that

23:17 amalloy: gigi`: swank-clojure from ELPA?

23:17 gigi`: I want it in my Emacs

23:17 swank-clojure is only 1.1

23:17 and it keeps erroring on me

23:17 on ELPA*

23:17 amalloy: mm, okay

23:17 have you tried leiningen self-install?

23:19 and also, do you have/can you get ruby gems? if so there's a very fast way to get a repl going

23:19 gigi`: ^^

23:20 gigi`: I do, but would rather not drag ruby into this :)

23:20 amalloy: one of the easiest and most popular ways to run clojure uses a ruby script; you don't have to, but it's convenient

23:20 http://dl.dropbox.com/u/5642669/Screenshots/repl_in_30_expanded.png if you want to give it a try

23:23 i also understand there's a package called cljr for macos, in whatever their package manager is. brew? macports? not sure

23:24 gigi`: thanks :)

23:25 amalloy: gigi`: let me know what works, or :( if nothing does

23:30 tomoj: you don't need swank-clojure from elpa

23:31 just install clojure-mode, slime, slime-repl, and then install leiningen (if you don't want cake), and follow the directions at http://github.com/technomancy/swank-clojure

23:31 `lein new foo` to create a new lein project in ./foo

23:32 or cljr will work too

23:37 gigi`: thanks tomoj, hopefully, that'll work

23:47 tomoj: heh

23:47 maybe bob martin should've studied a bit more before doing an evangelism talk?

23:51 trptcolin: maybe. but he's learning. let's be glad he's embracing clojure and helping other people to as well, right?

23:51 gigi`: tomoj, I followed your advice and when I use ELPA to install clojure-mode, paredit, slime and slime-repl I get the following errors http://pastebin.com/xSRxFanv

23:52 tomoj: well, remove paredit on elpa

23:52 this won't help with your error

23:52 but you want the beta

23:52 http://mumble.net/~campbell/emacs/paredit-beta.el

23:52 clojure mode will detect that you're using the latest and fix some things up for clojure

23:53 gigi`: so should I remove everything? or just paredit

23:53 tomoj: gigi`: ignore those errors

23:53 just remove paredit

23:53 then make sure it's gone from ~/.emacs.d/elpa

23:54 download that paredit-beta.el, save it somewhere as paredit.el, and add the directory to your load-path

23:54 gigi`: when I refresh elpa's package list it says that everything except slime-repl is installed

23:54 should I reinstall all of those?

23:55 tomoj: hmm

23:55 try just reinstalling slime-repl

23:55 errors during installation are normal

23:56 gigi`: I should probably restart emacs after adding the new paredit to my load-path

23:56 or?

23:57 tomoj: yeh :/

23:57 I dunno what else you would need to do to get clojure-mode to notice and fix stuff

Logging service provided by n01se.net