#clojure logs

2010-10-26

00:21sproustClojurians! I want to build the ultra-bleeding edge swank-clojure goodness.
00:22sproustHow do I proceed? The various leiningen commands (e.g. compile) don't appear to produce any jar goodness.
00:22amalloysproust: lein jar?
00:22amalloyor lein uberjar; i dunno how much swank-clojure needs
00:23sproustHa! Never mind, fixed. Takk
00:24sproustSo much goodness the Conj was!
00:27bhenrysproust: indeed!
00:30iveyamalloy: are you doing karma for sexpbot?
00:31amalloyivey: no firm plans. if i find some time i might. if you want to do it instead, feel free
00:31sproustAnyone has an idea when the videos will come out?
00:31iveyi think it'll need mongo, and i don't have that installed. so i'd have to do that.
00:31amalloyivey: i had to install mongo to test $ seen. it's not that bad on ubuntu
00:32iveymacosx 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.
00:32iveydon't know why i didn't go with ubuntu.
01:07amalloyivey: well, until pretty recently i was on windows. can't really take the moral high ground here
01:11bhenryivey brew install mongodb
01:11iveybhenry: yeah it was really that easy. my gentoo box is still chugging away though.
01:11iveyamalloy: i'll do karma.
01:12bhenryit takes a while to build.
01:12iveycouldn't figure out how to unmask spidermonkey
01:12ivey... there's something you don't say everyday
01:14ubiiivey: are you a ruby convert?
01:14iveyubii: yup
01:14iveyhow can you tell?
01:14amalloyubuntu has some issues with xulrunner.so - sounds like osx wins this round
01:15iveyamalloy: brew is just so awesome.
01:15defnNoSQL databases are awesome.
01:15amalloyivey: i'm very pleased with apt, since this is the first package that hasn't worked out of the box
01:15ubiithought I recognized your nick from one of the ruby channels
01:15iveyubii: ah. yeah I was on the merb core team, and i hang out in engineyard channels.
01:16ubiiyeah, I remember, back before merb joined (merged with) the dark side :)
01:18ubiislowing trying to make the transition from ruby to clojure
01:19amalloyubii: wimp. more fun if you do it quickly :)
01:19amalloy(not that i intend to go terribly fast when i try ruby)
01:20ubiiwell, ruby pays the bills right now, so that unfortunately is where my focus is :(
01:20iveyyou a contractor ubii, or FT somewhere
01:20ivey?
01:20clojurebot#<ClassCastException java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;>
01:21ubiifreelance consultant
01:21defnubii: did we meet at conj?
01:21rdeshpandeubii: funny, i'm in the exact same situation
01:21rdeshpandeubii: ruby paying the bills but learning clojure when im not on the clock
01:22ubiidefn: unfortunately, I was not able to make it to conj
01:22defnbummer
01:22tomojcan't believe I missed it :(
01:22ubiilooking forward to watch the videos when the come out
01:22ubiis/watch/watching
01:23ubiiivey: you still doing the consulting thing?
01:24iveyubii: i decided eating regularly wasn't so important, so I started a company
01:24iveyfinally freeing up some time to work on some open source stuff though
01:24ubiisorry, that is what I meant, I remember hearing about you starting one with a buddy or something
01:25iveyyeah, that's why i left merb core
01:25ubiirdeshpande: what type of ruby development do you do?
01:26rdeshpandeubii: almost entirely rails
01:26rdeshpandeivey: just curious - was there a lot of tension around the decision to merge with rails?
01:26ubiirdeshpande: hmm, haven't touched rails in years
01:26rdeshpandeivey: or was it mostly unanimous?
01:27iveysome. there's still a merb-core that is being maintained
01:27iveybut all the major players were on board
01:27rdeshpandeubii: what type of work are you doing?
01:29ubiirdeshpande: I primarily used IOWA as a web framework
01:29ubiiI think I represent 50% of the IOWA community, behind wyhaines :)
01:30rdeshpandecool
01:30ubiiIOWA predates rails and is a component-based web framework, unlike rails, which is MVC-based
01:31rdeshpanderight
01:31rdeshpandei'd heard about it but never looked into it
01:32jackdempseyfunny how things go. just shot myself in the foot with ruby and mutable state
01:32jackdempseyclojure's lookin nicer as the days go by
01:33ubiimost of the work that I do is building database-driven websites for financial clients, such as mutual fund firms
01:33ubiinot the most exiting, but it pays the bills
01:33rdeshpandeubii: you're not in NYC, are you?
01:34ubiinope, live in the midwest
01:34amalloyjackdempsey: 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
01:34rdeshpandeah ok
01:34rdeshpandei wonder why clojure is attracting so many ruby people
01:34jackdempseyamalloy: hehe sucks
01:35defnbecause ruby people aren't "comfortable" people, they've seen glimpses of lisp, they like to learn things
01:35defnthe list goes on
01:35jackdempseyrdeshpande: i think we're interested with new languages, but maybe are yearning for something a little more structured while maintaining elegance?
01:35ubiiI am very interested in digging more into clojure and the available associated web frameworks
01:35rdeshpandecompojure is really nice so far
01:35defnthere's not a single reason why anyone changes languages
01:35rdeshpandewhoever worked on labrepl did an excellent job too
01:35iveyrdeshpande: ruby is half-way to functional, and is a decent lisp without parens.
01:35rdeshpandetrue.
01:35iveyand a lot of people got to ruby vi smalltalk, directly or indirectly.
01:36defnruby is definitely not a lisp
01:36ubiiruby has never appealed to me like lisp and now clojure does
01:37iveydefn: http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp
01:37rdeshpandeim attracted by the greater probability for correctness
01:38jackdempseyrich also seems sharp as hell, and i like looking into what smart people are doing
01:38albinodoesn't a language need hygienic macros to be considered a lisp?
01:39defnivey: is ruby homoiconic?
01:40iveydefn: no, which is the biggest reason it's not truly a Lisp. you can get a decent AST though
01:40defnivey: i wont belabor the point -- but there are more reasons than that listed in the comments on the link you just posted
01:40iveythe point is, a lot of what makes lisp exciting works in ruby. it's a gateway drug.
01:40defnivey: sure, i just wouldn't make the jump to calling it a lisp
01:41ubiiwell, it isn't doing much for me lately, which is why I am jonesing for clojure :)
01:43amalloyfor me (a java expat) clojure has all the lispy features i loved discovering in CL but isn't such a pain to work with
01:48iveyanother reason: lots of ruby devs are rediscovering traditional editors, and at least half are going emacs. so they're learning elisp. another gateway drug.
01:49rdeshpandeivey: ive actually used vim for the last 10 years but im giving emacs a try
01:50rdeshpandeslime was much easier to get running than vimclojure, and i figure if the configs are in lisp then what the hell
01:51jackdempseyrdeshpande: good luck to you. i don't think i could go back to emacs
01:51jackdempseybut yea vimclojure is kinda eh
01:51rdeshpandejackdempsey: you went from emacs -> vim?
01:51jackdempseypico -> emacs -> textmate -> vim
01:52ubiiivey: just curious, is there a clojure web framework similar Sinatra, which is well suited for building light-weight web APIs
01:52LKkk#java is invite only :(
01:52rdeshpandeubii: compojure
01:52ubiiwait, going from emacs to vim, isn't that a step backwards? :)
01:53jackdempseyhehe
01:53jackdempseytrust me, i thought i'd never make that choice. but, it surprisingly fit me
01:53defnubii: moustache
01:53defnubii: http://github.com/cgrand/moustache
01:54rdeshpandeahh, moustache looks even more fitting
01:54ubiithx, I will check it out
01:54defnnp
01:54amalloyclojurebot: moustache?
01:54clojurebotNo entiendo
01:54amalloyclojurebot: moustache is http://github.com/cgrand/moustache
01:54clojurebotAlles klar
01:56ubiiI 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
01:56defnubii: give it a whack with enlive/hiccup and moustache
01:57ubiienlive and hiccup are html templating libraries, correct?
01:59defnyeah
02:00ivey_offgentoo on a 256M slice is a terrible idea
02:01ubiihad one for awhile, then for some reason went with Arch
02:02bytesource 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.
02:02zkimhey 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
02:06amalloyzkim: a step on installing gem?
02:07amalloyotherwise i have to say it's well-written and i like the tone
02:08zkimamalloy: 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?
02:08amalloyi didn't :P
02:08zkimhehe
02:08amalloybut then, i started with lein
02:09zkimhrm
02:09zkimI'm just thinking about how far back to go
02:09iveydefn: karma is channel-specific?
02:09zkimso no gem, what about ruby?
02:09iveyor bot specific?
02:10ubiiwell, 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 :)
02:10zkimubii: hah
02:11ubiisorry, was just being a smarta$$
02:13zkimamalloy: what about the script install method of cake? side step the whole gem problem.
02:13amalloyi dunno, i haven't tried that method
02:15zkimamalloy: cool, well thanks for the feedback, as far as the tone I was going for a ruby / fantom homepage kind of feel
02:27replacazkim: hmmm, but if somebody is super new they may not know "REPL"
02:31zkimreplaca: 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'
02:32zkimI'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
02:33zkimreplaca: 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?
02:44replacazkim: oh, I was just think of adding (command prompt) or some such
02:44replacaotherwise it looks great
02:45zkimah
02:48zkimreplaca: yeah good point, how bout linking REPL to the wikipedia article or some clojure page describing the REPL?
02:56replacazkim: hmmm, i'm just thinking of text on the button so they know when they want to press it
02:57replacaI 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
02:59replacazkim: like if I saw a button that said "GLRX in 30 seconds" the only reason I'd press it is curiosity
02:59zkimreplaca: I see, that makes sense
02:59zkimreplaca: How about: New to Clojure? Get started in 30 seconds.
03:00replacanow you're cookin'!
03:00zkimRun code in 30 seconds.
03:00zkimhmmm
03:00replacayeah, something like one of those "Get running in 30 seconds" ...
03:00replacasomething along those lines
03:00zkimreplaca: cool, specific copy's still in flux but the idea's in there
03:01zkimreplaca: thanks
03:01replacazkim: np
03:13replacafinally closing the 40 open emacs buffer relating to my conj preso - time to move on!
03:15angermanhow do i turn a hash-map into a sorted map?
03:18replacaangerman: (into (sorted-map) {:b 1 :c 2})
03:28zkimreplaca: hope it came out well on the video, first I had heard of fill-queue and I'm sure I missed some other gems
03:29replacazkim: we'll see. It was difficult to hear how well I was getting the microphone. Could you hear me OK way in the back?
03:30zkimreplaca: yeah, no problems from where I was sitting
03:30replacazkim: cool, glad to hear it :) (pun intended!)
03:30zkimreplaca: heh
04:00TobiasRaedermorning everybody
04:00AWizzArdHoi Tobi
04:48angermanHmm... why does amap not hand me the element fro the array?
05:11angermanhow do i typehint aset?
05:11angermanthe one in amap?
05:11Chousukeyou can use ^objects
05:12Chousukeor ^ints or whatever.
05:12angermanI'm tying ^ints
05:12angermanbut I keep getting the reflection warning.
05:13Chousukehm :/
05:13Chousukeare you also using (int ...) with the index and element?
05:17angermanhttp://gist.github.com/646584
05:17angermanthat's what I'm tying to do.
05:17angermanand It tells me that the call to aset cannot be resolved.
05:23angermanthat macro is a copy from the clojure source
05:24angermanI just made using an expression being feed the value from the array
05:24angermanthe one in the clojure source just evaluates the expression but doesn't feed it the value from the source array
05:26angermanI now went around the macro.
05:26angermanit's kind of weird though that I cannot get that aset reflection out :/
06:14_na_ka_na_ /msg NickServ identify qazzaq
06:25Sweetshark_na_ka_na_: you better change you password asap
06:26_na_ka_na_sad .. i thot my msg wouldn't have been sent coz I'm not identified.. perils of changing irc clients
07:42fliebelmorning
07:43micryptHi, I'm getting a rather odd error... is there a syntax for marking a function as "public" in a separate file?
07:43fliebelStill 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?
07:45fliebelmicrypt: 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.
07:52micryptfliebel: 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
07:53fliebelmicrypt: I don't understand what you're doing. You're doing (defn a [] (defn b []))?
07:54fliebelSolution to my problem btw: (last (take-while identity (iterate z/up *1)))
07:57micryptfliebel: 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 ...)).
07:57micryptfliebel: ...and it blew up.
07:59fliebelmicrypt: Simplify the problem until only one thing is left to go wrong. Get on the repl and try requiring it there.
08:00micryptfliebel: It works in the repl. That's where I got properly puzzled.
08:02fliebelmicrypt: 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 :(
08:04fliebele.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.
08:04fliebel*its
08:04micryptfliebel: I do have both (ns nsa (:use nsb)) and then (ns nsb (:use nsa)) in each file.
08:04micryptfliebel: Okay, sounds like that might be it.
08:05fliebelmicrypt: Right, that doesn't work. Make an nsc that is required by both instead ;)
08:05micryptfliebel: Thanks a lot. :)
08:09l_a_mhi
08:10l_a_msomeone use clojure on GAE ?
08:13mrBlissis there something like (Class/forName ..) that works with "java.lang.Integer" AND "java.lang.integer" (Note the lower case i in integer)?
08:13bobo_l_a_m: ive done some small things
08:20l_a_mbobo_: great
08:20l_a_mbobo_: i've got a method to initialize database
08:21l_a_mbobo_: how can i do to call this method on website startup ? when i deploy a new version
08:21l_a_mbobo_: only once
08:21mrBlissl_a_m: defonce?
08:22l_a_mmrBliss: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/defonce
08:23l_a_m?
08:23l_a_mmrBliss: like that : (defonce server (run-jetty (var handler) {:port 8080}))
08:23mrBlissyeah
08:23mrBlissI don't know how you're gonna initialize your db
08:25bobo_l_a_m: did you look at the libraries for gae? there are some helper stuff there i belive
08:25l_a_mmrBliss: (init-db)
08:25bobo_and yes, defonce sounds like a good way to do it
08:25mrBlissl_a_m: does it return anything?
08:25l_a_mmrBliss: no
08:27mrBlissrandom idea: (defonce db-ready? (do (init-db) true))
08:33fliebelI 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?
08:34mrBlissfliebel: correct: clojure.contrib.core/-?>
08:34fliebelmrBliss: Thanks :)
08:38l_a_mmrBliss: thanks
08:38l_a_mmrBliss: works fine
08:39mrBlissnp
08:44fliebelWhy isn't there prepend-child in clojure.zip?
09:14alexykg'morning clojurers!
09:16alexykI 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
09:21mrBlissalexyk: maybe something like (defn tokyo-read-reps [db-pathname & [proto str-load?] :as db-args] (let..
09:21mrBliss
09:21alexykmrBliss: nice
09:21alexykmrBliss: awesome, it both ensures I get the right amount of arguments and gives me a shortcut to pass along
09:26alexykdysinger: why are you loading stuff into couchdb when mongo is 1000x faster and distributed too?
09:37raek,(fn [db-pathname & [proto str-load?] :as db-args] nil)
09:37raek->(fn [db-pathname & [proto str-load?] :as db-args] nil)
09:37sexpbotjava.lang.Exception: Unsupported binding form: :as
09:38chouser[proto str-load? :as db-args]
09:38raekyou cannot use :as at the "top level" of a parameter list
09:38raekalso, if you have a & args parameter, the function takes any number of extra arguments
09:39raek->((fn [a & [b c :as d]] {:a a, :b b, :c c, :d d}) 0 1 2 3 4)
09:39sexpbot⟹ {:d (1 2 3 4), :c 2, :b 1, :a 0}
09:39alexyk:(
09:40alexykraek: the idea is to call tokyo-open with as little copying of top-level args as possible
09:41alexykchouser: so you mean (tokyo-open db-pathname db-args) right?
09:41raekalexyk: it is common to do something like this: (defn foo ([x] (foo x 1)) ([x y] (foo x y 2)) ([x y z] ...))
09:42raekthat way, the function only has the arities you specify
09:42alexykraek: ok
09:44raekin some situation, you could do someting like (defn bar [& args] ... (apply foo args) ...)
09:44alexykraek: yeah, was thinking of that, but need at least the first argument
09:44raekif you just want to pass all the arguments as-is to the other fn
09:47_fogus_To help with the new Clojure wiki... http://code.google.com/p/confluence-el/ Confluence mode for Emacs.
09:50TobiasRaedercan anyone explain me the use of identity? i dont seem to understand why id use it
09:51hugodvic!@123!
09:52mefestoTobiasRaeder: 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
09:52ivey_fogus_: do you know if that's in elpa?
09:52TobiasRaeder@mefest ah, makes sense. thank you
09:53_fogus_ivey: I do not use ELPA, so I do not know. Sorry
09:55jweisssome 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
09:55jweisss/some/someone
09:59fliebelHow 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:00s450r1jweiss: I think it was Stuart Halloway, too. I bet you can email him.
10:00jweisss450r1: i don't know where to find his email address. checked the thinkrelevance website but couldn't find there
10:01baoistfliebel: wouldn't regex work?
10:02jweisss450r1: i think i found it - google confirms my guess :)
10:03raekfliebel: can it be all possible clojure numeric types, or just doubles?
10:03s450r1jweiss: great... I just found one in a github README :-)
10:03fliebelraek: anything that is commonly considerd a number, so probably no need to find ratios ;)
10:04raekI guess you could decide to use one specific type (for example BigDecimal), or use the clojure reader
10:06fliebelraek: So something like (number? (read-string "123.4"))
10:59duncanmis there a list of clojure base protocols?
11:02duncanmwhich protocol should i extend if I want it to be Comparable?
11:04cbergHi! Can anybody tell me how to open a resource from the classpath using clojure-contrib.io/reader?
11:07duncanmcberg: you might want to use clojure.java.io instead, i think that's the new name of the library
11:11cbergduncanm: Thanks. I guess I need to take a closer look at the changes introduced with 1.2...
11:12cbergI see they no longer mention reading resources from the classpath in the docstring.
11:22cemerickduncanm: Comparable is a java interface, not a protocol.
11:23jondistadgoodmike_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:26jondistadthe 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:26kotarakjondistad: why different build tools? Isn't maven enough?
11:27jondistadkotrak: i'm not in a position to make that decision ;) but i think the answer is going to be no
11:27goodmike_mhFYI, 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:28jondistadkotarak: granted, most things can run on maven's back, which simplifies things a bit
11:28cemerickjondistad: I was planning on posting a msg to the dev list with my thoughts later today
11:28goodmike_mhStu proposed using "pom.xml as the data of record"
11:29cemerickPerhaps you guys have it well in hand though :-)
11:29kotarak"data of record"?
11:29cemerickgoodmike_mh: all that really means is that you can use the pom for deployment purposes.
11:29goodmike_mhRight.
11:30goodmike_mhMultiple tools "are capable of producing/consuming this as necessary."
11:30kotarakHmm, I would expect to use one build tool (whatever it may be) across all contrib should simplify things.
11:30goodmike_mhIn particular, we want to reach out to library authors.
11:30jondistadkotarak: it'll almost definitely be maven on the back end
11:31jondistadmeaning in hudson
11:31jondistadand requiring a pom.xml reinforces that
11:31kotarakjondistad: then why something else at the "front end"?
11:31goodmike_mhIt looks like chouser and fogus are here: your libraries, and cemerick's, were mentioned in our call with Stu.
11:32cemerickkotarak: presumably, we won't be able to pry lein out of some people's hands, etc.
11:32kotarakcemerick: pff... Then I want gradle, Lau wants cake, ....
11:32goodmike_mhcan't we all just get along?
11:32cemerickoy
11:32goodmike_mh:-)
11:33jondistadkotarak: personally, i'll likely use leiningen and have it generate a pom for official builds
11:33kotarakgoodmike_mh: sure. Just asking silly questions, which was jondistads intent, I believe. ;)
11:33cemerickgoodmike_mh, jondistad: you guys are with relevance?
11:33goodmike_mhyes
11:33jondistadkotarak: but i don't mind making the extra effort to peronalize my experience when i work locally
11:34cemerickjondistad: The result of `lein pom` is not sufficient to drive a build
11:34jondistadyeah, i'll have to edit it
11:34kotarakjondistad: re clojars: at the moment things are at build.clojure.org/snapshots etc. Why change that? Or something more "official" like maven central?
11:34vibrantsooo...
11:35vibrantnormally 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:35jondistadkotarak: it probably won't change, unless we discover a reason it needs to
11:36jondistadkotarak: this is all brainstorming at the moment
11:36nickikhow can i make lein use /src/<WhatEverIWant>/<src files>/ instead of /src/<project name>/<src files>?
11:39raeknickik: 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:41raekvibrant: in clojure, you tend to do as much as possible without types
11:41vibrantraek; yeah reading multimethods documentation now
11:41raeka good start would simply be to put everyting in maps
11:41nickikraek: thx, kind of obvious if I would start thinking
11:44vibrantraek; so the elite way to do it is with defrecord?
11:44kotarakvibrant: yes
11:44vibrantcan you suggest the best book about programming clojure?
11:44raekrecords could be seen as typed maps
11:44kotarakvibrant: then you might want to investigate protocols and multimethods
11:45raekthey are primarily used when you need dynamic dispatch on type
11:45vibrantraek; 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:45raekyes
11:46kotarakvibrant: see function "type"
11:46duncanmcemerick: 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:47cemerickduncanm: implement Comparable in your defrecord
11:47duncanmcemerick: don't i do that with extend-type?
11:47kotarakcemerick: btw, is there a possibility to start a durable repl session in nREPL?
11:47chouseror provide a comparator to your sorted-map-by that makes sense for your records
11:48cemerickduncanm: you do it in your original defrecord declaration, not via extend-type; check out the docs :-)
11:48cemerickkotarak: define "durable"?
11:48kotarakcemerick: between connections.
11:48cemerickkotarak: so that current ns, *1, *2, *e, etc are persisted across JVM runs?
11:49duncanmcemerick: ah, right
11:49dpritchetthaving a fun time trying to connect to swank on my new prgrmr.com slice
11:49kotarakcemerick: not JVM runs, but connections to the system.
11:49cemerickoh, I see.
11:49dpritchettanyone here a customer?
11:49kotarakcemerick: I send a command, get things back, close connection, reconnect, send a command, ...
11:49cemerickkotarak: not possible now; perhaps a reasonable enhancement though
11:50cemerickkotarak: are you using nrepl already?
11:50kotarakcemerick: well, a necessary one I would think. How do you want to provide a continuous repl session otherwise?
11:50kotarakcemerick: I working on it.
11:50kotarakcemerick: there are some obstacles. Mainly missing client on Windows.
11:50cemerickkotarak: most other clients don't disconnect frequently. :-)
11:51cemerickmissing client?
11:51kotarakcemerick: ?? How can they be continous connection eg. via a mq?
11:51kotarakcemerick: program I invoke to send stuff to the network socket.
11:51cemerickah, well, nrepl isn't using a broker at the moment
11:51kotarakread: netcat
11:52kotarakcemerick: yes. I know. But wasn't that a long-term goal to make at least available?
11:53cemerickDefinitely. I just wasn't planning on talking about persistent connections, as you put it, until that was seriously in the works.
11:53cemerickThat said, let me look at it, and I'll see what can be done in socket-land.
11:53kotarakAh. Ok. Well. I'll need it before. ;P
11:53cemerickIndeed. As will textmate, and similar.
11:55kotarakcemerick: 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:56cemerickNo, certainly not difficult. I'm not going to make it the default across the board, though.
11:56kotarakcemerick: No. I'd thought about some command to specifically request such a session and then also one to stop it again.
11:57cemerickkotarak: can you retain an opaque connection ID between evaluations/connections?
11:57kotarakcemerick: 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:58kotarak"repl" "the-generated-id-whatever-it-may-look-like"
11:58cemerickSure. Yes, I'll add that sometime this week.
11:59kotarakcemerick: cool :)
11:59cemerickalso, an :ns arg on requests, to specify which namespace to eval the associated code in
12:00kotarakcemerick: yes. that saves thousands of explicit in-ns's...
12:05alpheus`Are there any tools that can help me track down the cause of a java.lang.OutOfMemoryError?
12:07chouseralpheus`: jvisuamvm should do nicely
12:08dnolenhttps://visualvm.dev.java.net/
12:09alpheus`thanks, and chouser, I'm bummed I couldn't figure out how to sign my digital copy of joy of clojure
12:10drewrdoes visualvm do anything more than jconsole?
12:13dnolendrewr: never used jconsole, but visualvm has a nice ui and is really easy to understand.
12:13Raynesdrewr: I don't think you can profile in jconsole.
12:13RaynesYou can in visualvm.
12:14Raynes$learn jvisualvm https://visualvm.dev.java.net/
12:14sexpbotMy memory is more powerful than M-x butterfly. I wont forget it.
12:27alpheus`Does visualvm take a long time calibrating? All I get is a blank grey window.
12:29abrenkalpheus`: Are you on linux with e.g. awesome as window manager? Then see https://bbs.archlinux.org/viewtopic.php?pid=497161
12:30alpheus`linux/xmonad, yes
12:30abrenkalpheus`: then you need to run "AWT_TOOLKIT=MToolkit jvisualvm"
12:32alpheus`perfect, thanks
12:53dpritchettwoo! properly tunneled into `lein swank` on my xen slice!
13:00iveydefn: ping
13:01dpritchettlooks like my 60-second function is still executing 10 minutes later. maybe there's something i don't know about tunneling into swank
13:11SweetsharkHi all, is there a way to run multiple clojure RTs in one jvm? or to have completely different scopes?
13:12cemerickSweetshark: no, reified environments aren't possible
13:12cemerickthe question is, why do you need them?
13:13Sweetsharkcemerick: is it possible to completely reset the clojure jvm?
13:13defnivey: PONG
13:13Sweetsharks/jvm/RT/
13:13sexpbot<Sweetshark> cemerick: is it possible to completely reset the clojure RT?
13:14cemerickSweetshark: You can ns-unmap everything in all namespaces
13:14iveydefn: thoughts on sexpbot karma...per-channel, or per-server? I went per-channel, but wanted another opinion.
13:14defnabsolutely per channel
13:14cemerickbut that doesn't impact e.g. stuff that's running on various threads
13:14cemerickSweetshark: why do you want to reset the runtime?
13:14iveyk. in that case, Raynes has a pull request ready to go
13:14defnivey: nice! well done, sir.
13:14Sweetsharkcemerick: 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:14Raynesivey: It needs to be per-server as well.
13:14chouserreally, the clojure runtime is the JVM runtime. can you completely reset the JVM?
13:15defnivey: if you want another fun one you could build a little markov :)
13:15iveydefn: http://github.com/Raynes/sexpbot/pull/20 in case you're interested
13:15defnRaynes: why's that?
13:15iveyRaynes: it is.
13:15Raynesdefn: So that george on freenode and george on ninthbit don't have the same amount of karma.
13:15iveyit's nick, server, channel
13:15iveyas the key
13:15defn*nod*
13:15RaynesIn that case, excellent work. I'll pull it in in a little while.
13:16defnivey: i like the deref reader macro to get karma
13:16Raynesdefn: That's the prefix, actually.
13:17RaynesIt'll be $karma in the running bot.
13:17Raynessexpbot's default prefix is @, so that's what he used in his testing.
13:18defnRaynes: ah i see
13:18cemerickSweetshark: 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:19RaynesI'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:19defnRaynes: i didn't see you out at Stuart's -- thought you were coming to the BBQ
13:19cemerickSweetshark: 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:19iveyRaynes: good idea
13:20dpritchettis swank-clojure particularly bandwidth-heavy?
13:20Raynesdefn: 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:21defnchouser: http://github.com/jarpiain/cljc
13:21Sweetsharkcemerick: 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:26kotarakAny pointers to 1.3 optimisation hints?
13:26chouserdefn: huh.
13:26cemerickSweetshark: 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:26cemerickOf course, that script can just as easily have an in-ns form, and cause havoc.
13:27cemerickI'd check out the sandboxes in the irc bots for tips in this area.
13:27cemerick,(in-ns 'blahlbah)
13:27cemerick->(in-ns 'blahblah)
13:27sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/in-ns)
13:27cemerickSweetshark: ^^
13:27cemerickclojurebot: ping?
13:27ohpauleezkotarak: I think if you just look at the wiki certain things are obvious, but I don't know about deep internals
13:28ohpauleezuse primitives and primitive support, protocols where appropriate, don't be dynamic is you don't have to be
13:28Sweetsharkcemerick: 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:28Sweetsharkcemerick: sandboxing sounds interesting ...
13:28cemerickSweetshark: right, see Namespace.remove (doesn't look like there's a clojure fn that correspond to it, but no matter)
13:29kotarakohpauleez: you mean this? http://dev.clojure.org/display/doc/Enhanced+Primitive+Support
13:29Chousukens-unmap?
13:29cemerickChousuke: he wants to have untrusted scripts running in a temp ns.
13:29cemerickThe nuclear option seems warranted.
13:30Chousukehm, right.
13:30ohpauleezkotarak: http://dev.clojure.org/display/design/Home
13:30ohpauleezsome of these have made it in, others are being designed
13:30defnzkim: you around?
13:31defnchouser: like "huh." or "huh?"
13:31dpritchettany 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:31dpritchettwhoops wrong paste
13:31zkimdefn: yeah, what's up?
13:31dpritchetti meant this function: http://github.com/dpritchett/euler-clj/blob/master/src/euler_clj/core.clj#L360
13:31ohpauleezkotarak: also the link you posted is good
13:31defnzkim: im getting some complaining from clojuredocs on rake db:migrate
13:32dpritchettmaybe it's a RAM thing? My local dev vm has double the memory of my slice
13:32zkimdefn: pm me, we'll get it figured out
13:32defnkk
13:33duncanmwhen i filter a map, i don't get back a map, do i? i get back a seq!
13:33ohpauleezkotarak: Except the :static doesn't exist anymore
13:33kotarakohpauleez: I was just about to write that. :)
13:33Chousukehm.
13:33Chousukedoes clojure.org link to dev.clojure.org? :/
13:33nickikduncanm: a map implements seq but yes its true you get vectors of key value
13:35duncanmand select-keys / dissoc are opposites, right? like filter and remove
13:36hiredmannickik: maps don't implement seq
13:36hiredmanyou can get a seq over a map
13:37nickiknot? but sequencable?
13:37cemerickSweetshark: godspeed, man :-D
13:38cemerickPresumably, you shouldn't need more than the sandboxes defined in either of the bots. I can't imagine they're not properly reusable.
13:38hiredmannickik: you can call seq on a map
13:38Raynesivey: Do you intend to add those commands? I can do it myself if you don't want to. Just wondering before I pull.
13:39iveyRaynes: I can but not until tonight
13:39iveyup to you
13:39RaynesNo hurry.
13:39RaynesI wouldn't get it done any faster.
13:41duncanmis there a reason why Maps need to have select-keys/dissoc, and not polymorphicly use filter/remove?
13:42chouserthe contract of filter/remove is that they return lazy seqs
13:42dpritchetthas anyone successfully run clojure in a 256mb ubuntu instance?
13:42dpritchetti'm completely at a loss for where to start looking for RAM improvements
13:42dpritchettmaybe i shouldn't have gone for a 64-bit install
13:43hiredmanon osx I've never got the jvm to use less then 60mb
13:43Raynesdpritchett: 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:43dnolendpritchett: I had some basic compojure stuff running on a 256mb slice and I didn't have too many problems.
13:44dpritchettin my case it was a memoized collatz function from project euler
13:44dpritchettcould store up to 1,000,000 values, but small ones
13:44dnolendpritchett: oh you're running euler stuff on a 256mb slice, to what purpose ? :)
13:45dpritchettdnolen: 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:45dpritchettlooks like the combination of 64-bit ubuntu and 256 mb of ram was a bad idea
13:45dpritchettmy dev VMs are 32-bit ubuntu with 512mb ram
13:46dpritchetti had hoped to build an app on aleph eventually, i just wanted to kick the tires first
13:46dpritchetti guess euler #14 kicks too hard
13:47dnolendpritchett: 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:48dpritchetti am doing a loop-recur accumulator that checks against my memoized "what's the solution at f(x)" test function
13:48dpritchettah well
13:48dpritchetti'm gonna reinstall 32bit ubuntu and then quit trying euler on this thing
13:49dpritchettproject euler is the only thing i've written more than 10 lines of clojure for so it was my go-to test
13:51dpritchettthanks dnolen, i plan to visit your posterous blog when i get more into aleph
13:52goodmike_mhdpritchett: Good luck with Project Euler!
13:52dnolendpritchett: 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:52dnolendpritchett: aleph's wiki docs are now quite good.
13:53dpritchettdnolen: 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:53dnolendpritchett: yeah in fact I think it's ridiculously simple. the whole channels seq thing is too cool.
14:03Raynesamalloy: I commented on that pull request with a suggestion.
14:03amalloyyeah, just saw it
14:04Raynesamalloy: If it does work, you can go ahead and nuke the commented out version.
14:04amalloyRaynes: 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:05Raynesamalloy: What about some?
14:06Raynessome should work, and would avoid unnecessary computation.
14:06dpritchettso 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:06dpritchetti see two java processes at any rate
14:06amalloyRaynes: some will return the first matching thing, and you want the last one, right?
14:11Raynesamalloy: If I stop talking, it probably means the power went out. Serious severe weather event commencing.
14:11Raynesamalloy: I'm trying to remember exactly how nil-comp works.
14:12amalloyi think the best fully-lazy version involves (last (take-while identity))
14:12amalloyRaynes: it's just (comp) but short-circuiting on the first false result
14:14Raynesamalloy: Right. Either way, I definitely want to avoid unnecessary computation.
14:15amalloyRaynes: really? it's not actually calling the functions, just scanning through them
14:15Raynesamalloy: I'm not opposed to the (last (for ..)) idea.
14:15RaynesYou could, of course, use take-while and map.
14:15amalloyRaynes: map is tricky because what value to pass into map depends on the previous computation
14:16amalloyi'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:17RaynesI 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:17RaynesI'm content with this reduce version, however.
14:18RaynesI'm just saying: if you can think of a way to do it lazily, jump on it.
14:18amalloyokay
14:19amalloythere'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:21Raynesamalloy: for with :while and :let might do the trick.
14:22RaynesActually, it wouldn't.
14:22RaynesI keep forgetting that you have to maintain the previous result.
14:22amalloyyeah
14:22RaynesThat's what makes it complicated.
14:23amalloyi think nil-comp already exists in the standard library and you just want to map fns into closures around the constant data
14:35amalloyotoh, actually creating a nil-safe function would involve a reduce on the fn list anyway, so it wouldn't be any better
14:37Raynesamalloy: We'll just leave it the way it us for now. As long as it works, it isn't that important.
14:39amalloyRaynes: 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:42Raynesamalloy: It's a crucial part of on-send-message hooking. The mute plugin is a relevant usage case.
14:50amalloyRaynes: 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:53LOPPa
14:54nickikb
14:56Raynesamalloy: Look in the :users key in the configuration.
14:57amalloyah
14:59Raynesamalloy: 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:59LOPPso why is the channel #java invite only?
15:00LOPPdo they have secret arcane knowledge they don't want us to have? :D
15:02amalloyLOPP: try ##java?
15:02amalloyit seems to be open, and as full of idiots as you could hope
15:03LOPP##java: Cannot join channel (+r) - you need to be identified with services
15:03LOPPwhat's that
15:03amalloyhave you registered your nick?
15:03LOPPno
15:03LOPPhow do I do that?
15:03nDuffLOPP, read the message the IRC server provided when you first connected.
15:04nDuffLOPP, alternately, /msg NickServ HELP
15:04amalloyRaynes: i don't think mute is working, but i'm not sure i have the syntax right
15:04nDuffLOPP, alternately, /join #freenode and ask there.
15:04amalloyis it just @mute?
15:11cpfrhey I have a private function in a java class I really need to access
15:11cpfrwhat's the least painful way to do this
15:12amalloycpfr: um, don't? or make the method non-private?
15:12Raynesamalloy: @mute should do it.
15:13cpframalloy, not my java class
15:13RaynesIt should just mute the channel you're in.
15:13amalloyRaynes: and after @mute he should never say anything, incl reponses to eg @ping?
15:13TheAnimalThen you are screwed
15:14RaynesWhy would you ever want to access a private method?
15:14amalloycpfr: 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:15hiredmanping?
15:15cpframalloy, this is a function that builds a dictionary. it isn't available anywhere else
15:16raekcpfr: http://clojuredocs.org/clojure_contrib/clojure.contrib.reflect/call-method
15:17RaynesSeems like the power is about to go byebye.
15:17amalloycpfr: (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:17raekbe aware that your code could break without any notice
15:21cpframalloy, since I want to do this all from clojure
15:21cpfrhttp://opennlp.sourceforge.net/api/opennlp/tools/parser/AbstractBottomUpParser.html#buildDictionary(opennlp.tools.util.ObjectStream, opennlp.tools.parser.HeadRules, int)
15:22cpfrraek, what would make it break?
15:22amalloycpfr: private methods are subject to change at any time, because nobody is suppoed to be using them
15:22RaynesIt'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:23RaynesPeople make methods private for the purpose of keeping people from using them.
15:23cpframalloy, I am well aware of the risks
15:23angermanhmmm.... I guess I need to do some optimizations. 15min is not close enough to real time
15:23RaynesNot to just annoy users. :p
15:23cpfrI have already commented that this is hacky
15:24cpfrand it looks like in the latest version the library makes the method public
15:24amalloycpfr: what's wrong with the static version?
15:24cpfrin my version its private static
15:24amalloyRaynes: i learned something funny from java. the month after december is named undecimber
15:25Raynesamalloy: :>
15:26amalloybecause apparently some lunar calendars usually have 12 months, but occasionally 13
15:26TheAnimalif you want to access private method then decompile the class and copy the code into your own method
15:26amalloythere's even a duodecember for month 14, but java doesn't support that :(
15:30Raynesamalloy: I'm going to run for a little while. Tornado warning for my county.
15:31amalloy*shudder* tornados. glad i'm on the west coast; those guys are scary
15:52a_strange_guyhi, clojurians
15:53a_strange_guydoes anyone build the latest clojure-contrib master against thelatest clojure master?
15:56tonylafternoon
15:57drewrsk
15:57drewrwhoops, launchbar invocation e_fail
15:58tonyl:P
16:25LOPPwhat's the difference between ' and #'
16:26tonyl' 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:27nDuff(as documented at http://clojure.org/reader)
16:28ohpauleez_na_ka_na_: You can probably use zipmap
16:28tonylnDuff: exactly
16:28_na_ka_na_i found (into {} (java.util.HashMap.)) works :)
16:28quollanyone here familiar with setting up Aquamacs to work with Clojure?
16:29ohpauleez_na_ka_na_: Ah, cool
16:29_na_ka_na_,(into {} (java.util.HashMap.))
16:29clojurebot{}
16:29drewr_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_na_ka_na_,(assoc (java.util.HashMap.) :id 10)
16:30clojurebotjava.lang.ClassCastException: java.util.HashMap cannot be cast to clojure.lang.Associative
16:30ohpauleez_na_ka_na_: it will, see drewr's comment
16:30_na_ka_na_drewr: ^^
16:30_na_ka_na_,(assoc (into {} (java.util.HashMap.)) :id 10)
16:30clojurebot{:id 10}
16:30ohpauleezit's implemented on top of HashMap, is what he's saying
16:30drewr_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_na_ka_na_now after getting that I want to assoc things to it the clojure way
16:31drewrsure, then into should be fine
16:32_na_ka_na_cool
16:33drewrif you need to give a lib a Map, you can use the POCO PersistentHashMap
16:37vibranti'm wondering how to store all those maps
16:39technomancyrolling 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:41KirinDaveIs there a way to tell if something will respond to a deref message?
16:41KirinDaveerr, or rather be invoked by deref properlt
16:41KirinDaveI have something coming into a function which may or may not be deref-able.
16:41amalloy,(instance? clojure.lang.IDeref (atom 0))
16:41clojurebottrue
16:41amalloy,(instance? clojure.lang.IDeref [])
16:41clojurebotfalse
16:41ohpauleez_na_ka_na_: {} is implemented on top of Map
16:41KirinDaveWell
16:41KirinDaveYeah, dude.
16:41KirinDaveBut..
16:41ohpauleez,(.isEmpty {})
16:41clojurebottrue
16:42amalloyKirinDave: you want something nicer?
16:42KirinDaveamalloy: I suppose.
16:43drewr_na_ka_na_: that's what I was saying with my comment about PersistentHashMap (it extends APersistenMap which implements j.u.Map)
16:44drewr,(->> clojure.lang.PersistentHashMap supers (some #{java.util.Map}))
16:44clojurebotjava.util.Map
16:45amalloydrewr: 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_na_ka_na_,(instance? java.util.Map {})
16:46amalloy_na_ka_na_: right, cause j.u.Map doesn't implement PersistentMap
16:46clojurebottrue
16:47_na_ka_na_amalloy: too bad I need to (into {}) it then .. wasting CPU cycles
16:47pjstadig,(get (doto (java.util.HashMap.) (.put :a :b)) :a)
16:47clojurebot:b
16:47pjstadigyou can get and seq and do all kinds of stuff
16:47pjstadigit's not persistent though, so you can't add to it with assoc
16:47drewramalloy: sure, just pasted what I had in my repl
16:48_na_ka_na_pjstadig: yes exactly
16:48pjstadigif you want persistent, then you have to into it
16:49duncanmin 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:50duncanmlike, (let [{k v} {:a 1}] (println k v)) doesn't seem to work
16:50duncanm,(let [{k v} {:a 1}] (println k v))
16:50clojurebotjava.lang.Exception: Unable to resolve symbol: v in this context
16:50duncanmhmm
16:50jarpiain,(let [[k v] {:a 1}] [k v])
16:50clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap
16:50jarpiain,(let [[k v] (seq {:a 1})] [k v])
16:50clojurebot[[:a 1] nil]
16:51duncanmso i just have to seq the MapEntry??
16:51jarpiain,(let [[[k v]] (seq {:a 1})] [k v])
16:51clojurebot[:a 1]
16:51duncanmeek
16:51Chousukehmmh
16:52ChousukeI would use (juxt key val) :P
16:52duncanmChousuke: how?
16:52Chousuke,((juxt key val) {:a 1})
16:52clojurebotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry
16:52Chousukehmmh
16:53Chousukenever mind. :(
16:53amalloy,((juxt key val) (first (seq {:a 1})))
16:53clojurebot[:a 1]
16:53drewr,(instance? clojure.lang.PersistentHashMap java.util.Map)
16:53clojurebotfalse
16:53duncanmyeah, it'd be nice if there's destructuring synatx for this
16:53_na_ka_na_,((juxt key val) (seq {:a 1}))
16:53clojurebotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap$Seq cannot be cast to java.util.Map$Entry
16:53amalloyduncanm: just seq it and then destructure that
16:53_na_ka_na_,((juxt key val) (first {:a 1}))
16:53clojurebot[:a 1]
16:54duncanmamalloy: then it's like what jarpiain wrote above
16:54drewr,(instance? java.util.Map {})
16:54clojurebottrue
16:54drewrderp, shows how much I have to use instance?
16:55amalloyyeah, i don't use instance? much either
16:55amalloy,(map? (java.util.HashMap.))
16:55clojurebotfalse
16:55amalloyboo
16:55duncanmoh, boo!
16:57jweissif 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:57vibranthumm... what about default values for struct-map fields?
16:57kotarakjweiss: declare
16:58kotarakvibrant: factory functions
16:58jweisskotarak: 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:59vibrantkotarak; so hum... & rest and i dig in rest and if something is missing i set the default?
16:59kotarakjweiss: although I read "interning" which smells a little bit
17:00kotarakvibrant: ? I'm not sure I understand your question.
17:00jweisskotarak: 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:01vibrantkotarak; (defstruct bullet :angle :velocity) where i want velocity to be 50 by default, so how do i write the factory func?
17:02amalloyvibrant: maybe :or in the map destructuring
17:02kotarakvibrant: (defn make-bullet [& {:keys [angle velocity] :or {angle 45 velocity 950}] (struct bullet angle velocity))
17:03amalloyyes, exactly that
17:03vibrantthanks :)
17:03kotarakjweiss: do you have to do that at runtime or do you know that upfront?
17:04jweisskotarak: 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:05kotarakjweiss: that's what macro are for.
17:05KirinDaveMan, I am all about mapping keys
17:05KirinDaveMakes me nervous.
17:06kotarakjweiss: (defxmlrpc <spec-goes-here>) generates all functions. Everything compiles.
17:06jweisskotarak: 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:07KirinDaveI'm surprised map-keys doesn't exist
17:07jweissdo 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:07bhenryKirinDave: what would map-keys do?
17:07kotarakjweiss: http://github.com/duelinmarkers/clj-record/blob/master/src/clj_record/core.clj#L190
17:08KirinDavebhenry: For a map of k -> v and a a function f, produces a new map where f(k) -> v for each pair
17:08kotarakjweiss: just a sec
17:08KirinDaveIs it in contrib and I just don't know about it/
17:08amalloyKirinDave: yeah, i think it is
17:09amalloylemme look
17:09bhenryKirinDave: amalloy: , i've seen f(v) that way, but not f(k)
17:09KirinDavebhenry: Well usually people use maps for lookup, but if you're using it as a way to store pairs...
17:11bhenrywhat are your keys? (i.e. keywords, strings, etc?)
17:11mabesKirinDave: 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:11KirinDavebhenry: Well for example
17:11KirinDavebhenry: Imagine that you get a java.util.Map
17:11KirinDaveAnd you want to make sure all the keys are clojure keywords
17:12amalloyKirinDave: huh, i guess you're right
17:12KirinDaveamalloy: Not that it's easy to find. Contrib is enormous these days.
17:12kotarakjweiss: something like this might be feasible: http://paste.pocoo.org/show/281963/
17:12mabeswe need a (find-fn-by-example) or somthing to search all of contrib
17:16jweisskotarak: 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:16jweissright now i am reading it from a file
17:17kotarakjweiss: you could do like (defmacro defxmlrpc-from-file [file-name] (let [spec (read-spec-from file-name) ....] ...))
17:18jweisskotarak: and the call to that macro would get executed at compile time?
17:19kotarakjweiss: yes. But the file-name must be a string.
17:20jweisskotarak: right, not a form because it wouldn't get evaluated. excellent, thanks
17:20kotarakjweiss: you are welcome
17:22arkhin leiningen directory structure, where should I place local libraries I've written that are used by my project's core.clj?
17:24raekarkh: 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:24arkhraek: sorry, I should have specified that I'd like to keep them local, for now (no clojars_
17:25raekarkh: for smaller libs that hasn't become their own projects, I guess I yould include their source files in src/
17:25raekfor sometiing in-between, there's the "checkouts" feature
17:26mabesbhenry: fyi, I commented on the gist http://gist.github.com/647817#comments
17:26raekif 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:27raeklein will automagically add those libs' sources and dependencies to the classpath
17:27arkhraek: 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:28raekah, lib/ itself is not on the classpath
17:28raekbut all jars in it is
17:28nickikis there a standard average function?
17:28raekfor the classpath, jars work like directories
17:29KirinDaveHrrrmmmm
17:29bobo_hm,, how do one use post with moustache? how do i get the params?
17:29KirinDaveThis is confusing get-class stuff
17:29KirinDaveCan someone help me figure out why gen-class isn't making the static makeServer method?
17:29raekbobo_: you can dispatch on method like this: ["path"] {:post post-handler, :get get-handler}
17:29kotarakbobo_: I think you need the ring params middleware
17:29raekbobo_: there is Ring middleware that does the param parsing
17:30raekbobo_: http://mmcgrana.github.com/ring/middleware.params-api.html
17:30raek(app wrap-params ["foo"] {:post handler})
17:31KirinDaveC'mon github... save
17:31KirinDaveOkay
17:31KirinDavehttps://gist.github.com/be11b181842fce78ade5
17:31KirinDaveI am still not very good with gen-class
17:31KirinDaveSo can someone explainw hat I am doing wrong?
17:32goodmike_mhtechnomancy: Are you around?
17:33chouserKirinDave: you're expecting a static method makeServer and not seeing one?
17:33raekmaybe the metadata should be on the vector
17:33KirinDavechouser: Yes
17:33raek"Static methods can be specified with ^{:static true} in the
17:33raeksignature's metadata."
17:33chouserKirinDave: yeah, what raek said
17:33chouser^:static [makeServer ...]
17:34KirinDaveOh
17:34KirinDaveI see.
17:34KirinDaveI put it inside the [
17:34KirinDaveNot outside.
17:34chouserand you don't need it on the -makeServer
17:34KirinDaveOkay
17:36raekyeah, (defn ^:static foo ...) is a Clojure-specific thing...
17:37raekunrelated to the class/instance method distinction
17:37KirinDaveAnnnd now it refuses to compile
17:37KirinDaveSaying that a bound var is not bound.
17:37chouserprogress!
17:37KirinDaveBut it's bound, so...
17:37KirinDaveMan, compiling. What a drag.
17:37chouserno kidding. gen-class is annoying that way
17:38chouserKirinDave: do you have a very recent clojure? someone on the list mentioned a similar-sounding problem that went away with "today's clojure"
17:38jweisskotarak: that totally worked. thanks again.
17:38KirinDavechouser: This is 1.2
17:38kotarakjweiss: that's good to hear. :)
17:38KirinDavechouser: Stable, but i haven't updated in quite awhile.
17:39chouserhm
17:39KirinDaveHum
17:40chouserwhat var is unbound?
17:40bhenrymabes: i timed them and they were both about the same doing an operation 1000 times.
17:40bhenrythey alternated being quicker than the other.
17:40KirinDavechouser: I am gisting
17:41KirinDavechouser: https://gist.github.com/47de41199aabd74df3c0
17:41mabesbhenry: nice, I much prefer your version then... how big was the map?
17:41KirinDavechouser: Sorry the trace is at the bottom :\
17:41bhenryit was small. i'll try my tests with a bigger one.
17:42KirinDavechouser: (protocol-machine ...) takes all enclosed defstate forms and pre-(declare ...)s them
17:42KirinDavechouser: I wonder if it's somehow choking on that.
17:42KirinDavechouser: I removed the require and it's still choking tho. Weird
17:42cemerickwhoa, scary macro magic! :-P
17:43KirinDavecemerick: 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:44bhenrymabes: yeah if your map is big transients are the way to go.
17:44bhenryhuge difference with 10000 keys
17:45KirinDavechouser: Can you see why that might be?
17:46rata_hi
17:47KirinDaveAhah
17:47KirinDaveI fixed it.
17:47kotarakKirinDave: toplevel forms are compiled completely before anything inside is executed.
17:49arkhdoes -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:49cemerickarkh: the former
17:49arkhcemerick: thank you
17:50KirinDavekotarak: I don't understand how that applies here.
17:50KirinDaveman, why is it saying this var is unbound when it clearly is not.
17:50KirinDaveI can load the module just fine.
17:50KirinDaveIt's just during lein compile it freaks out.
17:51kotarakKirinDave: ah. ok. sorry wrong error
17:51AWizzArdcemerick: do you have a SSD?
17:51cemerickssd?
17:51AWizzArdvs. hd
17:51cemerickoh; no
17:51AWizzArdk
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_na_ka_na_when i say it gets converted .. I mean the API finally gets this ..
17:58cemerick_na_ka_na_: some code of yours somewhere is making that change; nesting maps works just fine
17:58cemerick->{:a {:b 10}}
17:58sexpbot⟹ {: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:00Raynes$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:00sexpbotMessage saved.
18:00_na_ka_na_but if I pass the API below .. it works fine i.e. with {"a" {"b" 10}}
18:00_na_ka_na_,(doto (java.util.HashMap.) (.put "a" (doto (java.util.HashMap.) (.put "b" 10))))
18:00clojurebot#<HashMap {a={b=10}}>
18:01Rayneshiredman: ping
18:01cemerick_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:02cemerickoh; well, if the Java library is flattening it, I'm not sure what you'd hope to do from clojure to fix that...
18:03cemerickyou'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_na_ka_na_yes I am
18:04cemerickWhy 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:05cemerickright :-) My point is that it seems highly unlikely that it does.
18:06KirinDaveThis is crazy.
18:06KirinDaveI'm totally screwed now.
18:06cemerick_na_ka_na_: are you calling the library directly, or is there a clojure wrapper for it that you're using
18:06bobo_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:07cemerick_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_na_ka_na_not any public lib
18:09KirinDaveSo it seems like...
18:09KirinDaveIf you have things using (declare ...) and they get referenced by a gen class making static methods, then you're just done.
18:09KirinDaveYou can't do it.
18:10cemerick_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:10cemerickKirinDave: That's almost certainly not the case.
18:10KirinDavecemerick: Well, this is behaving really inconsistently.
18:10KirinDaveLike, the first compile works
18:11KirinDavebut then subsequent compiles do not.
18:11KirinDaveI have to erase the classes dir, then it compiles okay
18:11KirinDaveb
18:11KirinDavebut I can't load the namespace.
18:11KirinDaveSo something is terribly wrong here, and what precipitated it was ^:static
18:11cemerickThe gen-class form doesn't impact what's in the namespace.
18:12cemericki.e. being able to load it or not isn't related to your gen-class decl
18:12cemerick(the namespace, that is)
18:13KirinDavecemerick: Well, something I've done with graph.clj is pissing the compiler off
18:13KirinDaveIt's complaining b13 is not bound
18:13KirinDavebut, well, it clearly is.
18:13KirinDaveif i load the file and type in b13 with *ns* = clothesline.protocol.graph, it's clearly right
18:15cemerickKirinDave: are you sure that protocol-machine is doing what you hope it's doing?
18:16KirinDavecemerick: It's not a very complicated macro.
18:16KirinDavecemerick: And again, everything worked before I hadded a gen-class with a :^static
18:16KirinDavecemerick: THe macro is: https://gist.github.com/b26834d128610b428f2b
18:17KirinDaveMaybe coffee will clarify this problem.
18:54amalloyRaynes: nice, didn't know about the mail feature
18:55amalloyhow 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_na_ka_na_,(instance? java.lang.Iterable {})
18:56clojurebottrue
18:57_na_ka_na_(instance? java.lang.Iterable (java.util.HashMap.))
18:57_na_ka_na_,(instance? java.lang.Iterable (java.util.HashMap.))
18:57clojurebotfalse
18:58_na_ka_na_one of the methods has an (instanceof Iterable) chk before the (instanceof Map) chk
18:59cemerick_na_ka_na_: Nice. :-/ Bummer.
19:00amalloy_na_ka_na_: get the keyset out first?
19:00amalloyer, the entryset
19:01amalloy,(intance? java.lang.Iterable (.entrySet (java.util.HashMap.)))
19:01clojurebotjava.lang.Exception: Unable to resolve symbol: intance? in this context
19:01amalloy,(instance? java.lang.Iterable (.entrySet (java.util.HashMap.)))
19:01clojurebottrue
19:01_na_ka_na_amalloy: its not my code :/ its in an API
19:02_na_ka_na_now I need to convert my clojure maps to j.u.Maps
19:02_na_ka_na_sad day
19:02amalloyhm
19:03tonylwhat api is it?
19:07amalloy_na_ka_na_: define an IterableMap class, perhaps, that extends PersistentHashMap and implements Iterable?
19:07amalloythen 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:09amalloyoh i see
19:09amalloyyuck
19:10tonylseems 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:10defnninjudd or lancepantz are you guys around?
19:11duncanmif i have a defrecord, and i want to modify how it's printed, which protocol do I implement?
19:14tonylI would say implement the toString method of Object, depends on what you mean printed.
19:14tonylI haven't done protocols that much though
19:15cemerickduncanm: 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:16duncanmahh
19:16cemericksee core_print.clj in the clojure project to see how all the core types' printing is implemented
19:18cemerickduncanm: tonyl has a good point though -- think hard about what this string representation is meant to do.
19:41stuartsierrabuilding clojure-contrib 1.3.0-alpha2
19:57stuartsierraclojure-contrib 1.3.0-alpha2 deployed
20:01tlockneyquick question about Clojure-Java interop: does Clojure not support specifying type parameters on Java types?
20:02tlockneyI'm pretty sure I saw that mentioned somewhere, but want to confirm
20:02qbgtlockney: are you talking about generics?
20:03tlockneyqbg: yes. for instance, I need to pass in a map from Java (really from Scala)
20:03qbgtype parameters don't exist at run time
20:04tlockneyand we were having problems instantiating instances of IPersistentMap, so thought perhaps we could use java.util.Map
20:04tlockneyqbg: yeah, I know, but they do exist at compile time
20:04tlockneywhich, ya know, sorta kinda matters on the java/scala side ;)
20:04tlockneybasically, here's the situation...
20:05tlockneygen-class'ing a base class from clojure, that will then be extended from Java/Scala, but the methods need to take a Map
20:06qbgAny reason why they can't just take a Map and not a Map<K,V>?
20:07tlockneyyes, 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:10tlockneyhmm, I'll try going back to using IPersistentMap and hope I can finagle the instances appropriately
20:13mister_robototlockney: why are you crossing into clojure in the first place? i'm just curious
20:14tlockneymister_roboto: because it's appropriate for our environment :)
20:14qbgThe extended class really needs to have a parameter of type Map<K,V> instead of Map?
20:14tlockneyqbg: yeah, it does.
20:15mister_robototlockney: 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:15mister_robototlockney: note that i'm not criticizing, just wondering what sort of situation calls for that, in your opinion
20:16tlockneyIt'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:16qbgIs it implementing an interface that requires it?
20:16mister_robototlockney: ok thanks!
20:16tlockneybut al3x and I are both much more versed in Scala, so we're trying to make the 2 work together.
20:17tlockneywe 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:17tlockneyqbg: well in Java extending a class or implementing an interface really causes the same checks to be performed
20:18tlockneyqbg: the signatures must match
20:18tomojbut the java compiler doesn't run
20:18tlockneytomoj: it does when you're tying to compile Java :)
20:18tomojaren't you trying to compile a gen-class?
20:18tomojoh, the base in clojure, extending in scala?
20:18tlockneytomoj: no, that's just one part of it
20:19tlockneytomoj: right
20:19tomojhad it backwards
20:19tlockneytomoj: gen-class'ing from clojure, then extending from Scala
20:19tomojwait, what?
20:19qbgYou can have a generic class extend a non-generic class as long as you don't change Map to Map<K,V>
20:19tomojis the gen-class the superclass or the subclass?
20:20tlockneyqbg: 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:20tlockneytomoj: the gen-class is the superclass
20:20tomojright, ok
20:21mister_robototlockney: is webmachine like netkernel? glancing at the web page, it looks similar
20:21tlockneymister_roboto: not sure, haven't looked at netkernel
20:22tlockneymister_roboto: actually, I have, but it's been quite a while
20:29amalloytlockney: java compiler will definitely let you use non-parameterized classes. it issues a warning, not an error
20:29amalloysince generics are really just syntactic sugar for the caller doing all the necessary casting anyway
20:31tlockneyamalloy: 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:32tlockneyamalloy: 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:33tlockneywell, that's an issue for a different channel :)
20:34amalloyah, interesting. java matches the @Override properly
20:36tlockneyamalloy: 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:36amalloy*gasp* more important than type safety? how dare you even use a jvm language!
20:37tlockneyamalloy: 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:37tlockneyI *am* trying to work with Clojure, after all
20:38amalloytlockney: 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:38tlockneyand *gasp* actually likely it most of the time *shameless-grin*
20:38mister_robototlockney: maybe you should work WITH it and rewrite your stuff in clojure :)
20:38tlockneyamalloy: you have my deepest sympathies
20:38amalloyworked with hadoop?
20:39tlockneymister_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:39mister_robototlockney: it's probably running too fast now anyway :)
20:40mister_robototlockney: just kidding. good luck with your project
20:40tlockneyamalloy: nah, just crazy insane usage of generics in Java (note: I am *not* talking about type parameters in Scala -- whole diff ballgame)
20:40amalloyyeah, i haven't tried scala
20:40tlockneymister_roboto: also, see previous mention of actually being a fan of type safety ;)
20:41tlockneyI'm riding dangerous ground talking like this in #clojure, ain't I?
20:41mister_robotolol it's really a nice bunch of people here.
20:41tlockneyyeah, i'm just teasing
20:42mister_robotounlike #groovy where nobody EVER says a damn word
20:42mister_robotoor responds
20:43tlockneymister_roboto: I try to stay away from Groovy, if I can help it. but that's jsut a personal preference.
20:43mister_robototlockney: it's slow but you just cannot get nicer integration with java.
20:44tlockneymister_roboto: sure you can, it's called Scala (warning: blantant trolling!)
20:45mister_robototlockney: 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:46tlockneymister_roboto: depends on what you consider *nice* ;)
20:46mister_robototlockney: 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:47mister_robototlockney: 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:50mister_robotoi hope clojure 1.3 catches up to scala without having to do lots of performance tricks
20:51mister_robotoi would dearly love to see it really catch fire and become huge on the jvm
20:53tlockneymister_roboto: I'd be happy to see that as well
20:58tomojcatches up? :(
20:59duncanmsigh
20:59mister_robotowell 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:59mister_robotothat was with 1.2
20:59duncanmif 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:59mister_robotoi'll find the article...
21:00amalloy,(update-in [[:a b]] 0 conj 1)
21:00clojurebotjava.lang.Exception: Unable to resolve symbol: b in this context
21:00amalloy,(update-in [[:a :b]] 0 conj 1)
21:00clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: Integer
21:01amalloymutter
21:01qbg,(update-in [[:a :b]] [0] conj 1)
21:01clojurebot[[:a :b 1]]
21:01amalloyoh thanks
21:02amalloyduncanm: ^^
21:02tlockneyamalloy: are you sure about what you were saying re: Java generics and @override earlier? http://gist.github.com/648186
21:04amalloyoh you're doing it the other way round than i thought
21:04amalloyyes, that's not a valid override
21:04amalloybut if Super had <X, Y> and Sub were raw, it would be okay, which is what i thought you meant
21:04tlockneyamalloy: ok, so... back to where I thought I was, I guess :)
21:05tlockneyamalloy: 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:06qbgScala doesn't let sub be raw?
21:07amalloytlockney: if you use <?,?> instead of <Object, Object> does that work?
21:08amalloyseems like it should
21:08qbgamalloy: I don't think so
21:08tlockneyamalloy: nope.
21:08mister_robototomoj: here is what i was reading - http://groups.google.com/group/clojure/browse_thread/thread/94cc586631af16f1?pli=1
21:09mister_robototomoj: stu halloway added his 2 cents too
21:12amalloytlockney: 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:12tlockneyqbg: sorry, missed your question - no Scala won't take a bare type here
21:13tlockneyamalloy: yeah, that's pretty much what I'm guessing is the rationale here
21:13tlockneyamalloy: I'm going to go back to try to use Clojure types, even if they are a bit more *interesting* to work with
21:13amalloyeg Super x = new Sub<String, String>(); x.foo(10, 12);
21:14tlockneythanks for the suggestions everyone
21:15mister_robototlockney: what about using xml?
21:15mister_roboto:)
21:16tlockneymister_roboto: going for the serious troll, eh? ;)
21:16mister_robotolol
21:26qbgI 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:27mister_robotoqbg: 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:28qbgJust compare Clojure to Python :p
21:28mister_robotoand sometimes you just need the speed. it would be fantastic if there was never a reason to drop to java just for that
21:28mister_robotoqbg: right
21:30mister_robotoqbg: java->scala kind of reminds me of c->c++
21:30qbgI 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:30qbgThat benchmark code did not look the Functional Fluid Dynamics code...
21:31mister_robotoqbg: 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:31qbgClojure seems to be going in the direction of C++'s attitude for performance
21:31mister_robotoqbg: by c->c++ i mean the explosion in complexity :)
21:33mister_robotoqbg: 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:34qbgDue to lisp exposure, I feel queasy when looking at languages with a ton of syntax
21:48Mukihey guys! I'm in serious need of some help. :)
21:49qbgMuki: What is it?
21:49MukiI've been struggling with my clojure-emacs install for a week now
21:49MukiI am currently trying to get a hold of leiningen
21:50Mukiand swank-clojure
21:50MukiI add the dependancy
21:50Mukirun lein deps
21:50Mukiand then swank is not a task
21:52Mukiif I run it with swank-clojure 1.2.0 as a dependancy lein deps finishes
21:52Mukibut then nothing happens
21:52jweissMuki: does it show it downloading swank-clojure.jar?
21:52jweissis that jar in your lib/dev or lib dir?
21:52jweissit should have put it there
21:52bhenryMuki: what is your os?
21:53Mukios x
21:53Mukino
21:53Mukiit only downloads clojure-contrib
21:53qbgWhat happens if you try swank-clojure 1.2.1?
21:54jweiss :dev-dependencies [[swank-clojure "1.2.1"]]
21:54jweissthat's what the line should look like
21:54Mukionly downloads clojure-contrib
21:55jweissmuki - it should be in your dev-dependencies, unless you need to bundle swank with your app
21:55jweissi don't know if that is causing your problem though
21:56MukiI had to point maven to clojure-contrib manually on my drive though
21:56Mukibecause beforehand maven wanted super pom for every dependency
21:56qbgHow did you install leiningen?
21:56Mukilein shelscript
21:57amalloyand lein self-install?
21:58Mukiyes
21:58jweissmuki - paste your project.clj
21:58Muki(defproject org.coljure.appengine/too_hot "1.0-SNAPSHOT"
21:58Muki :description "This is a test project to learn leiningen."
21:58Muki :dependencies [[org.clojure/clojure "1.2.0"]
21:59Muki [org.clojure/clojure-contrib "1.2-SNAPSHOT"]
21:59Muki [swank-clojure "1.2.1"]]
21:59Muki :namespaces [too-hot]
21:59Muki :main too-hot)
22:00jweissmuki, i don't know if it'll help, but try moving swank under a :dev-dependencies section (same syntax as :dependencies)
22:00amalloyyeah, 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:01jweissalso i am no lein expert, but there's at least one problem with org.coljure.appengine/too_hot on your first line
22:02jweissi have never seen dotted and slashed project name, but there's probably a use for that i'm not aware of
22:03Mukiok so there's one more thing
22:04Mukibefore, whenever I ran lein deps a kilometer of errors showed up
22:04Mukiand the I overrid clojure-contrib to a local file with maven
22:04Mukiafter that lein deps finished without errors
22:05Mukibut lein swank never worked :)
22:05tomojMuki: do you own coljure.org?
22:06Mukino
22:06Mukiit's what all the tutorials said to use with maven :)
22:06Mukimy biggest concern is to have swank-clojure running
22:06Mukiand NOTHING worked so far
22:06tomojthey said to use org.clojure ?
22:07Mukies
22:07Mukiyes*
22:07tomojif you put a reverse domain name after defproject, you should own it
22:08tomojanyway, switch clojure-contrib from 1.2-SNAPSHOT to 1.2.0
22:08Mukia question
22:08tomojthere is no clojure-contrib 1.2-SNAPSHOT, wherever you got that from was wrong
22:09Mukiok
22:09Mukibut if I have clojure and clojure-contrib on my machine
22:09Mukiand want to use those as dependencies
22:09Mukihow do I do that?
22:09tomojwhy would you want to do that?
22:10tomojanyway, if you put them in the right place, they will be used
22:10tomojlein will download clojure, for example, into ~/.m2/repository/org/clojure/clojure/1.2.0/clojure-1.2.0.jar
22:10tomojno reason to use jars already on your machine unless you're hacking on clojure
22:11MukiOK, so what should I do?
22:11MukiI'm completely new to clojure, coming from Java and Python
22:11tomojjust put 1.2.0 instead of 1.2-SNAPSHOT, and run lein deps..
22:12tomojalso move swank-clojure to :dev-dependencies like jweiss said
22:12tomojif you still get errors, paste the project.clj and the errors (not here! use gist or pastebin or whatever)
22:15tomoj(uh, fix the contrib version, move swank-clojure to :dev-dependencies and _then_ run `lein deps`..)
22:17Mukithese are the errors after lein swank
22:17Mukilein deps runs without errors
22:17Mukihttp://pastebin.com/HBJ4QPQn
22:18tomojhave you written a too_hot.clj?
22:19tomojor not yet?
22:19technomancyarkh: saw your question about -main; you actually don't need AOT to use it as of a week or so ago
22:19tomojif not yet, get rid of :main and :namespaces until you write it
22:19technomancyit works with clojure.main -m
22:19Mukinot yet
22:19Mukiso I just remove main and namespaces then?
22:19tomojright
22:20Mukidid thath
22:21tomojalso, 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:22MukiOK but now the error is Exception in thread "main" java.lang.NumberFormatException: For input string: "[PORT=4005]" (NO_SOURCE_FILE:1)
22:22tomojwhat did you type
22:23Mukifigured it our
22:23Mukiout
22:23Mukiit should just be "lein swank" right?
22:23tomojtechnomancy: do you already know about "Unable to resolve symbol: project in this context (swank.clj:7)"?
22:23tomojMuki: yeah
22:23technomancyMuki: if you use "lein new" rather than creating it manually you can avoid these troubles.
22:24Mukiwow! that was a waste of your time - sorry
22:24Mukiand now I should just M-x slime-connect?
22:24technomancytomoj: doesn't sound familiar
22:24Mukifrom emacs
22:25technomancyMuki: yezzz
22:25tomojappears to be caused by an update to swank-clojure.. hmm
22:26MukiOK but now suddenly, M-x slime doesn't work
22:26Mukiit says "no match"
22:26technomancytomoj: which lein version?
22:26tomoj1.3.1
22:26technomancyMuki: that can't be related to your project.clj changes
22:27tomojmaybe my lein too old for swank-clojure 1.3.0-SNAPSHOT..?
22:27technomancytomoj: shouldn't be; I'll try it
22:27Mukithanks, I'll investigate this :)
22:28chaslemleyis there a way to delete clojars after you've uploaded them? I can't find a way
22:28technomancytomoj: repro'd here; I'll take a look
22:29technomancychaslemley: is it urgent?
22:29tomojhttps://gist.github.com/a2ee552212e236aedef1
22:29tomojoh, ok
22:29chaslemleynope, not urgent
22:29technomancychaslemley: in that case try emailing clojars-mantainers: http://groups.google.com/group/clojars-maintainers
22:30tomojwonder if I can tell maven to go back a snapshot..
22:30chaslemleythanks! i'll do that
22:30defnWhy is the new fork/join stuff put in clojure.par? What does the par mean?
22:31tomojI think it's 'paratrooper'
22:31tomoj'parcheesi'
22:31defnheh
22:32technomancyparliamentary
22:32defnit was inspired by the work of chris parnell
22:32defnand knowing how to use it means you're more likely than not a social *par*iah
22:33tomojwhere's clojure.par anyway?
22:33tomoj1.3.0-SNAPSHOT?
22:34tomoj(er, or is it still -master-SNAPSHOT?)
22:35defni think it's in master-SNAPSHOT
22:40technomancytomoj: fixed; pushing
22:40technomancythanks for the catch
22:41tomojoh, wow http://build.clojure.org/snapshots/org/clojure/clojure/1.3.0-alpha2-SNAPSHOT/
22:41defntechnomancy: is *connections* permanently renamed?
22:41defnit breaks cake swank and lein swank i think
22:41technomancydefn: not on purpose
22:41defnah so that's being reverted?
22:42technomancyI am actually not sure what you mean. what broke?
22:42defnit might just be cake
22:42defnbut cake relies on *connections* as of right now, backwards compatibility will be a bit of a pain with the rename
22:42technomancyI just got a patch that un-broke clojure 1.3.0
22:43defni 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:43technomancybut I didn't read through it carefully
22:43technomancyyou could probably move it back
22:43technomancyas long as you run "lein multi test" to make sure it works with all versions
22:43defni think you're right to change it given recent talk at the conj about the earmuffs convention
22:44defnbut i thought id mention it FWIW
22:44technomancysure
22:46Raynes$mail cemerick You'll be proud to know that I am now the sole owner of a printer-scanner-copier multipurpose unit.
22:46sexpbotMessage saved.
22:47tomojhmm, how do I force lein to check for updates on swank-clojure?
22:48tomojor is it just that clojars needs to update some index?
22:50defntomoj: blow away your .m2/swank-clojure
22:50defnor rename it
22:51defnthat 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:52defnswank-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:52tomojit got changed from -3.jar to -4.jar
22:52defnoh...no kidding?
22:52tomojah
22:53tomoj"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:53tonylhello
23:14gigi`hey guys
23:14gigi`I have trouble installing clojure
23:14gigi`I tried every tutorial out there
23:15gigi`is anyone here willing to guide me through it?
23:15amalloygigi`: what OS?
23:15gigi`os x
23:15gigi`I have Emacs installed
23:15gigi`and ELPA
23:15gigi`aside from that I'm clean
23:16hiredmanping?
23:16clojurebotPONG!
23:16gigi`and I have clojure.jar and clojure-contrib.jar
23:16amalloyhm. i don't have a lot of experience with osx, but i can take a few guesses
23:16tonylmaybe a simple setup. run it as a java program.
23:17gigi`I'm guessing I should go for slime and slime-repl from ELPA
23:17gigi`I already did that
23:17amalloygigi`: swank-clojure from ELPA?
23:17gigi`I want it in my Emacs
23:17gigi`swank-clojure is only 1.1
23:17gigi`and it keeps erroring on me
23:17gigi`on ELPA*
23:17amalloymm, okay
23:17amalloyhave you tried leiningen self-install?
23:19amalloyand also, do you have/can you get ruby gems? if so there's a very fast way to get a repl going
23:19amalloygigi`: ^^
23:20gigi`I do, but would rather not drag ruby into this :)
23:20amalloyone of the easiest and most popular ways to run clojure uses a ruby script; you don't have to, but it's convenient
23:20amalloyhttp://dl.dropbox.com/u/5642669/Screenshots/repl_in_30_expanded.png if you want to give it a try
23:23amalloyi also understand there's a package called cljr for macos, in whatever their package manager is. brew? macports? not sure
23:24gigi`thanks :)
23:25amalloygigi`: let me know what works, or :( if nothing does
23:30tomojyou don't need swank-clojure from elpa
23:31tomojjust 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:31tomoj`lein new foo` to create a new lein project in ./foo
23:32tomojor cljr will work too
23:37gigi`thanks tomoj, hopefully, that'll work
23:47tomojheh
23:47tomojmaybe bob martin should've studied a bit more before doing an evangelism talk?
23:51trptcolinmaybe. but he's learning. let's be glad he's embracing clojure and helping other people to as well, right?
23:51gigi`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:52tomojwell, remove paredit on elpa
23:52tomojthis won't help with your error
23:52tomojbut you want the beta
23:52tomojhttp://mumble.net/~campbell/emacs/paredit-beta.el
23:52tomojclojure mode will detect that you're using the latest and fix some things up for clojure
23:53gigi`so should I remove everything? or just paredit
23:53tomojgigi`: ignore those errors
23:53tomojjust remove paredit
23:53tomojthen make sure it's gone from ~/.emacs.d/elpa
23:54tomojdownload that paredit-beta.el, save it somewhere as paredit.el, and add the directory to your load-path
23:54gigi`when I refresh elpa's package list it says that everything except slime-repl is installed
23:54gigi`should I reinstall all of those?
23:55tomojhmm
23:55tomojtry just reinstalling slime-repl
23:55tomojerrors during installation are normal
23:56gigi`I should probably restart emacs after adding the new paredit to my load-path
23:56gigi`or?
23:57tomojyeh :/
23:57tomojI dunno what else you would need to do to get clojure-mode to notice and fix stuff