#clojure logs

2010-08-09

00:00jetlag(#{true} x)
00:02arbschtor is arguably more idiomatic though, at least in lisps. I think a variation of it goes by the name of "elvis operator" in other languages
01:07lalanickhi
01:08lalanicki tried for hour now to get the following enum into clojure:
01:08lalanickhttp://www.jmonkeyengine.com/doc/com/jme/app/AbstractGame.ConfigShowMode.html
01:08lalanickbut it just wount work, nested protected generic ...
01:08lalanickanyone has an idea?
01:09arbschtlalanick: what have you tried and what was the error?
01:10lalanick1 sek
01:12lalanickAbstractGame$ConfigShowMode/AlwaysShow
01:12lalanickbut it just wount recognize that its an enum
01:14lalanickonce i've imported the enum i can call it with a "slash", is that right?
01:28arbschtlalanick: did you import the enum?
03:25old_soundhi, which library would you recommend for AMQP and XMPP with clojure?
04:22defnold_sound: prolly going to require a java library
04:22defnor at least i dont know of a clojure XMPP lib. offhand
04:22old_soundI saw a couple that are just wrappers around java libs
04:23defnsmack?
04:23old_soundthere's a rabbitmq one, that is just a wrapper around the java client, I think i saw the same for XMPP
04:23old_soundI can't remember
04:23defnhttp://gist.github.com/70695
04:23defn^hiredman's handy work
04:24old_soundnice
05:04defnold_sound: :)
05:06notsonerdysunnywhat is a good package to help access java-native-interface in clojure?
05:12ordnungswidrignotsonerdysunny: that's some double-foreign-language integration :-)
05:17notsonerdysunnyordnungswidrig: clojure-jna is an option .. but I wanted to know what others have to say ...
05:18ordnungswidrignotsonerdysunny: I have no idea of java and native libs. I remember having tried a java serial io lib ages ago
05:28LauJensenGood morning all
05:29ordnungswidrighi LauJensen
05:47old_soundgood afternoon…
08:47defnThere's a dichotomy here that is oft forgotten--
08:47defnoops
08:52lpetitdefn: hello, so who's "the jackpot for your preface/foreword" ? :)
08:59LauJensenLaurent mon ami! Salut, ca va?
09:02lpetitLauJensen: hello dear :)
09:05defnlpetit: I think you have the wrong person :)
09:05defnlpetit: do you mean fogus or chouser?
09:06lpetitdefn: Yes, I keep doing the same error, mistaking you and fogus*
09:06lpetitdefn: sorry, buddy
09:07defnlpetit: no problem -- im happy to be mistaken for fogus
09:07defn;F
09:08lpetitdefn: anyway, has the name of the preface/foreword of JOC been revealed ? :)
09:09defnlpetit: not to my knowledge! I didn't know it was a tantalizing topic.
09:09lpetitdefn: I'm over emphasing things sometimes :)
09:09defnForeword (to be announced)
09:10defnThey should name it "On Madison Square Clabango..."
09:11defnand talk about the history of Clojure, the real life characters behind it.
09:11chouserthat particular topic cannot be over emphasised.
09:11chouserwell, perhaps it can, but it's still pretty incredible. I'm stoked.
09:11defnFirst part joking, second part serious.
09:12lpetitchouser: what a buzz :)
09:12chouser:-)
09:13defnchouser: I know you guys are wrapping up, but FWIW I'm really a fan of you, fogus, etc. (see: http://clojure.org/contributing)
09:13defnFogus has been doing his (take ...) which I really have enjoyed
09:14defnIt would be nice to know your histories as well-- Coders at Work, but clojure-centric.
09:14chouserwe were each interviewed recently -- did you see those?
09:14lpetitchouser: let's start a guessing game ?
09:14chousernot much detail I guess.
09:15chouserlpetit: you can guess, but I don't think I can confirm or deny anything.
09:15lpetitchouser: I like to play. And I'm not afraid of loosing :-)
09:15lpetitchouser: if it were for Rich himself, you would be very pleased and honored, but not stucked.
09:15lpetitchouser: so I think it's not Rich
09:16LauJensenI wouldn't be surprised if it was Bill Joy :)
09:16lpetitchouser: to be stuck is something. Could it be the father of Lisp himself ?
09:17chouser:-)
09:18defnchouser: yeah, not enough content :) I'm interested in sort of the evolution of how people come to be programmers, what the germ of the whole idea is for them...
09:19chouserdefn: well, Coders at Work is all interviews, right? All you need is an interviewer who will ask *exactly* the questions you want asked. hm, who would that be....
09:19_na_ka_na_hey guys, is there something like jdepend for Clojure ?
09:20chouserdefn: but I do think fogus isn't done with the "take n" interviews yet. I've enjoyed them so far.
09:20_na_ka_na_which produces dependency metrics / etc
09:21_na_ka_na_well mostly I just want a pretty graph of namespace dependencies for my project
09:21_na_ka_na_any ideas ?
09:21defnhttp://github.com/gcv/dgraph
09:23defnmaybe not what you want...
09:24_na_ka_na_ya, I looked at that, its not
09:24_na_ka_na_I tried jdepend, but it doesn't work for clojure
09:24_na_ka_na_I'll write a small script myself - just wanted to check if there's already something similar
09:24defnyou want a graph of all your uses and requires, yes? not the underlying java impl?
09:24_na_ka_na_yup
09:25defnyeah I think that'd be a good project actually
09:25_na_ka_na_I'll dump an xml file, then convert into a .dot file .. then into an image
09:25defnis .dot graphviz??
09:25defner no that's .viz i think
09:26chouser.dot is graphviz
09:27_na_ka_na_graphviz
09:32defn_na_ka_na_: if you write that please share. clojure.contrib.graph looks a little less scary and could be helpful i think
09:33_na_ka_na_defn: definitely
09:33spariev_na_ka_na_: have you tried this - http://github.com/hugoduncan/lein-namespace-depends
09:34_na_ka_na_spariev: wow thanks, i'll try
09:35spariev_na_ka_na_ : np, just found it in my watched repos list )
09:36LauJensenhey javascript gurus - whats the idiomatic js fn to validate a format like hh:mm ? like a js version of scanf
09:46LauJensenso few javascript gurus in #clojure :|
09:47ordnungswidrigLauJensen: i think the idiomatic form would be a regex
09:47LauJensenordnungswidrig: yea thats what I would go with if everybody was mute :)
09:48ordnungswidrigLauJensen: "12:34".matches(/^\d\d:\d/d$/) reads idiomatic for me
09:48LauJensenYea ok.. I just dont like regex :)
09:50ordnungswidrigLauJensen: a powerful tool when used wisely
09:50LauJensenordnungswidrig: yea, like the dirty bomb of programming
09:50ordnungswidrigLauJensen: dirty bomb?
09:51LauJensenordnungswidrig: I think its a term used about suitcase nukes
09:51lpetitLauJensen: place the right level of indirection so that all your regex are clearly separeted from the rest of your code
09:52LauJensenlpetit: the guys at the first conj labs actually wrote a regex DSL, where native Clojure data compiled to regexs - was very cool
09:52ordnungswidrigLauJensen: I see
09:52ordnungswidrigLauJensen: …which wouldn't be a very compact DSL compared to regex.
09:53lpetitLauJensen: yes, I've heard of that
09:53ordnungswidrigIf you know your regexen well, you read it like code
09:53LauJensenordnungswidrig: no of course you dont do that aiming for compactness, but aiming to learn how to wield protocols effeciently :)
09:53ordnungswidrig…up to a certain level of complexity
09:53defnordnungswidrig: content is important
09:53defncontext*
09:53defnordnungswidrig: ah, you beat me to it
09:53ordnungswidrigLauJensen: or if you have to generate regexen at runtime
09:54ordnungswidrig(whoever want to do this) I mean, like generating SQL
09:54LauJensenordnungswidrig: yea, I was just telling you the motivation for doing that lab at Conj Labs
09:54lpetitLauJensen: how related is this to your initial question ?
09:55LauJensenIts not
09:55lpetitdo you consider your initial question answered ?
09:55ordnungswidrigLauJensen: back to your question: you could use the clojure-to-js compiler to build some verification code
09:56LauJensenlpetit: Not if you have a better one :)
09:56lpetitI don't think js cross-browser libraries place an abstraction level over that.
09:57ordnungswidrigIs there something like dateformat / simpledateformat as js lib?
09:57LauJensenordnungswidrig: What you pasted dindn't fly in Chromes JS repl, this returns null "57:55".match("/[0-9][0-9]:[0-9][0-9]/");, as did it with \d - any idea whats up ?
09:58ordnungswidrigYou can (must?) omit the string quoting of the regex. /../ is a js literal for regex
09:58ordnungswidrigff konsole wouldn't match on "/xxx/" but only /xxx/
09:59ordnungswidrigjavascript reader magic :)
09:59LauJensenordnungswidrig: without the string, it wouldnt eval
10:00ordnungswidrig"57:55".match(/[0-9][0-9]:[0-9][0-9]/)
10:00ordnungswidrigEvals in my chrome js console
10:01LauJensenthat works here as well, s/matches/match
10:02ordnungswidrigOh there was a typo in my intial paste: /d instead of \d
10:02LauJensenyea I noticed, but thanks for the tip
10:03LauJensenlpetit: btw, IIRC you keep up with Chrome, is that an emacs bindings plugin for it yet ?
10:03lpetitLauJensen: ??
10:04ordnungswidrigLauJensen: I use vimium for chrome which is nice if you know your vi bindings
10:05LauJensenwell, i dont :)
10:05LauJensenI use Conkeror
10:07edbondDid someone use http://projectfortress.sun.com/Projects/Community/ ? The guy wants to do parallel calculations from java, choosing fortress vs clojure.
10:07ordnungswidrigLauJensen: Conkeror looks nice
10:07LauJensenordnungswidrig: Yea Ive been very happy with it
10:08ordnungswidrigfortress is weird stuff
10:09LauJensenedbond: Ive heard a lot about fortress, spoke with one of the guys working on it, but never used it. It doesnt have the same ambitions as Clojure exactly
10:09ordnungswidrigregarding syntax it's like the opposite of sexp and homoiconicity
10:09ordnungswidrig(did anybody say APL?)
10:09LauJensenordnungswidrig: nope, nobody said APL
10:10LauJensenBut Im not sure that Fortress has much pratical application yet? Last time I heard it was still just for research
10:13ordnungswidrigLauJensen: that was my impression, too
10:14ordnungswidrigLauJensen: they throw in a lot of non-mainstream concepts, like "free', adjustable syntax, parallelsim, stm or tx at a language level
10:16LauJensenTo me there are really 2 worlds, Clojure and the rest. I went to a lecture with one of the top dogs from Java, who had examed Java, Scheme, JavaFX, Fortress and many others. And concluded that when looking at a function definition it was unclear exactly what was going on, so the solution was to invent a new language for 'annotations', which would go into Java, so I could do String name @for user names in GUI@ = "Frank". And everybody
10:16LauJensenwould know what that string was for. I didn't want to embark on telling me that perhaps a more concise and expressive programming language was the way to go, so I just waited it out :)
10:16LauJensen'telling him'
10:21ordnungswidrigI think it's from the chapter on macros in "Practical Common Lisp": my favorite Lisp quote "an abstraction emerges"
10:21ordnungswidrigIsn't this the essence of programming? Building abstractions (and know when to stop)
10:21LauJensenWell, that an Emacs
10:24ordnungswidrigLauJensen: well, you might be right.
10:24ordnungswidrigLauJensen: I'm a bad judge, as I use viper-mode
10:25LauJensenYea - The thing that got me hooked on Lisp was the idea of transforming a humans thought into that of a computers, and making that process as direct as possible
10:25LauJensenI was very aware, that in C# the route was very very indirect
10:25LauJensenOf course much more goes into development, but on the personal level its a huge driver
10:26ordnungswidrigI'm program in java for a living at the moment. And it feels so… so much "ceremony" and "protocol"
10:29ordnungswidrigs/m i/mming i/
10:29sexpbotI'm programming in java for a living at the moment. And it feels so… so much "ceremony" and "protocol"
10:29ordnungswidriguh, nice
10:29ordnungswidrigsexpbot is a rexegbot
11:28BahmanHi all!
11:31chouserhi
11:37LauJensenDoes anybody have a one-liner floating around, for pulling out a field containing seconds in integer, as hh:mm from a mysql db ?
11:39pdkso you want the seconds out of a hh:mm:ss formatted string
11:39LauJensenno, I have an integer like '7200' and I want and SQL statement which returns 02:00
11:42raekI really like the chapter on functional programming in The Joy of Clojure
11:51LauJensenSELECT SEC_TO_TIME(time) FROM table => seconds to hh:mm:ss
11:54pdkraek given how tjoc has come along so far would you say that it'd be a worthy purchase for someone who's already got practical clojure
11:54pdkpclj at times seems to be closer to a pocket reference
12:02pdk(doc case)
12:02clojurebot"([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need not be quoted. If the expression is equal to a test-constant, the corresponding result-expr is returned. A single default expression can follow the clauses, and its va
12:02pdk(doc sort)
12:02clojurebot"([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
12:13raekpdk, I haven't read practical clojure, but I guess so, yes. for me, it has been a "ok, I get clojure. I wanna learn more" kind of book
12:13raekif that was of any help
12:14pdkthatd be good
12:14pdkthe macro chapter in pclj for example just gives you the syntax and 2 example usages
12:16raekok, JoC is more, well, "passionate" about the things it includes
12:19pdelgallegoHi, can anyone point me to a good configuration of emacs and clojure? I am looking for somthing more advance that the getting starter
12:22pdkpdelgallego most folks use slime/swank with emacs/clojure
12:23pdkyou could ask someone here on *nix how to set it up on those systems but if you're on windows you can download it all packaged together, just google clojure box
12:24pdelgallegopdk, I read about swank. I am on a linux box.
12:24pdkhmm
12:24pdki couldn't tell you first hand how to set it all up on *nix but a lot of folks here can
12:25pdkjust need to wake em up :p
12:25pdelgallegook, I was wondering if there was any other option before install it
12:26pdkprobably just slime though it seems slime/swank work together
12:26pdelgallegopdk, Do you use emacs ? or any other option?
12:27pdkjust gvim + vimclojure right now since for the moment i wanted something i could more or less use like a regular text editor but still with proper lisp indentation
12:29pdelgallegopdk to build the project do you use leiningen? this looks like a lot of new tools to learn.
12:29pdki haven't really looked into leiningen/maven/cake etc since i havent started a major project yet :p
12:30pdkagain therell be plenty of users of those in here
12:36LauJensenIs there a lot of people using cake?
12:43pdkthere's a github repository for cake
12:43pdkclojars.org has some stuff to make it easier to pull stuff from it through leiningen/maven
12:45LauJensenpdk: Yea I know, Ive heard of cake, just not heard of anybody using it
12:45LauJensenWould be great if somebody would blog a little about it
12:46LauJensenhmm, guess I could do that, if its awesome enough :)
12:56LauJensenDo people still hook into apache.commons.fileupload for handling fileuploads with ring?
13:06ordnungswidriganybody used http://nestedvm.ibex.org/
13:06ordnungswidrigwith clojure?
13:18tridd3llpdelgallego: saw your comment before in the log... this might help if you're looking for a tutorial on a linux setup: http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
13:21danlarkinpdelgallego: it can be a little easier than that if you use ELPA
13:23mebaran151I have a quick little patch for clojure.contrib to fetch generated keys along with a query using the JDBC interface. How can I submit this?
13:23danlarkinalso there's not really a need to clone clojure or contrib if you're gonna make them leiningen dependencies
13:27technomancydanlarkin: but that's too easy; it can't be right.
13:27technomancythe longer the instructions, the more likely they are to be accurate! QED.
13:28danlarkin
13:28danlarkinthat's unicode END OF PROOF
13:28technomancywell done.
13:28LauJensenI think you guys need a break :)
13:32mebaran151I'm also having a strange emacs wherein fn becomes a strange pink looking f
13:32danlarkinmebaran151: for that you can blame technomancy :)
13:32mebaran151oh
13:33mebaran151anyway to disable it
13:33mebaran151just makes it harder for me to scan
13:33mebaran151I often name varables that hold functions f
13:33technomancycontact your healthcare provider if redness or itchiness symptoms appear in your closures.
13:33mebaran151hahaha
13:34mebaran151I mean it's a cute trick (as my coworkers would so very very kawaii)
13:34mebaran151*so => say
13:34technomancycomment out a form near the end of starter-kit-lisp.el with font-lock-add-keywords
13:40mebaran151ah alright
13:40mebaran151see it only sometimes does it
13:40mebaran151sometimes I get a pink f with no n
13:40mebaran151sometimes I get fancy pink f with no n
13:41mebaran151sometimes I get a fancy black f with an n
13:52dprohi
13:53chouserdpro: hi
13:53dproI'm tearing my hair out over failing dependencies when trying to get lein swank to work
13:53dproalways complains about a missing org.apache.maven:super-pom:jar:2.0 artifact
13:54dprotried different version numbers in the project config, lein stable/devel ... same
13:55tridd3lltechnomancy, danlarkin: ok, you win, I won't point another person at my pointless tutorials... I'm obviously doing it all wrong
13:55mebaran151thanks technomancy
13:56mebaran151where's the best place to get writeup about deftype: I'm porting some old code
13:56danlarkintridd3ll: no need to be defensive :-/ we're on the same team
13:56mebaran151and I thought it might be useful to combine two deftypes into one
13:57mebaran151say I had a a deftype that did Add and Substract and another that implemented multiply and divide and I wanted to make a type called say SimpleArithmetic that used both
13:58LauJensentridd3ll: I think your tutorial covers a lot of ground, keep up the good work.. please :)
13:58mebaran151I know I'd probably have two protocols and maybe even a third protocol called Field that represented the combination of all these different method signatures
13:59mebaran151basically, I don't know how you combine and inherit types and protocols
14:01hiredmanyou don't
14:01hiredman(inherit)
14:02tridd3lldanlarkin: sorry to be defensive, but not everyone uses ELPA, or is an expert on git, maven, etc. and it does demonstrate both command line and emacs integration... and it gets old to have to explain that every time given the comments that follow every mention of this approach
14:03danlarkintridd3ll: forgive my naïveté
14:04danlarkinyour tutorial is better than mine! (ie. no tutorial)
14:04technomancytridd3ll: those tutorials are good for people who need to install manually for some reason. that just seems like a special case to me.
14:05tridd3lldanlarkin: :-)
14:05lpetitHello all
14:05lpetitI've questions on how to enhance a code that's using clojure zippers
14:07mebaran151hiredman, how do you combine then?
14:07lpetitHere's the problem: I've a datastructure that follows xml-zip conventions: :tag and :content keys. I use this for representing the parse tree some source code (okay, it's some clojure file source code)
14:07mebaran151or am I sort of not getting the point of the protocol work at all
14:09tridd3lltechnomancy: agreed, I guess I only point it out here and there when I see someone on linux saying they would like help... this method is just the way I go about things, even though sometimes there is technically an easier/faster way (but sometimes with more magic)
14:09lpetitNow I have this clever additional keys :count (which gives the size in chars of the node, including the size of subnodes), and :cumulative-children-count (which gives a vector of the cumulative counts of the children of the node: e.g. at some node with a first child of count 4 and a second child of count 6, :cumulative-children-count gives [0 4])
14:10lpetitProblem: I want to leverage my :cumulative-children-count info to be able to go to the loc at a particular offset, by dichotomy, and not by sequentially following the children seqs
14:10qbgmebaran151: Why do you want to inherit protocols?
14:10lpetitchouser: ^^ I'm pretty sure you've reached the problem before ?
14:11mebaran151so my use case is basically this: let's say I'm writing a server that can add different things
14:11technomancytridd3ll: sure; I like it when people help newbies; I just don't want people to be intimidated by the apparent unnecessary complexity.
14:11tridd3lltechnomancy: it's actually just a exerpt from my personal wiki which I made available on my blog... so I'm not really trying to provide the best/easiest approach for new users
14:11mebaran151so my first stab is I design a protocol to add and substract the real numbers
14:12lpetitI've some ideas on how to enhance the situation. Basically, this involves adding 2 primitive clojure.zip ops: one for getting the count of a branc loc's children (using count, so could adapt to the underlying data structure of the children: seq or vector ...)
14:12technomancytridd3ll: oh, I see the official instructions are linked now; that should help a lot; thanks.
14:13mebaran151and a deftype with the implementation
14:13tridd3lltechnomancy: right which is why I should probably refrain from pointing it out unless it specifically could help the situation... hard not to though since I provide little other help to others here :-)
14:13mebaran151now I want to build a thing that can add substract multiply and divide
14:13mebaran151I have an addition substracton deftype and a multiply divide deftype
14:13lpetitand the other primitive being a function allowing to jump directly at a given children index (again, if possible, leveraging the datastructure characteristics of the underlying children container)
14:13lpetitThoughts ?
14:13tridd3lltechnomancy: since I don't get as much time with clojure as I'd like
14:13mebaran151I want to combine them into a math deftype
14:13mebaran151how do I do that?
14:14qbgmebaran151: What do the deftypes actually represent?
14:14mebaran151do I just follow a container pattern and delegate to the original types or is there an easier way
14:14mebaran151well in my sytem
14:14mebaran151they represent differnt sets of server operations
14:14mebaran151and I'd like to combine them to actually represent the fully fledged server
14:15pdelgallegotechnomancy, tridd3ll so how I install swank and make it work with emacs. I use ELPA for other packages.
14:15tridd3llLauJensen: thanks! ... fellow Arch user right?
14:15qbgmebaran151: Do you have some example code on how you are using it?
14:15LauJensentridd3ll: thats right
14:15qbgIt sounds like you are making the problem more difficult than it needs to be
14:15herdricksay, is there a (drop-first n seq) somewhere in the libs?
14:16raek_drop?
14:16raek_,(drop 3 [1 2 3 4 5])
14:16lpetitLauJensen: ever used clojure zippers ?
14:16clojurebot(4 5)
14:16pdelgallegotechnomancy, If I try to install swank with the cljr it tells me that I an artifact is missing.
14:16mebaran151I very well may be
14:16LauJensenlpetit: sure - We had a whole lab on them at Conj Labs Brussels :)
14:16mebaran151what I'd like is a great simple write up on these new features
14:16mebaran151I feel my OOP training is starting to take over a little too much
14:16herdrickraek: oh, oops, thanks
14:17qbgmebaran151: From what you are describing, it almost sounds like a map of functions might be what you want instead
14:17lpetitLauJensen: great, so you probably have an interesting idea / comment / suggestion concerning my above problem ^^^;-)
14:18mebaran151qpg, it was previously a map of functions
14:18mebaran151but I'd like to more formally document the interface
14:18tridd3llpdelgallego: like we were just speaking of, my approach is pretty specific and doesn't use ELPA at all... if you are going that route, I would follow the documentation with that approach... but I would think you would use leiningen to start the swank server (as outlined in my approach) and then connect to it from emacs (also as outlined.)
14:19qbgmebaran151: Exploiting polymorphism is the way to do it
14:19pdelgallegook, tridd3ll Im going to try that.
14:19dprotridd3ll: where can I find "your approach" ?
14:20LauJensenlpetit: No, I think your right in seeing that the current zipper implementation isnt geared for it, but the best way to implement it .. hmm
14:20tridd3lldpro: http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
14:20raek_pdelgallego: it happened to me once that the dependency downloading thingy thinks that some obviosly existing artifacts are missing (for example, clojure). at that time, removing everything in ~/.m2 solved my problem
14:20LauJensenELPA is horrible
14:21dprotridd3ll: cheers
14:21pdelgallegoLauJensen, I agree with you. I avoid it if I have the option.
14:21tridd3llfor the record, I don't use ELPA because I'm more of a control freak about the config side, not because I tried it and didn't like it
14:21raek_luckily, it's doable to set up clojure-mode and slime without elpa
14:22raek_if one detests it...
14:24tridd3lldpro: this really is two different configs though, one for command line repl and then one for emacs... all of the steps are not really required... but it does demonstrate how the different pieces work
14:25dprotridd3ll: ah I *think* I got it working ... just let me check if I can connect from emacs ...
14:25mebaran151qpg, what do you mean?
14:26qbgmebaran151: Protocols are all about polymorphism
14:26mebaran151so there really isn't any idea of implementation inheritance
14:27mebaran151or do I just wire it up differently outside of deftype and friends
14:27dprocloser, closer ... the repl isn't answering but I'm connected, it complained about a version mismatch but I guess once I fixed that I'm good to go
14:27mebaran151dpro, slime always complains about version mismatch
14:27mebaran151you can ignore that
14:27tridd3lldpro: I think it always says that
14:28technomancythat's a bug in slime; just ignore it. you can setq slime-protocol-version to make it go away.
14:28qbgIf you need to implement a protocol on multiple types where the implementations are largely the same, you would make use of extend
14:29qbgBut that does not seem like the right solution to me from what I've heard so far
14:29dproah ok, well now the repl /looks/ fine but it doesn't answer, and even when in clojure-mode C-x C-e evaluates it as elisp ..
14:29dprotechnomancy: thx
14:30thunkdpro: Your repl is hanging? It's probably the slime-autodoc bug. You need to (unload-feature 'slime-autodoc).
14:31thunkThis is getting to be a real problem.
14:31raek_,(let [pop-peek (juxt pop peek) stack [1 2] [stack arg1] (pop-peek stack) [stack arg2] (pop-peek stack)] (conj stack (+ arg1 arg2)))
14:31clojurebot[3]
14:33pdelgallegoraek_, you was write, after cleaning ~/.m2 the problem disappear.
14:33raek_great!
14:42raek_oh, how neat. here the author of juxt eplains its rationale: http://groups.google.com/group/clojure/browse_thread/thread/c960ec89bd0a85ac
14:44mebaran151qpg I think I get it now
14:44mebaran151thanks
14:45LauJensenraek_: theres a lot of good stuff like that on the list, also the story behind reductions
15:01lpetithello, question 'bout the implementation of vectors, w/regards to subvec
15:02pdkvectors are implemented as arrays if i recall lpetit
15:02pdkotherwise theyd be kinda redundant :p
15:02lpetitsubvec "shares structure" with the initial vector. But is there a chance that over time, parts of the initial vector that are not referenced anymore by subvecs are gcd ?
15:02lpetitpdk: not at all
15:03qbgIIRC, it holds a reference to the entire initial vector
15:03lpetitpdk: see the very recent (today, yesterday ?) discussion on clojure's l for more info
15:03lpetitqbg: :(
15:03NikelandjeloIs there built in data structure, which allows randomly retrieve and delete elements from it? Vectors and lists doesn't allow to delete random element (as I know), and sets doesn't allow to get random element.
15:04qbgNikelandjelo: maps?
15:04Nikelandjeloqbg: How can I get random key in map?
15:05pdkstep over (keys map) and stop at a random point
15:05lpetitqbg: so starting to use subvec in a general way with possibly big datastructures is kind of a recipe for disaster
15:05qbgBy random do you really mean random?
15:05Nikelandjeloqbg: Yes :) like (rand-int ...)
15:05ChousukeNikelandjelo: there is no such data structure, unfortunately
15:05qbglpetit: Yes; as the doc for subvec says, no trimming is done
15:06pdk(let [keylist (keys mymap)] (nth keylist (rand-int (count keylist)))) perhaps
15:06Chousukea map with integer keys might work though
15:06Chousukebut it has a fair bit of overhead :P
15:06lpetitqbg: chouse Oh chouser, when will your finger tree be ready ? :-)
15:06pdkwhat's the scoop on this finger tree
15:09qbgYou could pair a map and a vector of keys together...
15:09NikelandjeloI thought about (let [shuf-seq (shuffle my-seq)] ...) (first shuf-seq) - to get random, (rest shuf-seq) to delete it. But it also a bit strange
15:09lpetitpdk: finger trees are even better than vectors in lots (all ?) of areas, allowing to delete items in the middle of them, insert in the middle of them, and, hopefully, create a sub-finger-tree from an existing one with structural sharing, but as few as possible (when sub vectors are just a reference to the existing vector, and a range within this vector)
15:11ChousukeI wonder what happened to chouser's finger tree implementation
15:11Chousukelast time I heard anything of it, it was working but needed polish, or something
15:13qbgNikelandjelo: Since you want a random element, I presume you don't care about the order of the elements in the structure?
15:14Nikelandjeloqbg: Yes
15:14qbgJust use a vector then
15:14Nikelandjeloqbg: With shuffle?
15:14qbgWhen you want to delete an element, replace it with the one at the end and shrink the vector
15:14Nikelandjeloqbg: Hm :)
15:14qbgUse (rand-int) to get a random index
15:16lpetitChousuke: hopefully it'll be polished and released with the book publication, since it's mentioned several times in it, if I remember correctly
15:16ChousukeMaybe chouser will get it included in 1.3 too :P
15:18lpetitChousuke: working with cgrand on the parsley reader, and finger trees would have been useful more than once already
15:18lpetits/parsley reader/parsley parser/
15:18sexpbotChousuke: working with cgrand on the parsley parser, and finger trees would have been useful more than once already
16:15mebaran151what's the best way to test if one vector is a subvector of another
16:22lpetitmebaran151: consecutively testing for equality the vector with subvectors of the same length starting from increasing indexes ?
16:22lozhboyer-moore works for finding a string within a string, not sure off the top of my head if it generalises to vectors
16:23mebaran151lpetit, I was thinking maybe there was a library function
16:23mebaran151I'm basically doing that now
16:23mebaran151except I do an element loop
16:23Chousukemebaran151: subvectors in clojure are instances of a special class, aren't they?
16:24mebaran151hmmm?
16:24mebaran151all I meant was I have the vector [:a :b :c] and [:a :b]
16:24Chousukeah, I was thinking of subvec :P
16:25lpetit,(subvec [:a :b :c] 2 3)
16:25clojurebot[:c]
16:25lpetit,(subvec [:a :b :c] 2 8)
16:25clojurebotjava.lang.IndexOutOfBoundsException
16:29lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (count s)) (range 0 (- (count v) (count s)))))) [1 -1] [1 ])
16:29clojurebotnil
16:29lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (count s)) (range 0 (- (count v) (count s)))))) [1 -1] [1 2 3])
16:29clojurebotnil
16:30lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (count s)) (range 0 (- (count v) (count s)))))) [1 2] [1 2 3])
16:30clojurebottrue
16:30lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (count s)) (range 0 (- (count v) (count s)))))) [2 3] [1 2 3])
16:30clojurebotnil
16:30lpetit:-(
16:30lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (count s)) (range 0 (inc (- (count v) (count s))))))) [2 3] [1 2 3])
16:30clojurebotnil
16:32lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (+ % (count s))) (range 0 (inc (- (count v) (count s))))))) [2 3 4] [1 2 3 4])
16:32clojurebottrue
16:32lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (+ % (count s))) (range 0 (inc (- (count v) (count s))))))) [2 3 4] [])
16:32clojurebotnil
16:32lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (+ % (count s))) (range 0 (inc (- (count v) (count s))))))) [] [])
16:32clojurebottrue
16:32lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (+ % (count s))) (range 0 (inc (- (count v) (count s))))))) [1] [])
16:32clojurebotnil
16:32lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (+ % (count s))) (range 0 (inc (- (count v) (count s))))))) [1] [1])
16:32clojurebottrue
16:32lpetitmebaran151: there we are ^^^
16:34mebaran151I don't think subvecs are the best way to go actually
16:34mebaran151I'm just looping through the old fashioned way
16:35mebaran151testing for an element that matches the first element
16:35mebaran151then saving that offset and testing the rest
16:36alexykninjudd: ping
16:36ninjuddalexyk: yo
16:36lpetitmebaran151: does your algo work with eg. (subvec? [1 2 3] [1 1 2 3]) ?
16:37alexykfinally am back to clojure from haskell and ocaml, trying cake! how do I *stop* a cake's jvm when done with a project for a while?
16:37lpetit,((fn [s v] (some #(= s %) (map #(subvec v % (+ % (count s))) (range 0 (inc (- (count v) (count s))))))) [1 2 3] [1 1 2 3])
16:37clojurebottrue
16:37ninjuddcake stop
16:37alexykninjudd: cake help doesn't show that
16:37mebaran151let me check
16:37ninjuddor 'cake kill --all' will stop all cake JVMs
16:37mebaran151yep
16:37mebaran151it fails
16:37mebaran151heh, lpetit you got me
16:37lpetitmebaran151: hehe :-p
16:37mebaran151I guess I could try for the next element
16:38mebaran151but I suppose them I'm just doing the subvec way
16:38alexykninjudd: why is there 2 servers per project, one use 'cake, another use 'bake ?
16:38lpetitmebaran151: you'll end up reimplement vector equality
16:38ninjuddalexyk: yeah, i took the implicit system tasks out of cake help. probably a mistake
16:39alexykninjudd: you can list them after a banner "make sure you're not an idiot to use these: ..."
16:40ninjuddalexyk: so cake's dependencies don't pollute your project JVM (http://wiki.github.com/ninjudd/cake/faq)
16:40alexykninjudd: so it uses full maven internally like lein, right? meaning it will download to my maven repo, and it will try it first?
16:41mfexmebaran151: (defn subvec? [subv v] (some #(= subv %) (partition (count subv) 1 v)))
16:41ninjuddalexyk: yes
16:41mebaran151mfox
16:41mebaran151that's fancy
16:41alexykninjudd: so I go to git and clone cake; then switch there, do cake help, it starts downloading cake libraries. Gets 0.3.6. Then cake compile says nothing; I assume it's self-build, equivalent to lein self-install?
16:42mfexinspired by the [1 2 3] [1 1 2 3] case from lpetit
16:42alexykhow do we show clojure version from repl?
16:43lpetitmfex, mebaran151: beware the partition stuff will turn this into some O(nxM) complexity
16:43chouseralexyk: (clojure-version)
16:43chousercould use subvec instead of partition
16:43lpetit(defn subvec? [s v] (some #(= s %) (map #(subvec v % (+ % (count s))) (range 0 (inc (- (count v) (count s)))))))
16:44lpetitchouser: that was my initial implementation offering ^^^
16:44chouserthough it'd be O(nm) anyway. = is n, some is m
16:44lpetitchouser: oh yes :-(
16:44ninjuddalexyk: yes, it downloads cake's dependencies automatically
16:46alexykchouser: is there a raw IRC log, un-html-ized?
16:47alexykI need to process it and hate to de-htnl-ize it, though I could
16:47chouseralexyk: updated manually by request earlier today: http://clojure-log.n01se.net/clojure-logs.tar.bz2
16:47alexykchouser: very nice, thx! you may want to just keep raw available separately
16:48lpetit,(-> (clojure.zip/xml-zip {:tag :root :content [{:tag :any :content ["foo" "bar"]} "bar"]}) clojure.zip/down clojure.zip/right)
16:48clojurebot["bar" {:l [{:tag :any, :content ["foo" "bar"]}], :pnodes [{:tag :root, :content [{:tag :any, :content ["foo" "bar"]} "bar"]}], :ppath nil, :r nil}]
16:48lpetit,(-> (clojure.zip/xml-zip {:tag :root :content [{:tag :any :content ["foo" "bar"]} "bar"]}) clojure.zip/down)
16:48clojurebot[{:tag :any, :content ["foo" "bar"]} {:l [], :pnodes [{:tag :root, :content [{:tag :any, :content ["foo" "bar"]} "bar"]}], :ppath nil, :r ("bar")}]
16:48chouseryeah, I suppose. Originally I didn't because the raw logs had multiple channels mixed in, but they should all be sanitized now...
16:48alexykchouser: kind of cute to see the first day :)
16:48chouser:-]
16:49chousermy first day. The channel had been around for some weeks or months already.
16:49lpetitchouser: ^^^is it true to guess that left nodes are stored in vectors in order to be able to append/remove from the tail, and right nodes stored in a list in order to be able to append/remove from the start ?
16:49alexykchouser: ah ok.
16:50crontabmebaran151: for large vectors I think the Knuth-Morris-Prat or similar fast string search algo might be more efficient
16:50chouserlpetit: I don't know -- I don't think I've ever looked that deeply at the implementation of zip
16:51alexykninjudd: wow, evil speed! cakr jar is just like, here's your jar, whatever
16:51alexykcake
16:52alexykomg, cake's in ruby
16:52alexyka Balrog in Clojure city
16:52lpetitchouser: oh ok. FYI, I'm trying to add the missing primitive so that I'll be able to traverse down a structure by dichotomy on the children when that makes sense (e.g. the passed children function when creating the zipper returns something that we can do dichotomy on, e.g. a slight modification of xml-zipper, etc.)
16:53chouserwhat do you mean by "by dichotomy"?
16:54ninjuddalexyk: we chose ruby because it is more platform independent than bash
16:54alexykninjudd: true, you need to talk to ports and launch stuff
16:54ninjuddalexyk: in fact, cake mostly works in windows even
16:54lpetitchouser: take a loc which represents a node with lots of children, and you want to go to the loc corresponding to the middle child
16:55chouserlpetit: ok, interesting.
16:55ninjuddalexyk: but most of cake is written in clojure. only the client script is in ruby
16:55alexykninjudd: I now have a dual-boot environment on my MacBook, with Windows 7, and share my maven repo and run IDEA in each. Will be cool to run cake in both too.
16:56lpetitchouser: I added an overloaded version of clojure.zip/down which takes a second argument. Works similarly to the original down, but would call some additional (split idx children) function passed when creating the zipper
16:57alexykninjudd: so to share jvm, I must run cake command from the project directory, correct?
16:57chouserit'll be faster than just walking to the idx?
16:57chouseror is that not the point?
16:57ninjuddalexyk: or any subdir of your project
16:57ninjuddalexyk: otherwise, cake will use the global JVM based in your home directory
16:58alexykninjudd: so say I have a file test.clj. What do I do to load it into teh project jvm?
16:58alexykcake compile?
16:58ninjuddjust put it in project_dir/src
16:58alexykninjudd: I did, now I edit it, it's changed.
16:59alexykor I added a .clj file after cake started
16:59lpetitchouser: it's the point. Imagine the parsetree for clojure/core.clj. Maybe 400 top level nodes. If I can find the index of the node I want by dichotomy, and then calling (down root-loc idx) jumps directly to the right loc, splitting the vector in the middle, I can expect some gain
16:59ninjuddcake will reload automatically
16:59lpetitchouser: hopefully
16:59alexykninjudd: even if I drop a new .clj?
16:59ninjuddyeah, when you run another command
17:00ninjuddor you can run 'cake reload' to do it explicitly
17:00lpetitchouser: when my experiment is finished, if something generic emerges, I'll post something on the ml
17:00alexykninjudd: should be in cake help for sure! :)
17:01chouserlpetit: cool
17:01alexykis there any use to cake install itself into maven repo? or teh binary pointing in git is fine?
17:01lpetitchouser: so, how is John Mac Carthy in the real life ? Is he smart ? Tall ? ;)
17:02chouserlpetit: nice try
17:02ninjuddalexyk: not sure i understand. let's discuss in #cake.clj
17:02lpetit:-D
17:33lpetithow do I jump out of 2 recurs at once ? (does this make sense, or do I need to go to bed ? :) )
17:33lpetits/2 recurs/2 loops
17:58igmsHello, what is the best way to get clojure on osx with all the proper configs.. I've used ClojureX before, but I see that it is discontinued
18:12dnolenigms: what dev environment do you use?
18:13technomancyigms: I think clojureX was deprecated in favour of cljr, which people seem to like.
18:13technomancyhaven't used it myself.
18:14igmsdnolen: textmate with clojure bundle
18:15igmstechnomancy: so I was just looking at clj from liebke
18:15dnolenigms: I would use cake. cljr is not so nice on OS X. I'm working on supporting basic slime-ish commands in TextMate with cake.
18:17dnolenigms: on os x installing cake is a cinch, sudo gem install cake
18:17leifwso it's a piece of what, then?
18:19igmsdnolen: thanks I'll give it a try
18:21dnolenigms: technically it's a build tool, but the out of the box REPL is really, really stellar, and JVM startup times are less of an issue because it uses persistent VMs.
18:29mebaran151lein repl I reember used to provide a decent repl too
18:46mebaran151are ther eanything like active record schema migrations for clojure and sql backed database work?
18:47wolfjbis there something like progn in clojure?
18:47scottjwolfjb: do
18:48wolfjbah, thanks
18:56wolfjbwhy does main have - in front of it? (ie why -main)? are there other functions with a preceding dash? where would I read about them? I did a search for -main on the clojure site which didn't return anything
18:57anarsdid anyone successfully run clojure-clr on mono?
18:57mebaran151wolfjb, I think -main is an artifact from older versions of control where generating java types was a little harder
18:58mebaran151it let's you specify that certain methods in the namespace are not going to mangled (like main) so that you can use them as the main entry point to an application
18:58anarsI got it running on windows, but afaik the MS DLR does not work on mono; it includes the DLR as a part of the .NET 4 profile.
18:59wolfjbmebaran151: thanks. I did try to remove the - from -main but I got an error when I tried to run the uberjar created by lein.
18:59wolfjbit seemed to be needed
18:59wolfjbis this going to change?
19:00wolfjbI'm using version 1.1.0 of clojure
19:00mebaran151yeah
19:00mebaran151you need the -
19:00wolfjbalrighty
19:00mebaran151to make sure the method doesn't get mangled
19:00mebaran151otherwise I think lots of numbers could get attached to the end and things like that
19:00wolfjbic
19:00mebaran151it really only affects ahead of time compiling
19:01mebaran151telling the Clojure compiler to basically make a static method that it links to the var that actually holds your main method
19:01wolfjbcool, thanks for the explanation!
19:01wolfjbI was looking for it and just didn't find it
19:01wolfjbmuch appreciated
19:01wolfjb:-)
19:06lpetitchouser: yeah, having implemented dichotomy utility fn for my zipper gives a real gain. Not timed it accurately, but from subjective tests, e.g. reindenting the 4000's line of my file (starting from a pre-existing parse tree) is half a second with no dichotomy, and feels instantaneous with dichotomy
19:06chouserhm, excellent.
19:08lpetitOMG, 1 am here, I'm exhausted. cu guys
19:52mebaran151is there away to specify a default value for the constructors of a deftype
21:21chousermebaran151: you almost always end up needing your own function for creating them anyway, so you can use that to specify default values.
21:21mebaran151ah alright
21:21mebaran151thanks
21:22mebaran151also, is there a convenience method from hashmap to defrecord (say for the returned results from clojure.contrib.sql)
21:23chouserhm... last I heard one was planned but did not yet exist.
22:02defnis there a way to enumerate all of the possible namespaces that are defined?
22:03defnfor instance, i open a REPL: (ns foo.bar) (defn baz [] nil) (ns foo.boo) (defn booz [] true)
22:03spewn,(all-ns)
22:03clojurebot(#<Namespace clojure.contrib.sql.internal> #<Namespace dk.bestinclass.clojureql.util> #<Namespace clojure.set> #<Namespace hiredman.clojurebot.simplyscala> #<Namespace clojure.contrib.macro-utils> #<Namespace clojure.contrib.seq> #<Namespace hiredman.sandbox> #<Namespace hiredman.schedule> #<Namespace clojure.contrib.generic> #<Namespace hello-from-rae¨k> #<Namespace opennlp.nlp> #<Namespace clojure.pprint> #<Namespace hi
22:03defnspewn: thanks
22:03defnns-list might be more helpful tbh
22:03defn(as a name)
22:48arohneris there a drop-nth anywhere?
22:48arohnerjust asking before I write my own
23:16VotingI'm an old LISP programmer from lisp machine days... can anyone give me a sense of the populariy and growth of Clojure?
23:17Votingand the best things for me to read to get to be really good with Clojure, esp. calling existing Java code?
23:18RaynesVoting: Not claiming it to mean much, but when I first joined about a year and a half ago, there was an average of 120 people in this channel. Now it averages around 260 at the peak of the day.
23:18Raynes~max
23:18clojurebotmaxine is http://research.sun.com/projects/maxine/
23:18VotingRaynes: heartening for a guy like me to see lisp seeming to come back!
23:19Raynes:)
23:20RaynesIf you're looking for books, there are several around. Practical Clojure is the latest book in print. The Joy of Clojure is an awesome book, but it wont be in print until around November. The book is finished save for technical review, and it's available as an MEAP through manning if you preorder the print version or buy the ebook version.
23:20RaynesThere is also a tutorial here: http://java.ociweb.com/mark/clojure/article.html
23:20VotingWhere can I find docs about how OO is done in Clojure... do people like it?
23:20RaynesIt's a fairly comprehensive introduction.
23:21Votingnice!
23:21lancepantzVoting: I second the joy of clojure
23:21rhudsonI'll third that.
23:21Votingah, ok, thanks folks!
23:21RaynesClojure isn't an object oriented language. You don't do traditional OO in Clojure. Clojure offers extremely flexible polymorphism through multimethods. Also, records and protocols.
23:21arbschtVoting: about OO: http://clojure.org/state
23:21VotingJoy would be good for a person w/ a big common lisp background?
23:22RaynesVoting: It'd be perfect, I'd say.
23:22rhudsonThe project web site is well worth looking at: clojure.org, especially all the links down the left-hand side
23:22Votinghow do clients seem to feel about a clojure implementation of there software?
23:22RaynesIf you're interested in the rationale for Clojure not being OO, check out the link arbscht gave. I believe Rich Hickey has addressed it in some screencasts and presentations as well.
23:24Votinghow easy is it to call Java code and to get called by java? do I have to do lots of overhead crap to do it or is it easy? (I'm talking about PROGRAMMER efficiency rather than run time efficiency.)
23:24rhudsonIt's both
23:25rhudson,(System/currentTimeMillis)
23:25clojurebot1281410793564
23:26rhudsonhttp://clojure.org/java_interop
23:26rhudsonYou might find this comparison (to CL & Scheme) useful: http://clojure.org/lisps
23:28rhudsonnew Foo( bar.baz() ) ==> (Foo. (.baz bar))
23:35Votingwhat about programming env stuff like leiningen and slime, etc?
23:35Votingwhere can I read about that sort of thing?
23:37rhudsonLeiningen: http://github.com/technomancy/leiningen
23:38rhudsonslime I don't know; I'm not of the emacs persuasion
23:39rhudsonHere's a survey of using Clojure with various programming environments: http://www.assembla.com/wiki/show/clojure/Getting_Started
23:47igmsNewb question: To write some sort of a server in clojure, would I need to tap into JVM or look for like a 3rd party lib written in clojure?
23:54scottjigms: either.
23:54Raynesigms: If you're talking about a web server, there is stuff like Aleph and ring-jetty-adapter around. I believe there is a library in contrib for regular servers.
23:55lancepantzigms: you're probably interesting in compojure and ring
23:56igmsWell more like a basic tcp listener or tcp client .. not so much the web stuff
23:56igmsso networking in general
23:57Raynesigms: In that case, check in contrib. I'm almost certain there is *something* there for that sort of thing.
23:57igmsthanks