#clojure logs

2010-05-11

00:00rlmcintyrebut for CLI scripts you could create a persistent JVM like with nailgun and then it would be much faster; most of the time taken up with short scripts is the initialization of the JVM.
00:01technomancyrlmcintyre: you still need shell scripts in there somewhere to set up the classpath
00:01mmarczyktechnomancy: is your long-term (?) plan to remove swank-clojure.el altogether?
00:02technomancya pure-clojure CLI app would be very, very awkward
00:02mmarczyktechnomancy: asking because I'm trying to figure out where best to try and squeeze in slime-repl advice stuff for colouring
00:02technomancymmarczyk: no, I won't remove it. I'll just stop updating it and spin it off into a separate library once I find a volunteer to maintain it
00:02technomancymmarczyk: could be a candidate for an entirely separate package
00:03hiredmantechnomancy: need to compile clojure to sh
00:04technomancyhiredman: or port it to another host
00:04ravanamely what i'm liking most is that i've been able to abstract away my remaining needed shell/perl scripts into a dsl
00:04mmarczyktechnomancy: I take it you expect clojure-mode to be enough to use slime-repl though?
00:04technomancymmarczyk: yes, but slime-repl is not a dependency of clojure-mode
00:04mmarczyktechnomancy: also, I've sent you a pull request for the basic refactoring needed for a sane approach to coloured repl
00:04technomancymmarczyk: there are two defuns in clojure-mode that pertain to slime.el, but they're clearly optional.
00:05technomancymmarczyk: cool, pull requests for clomo?
00:05mmarczyktechnomancy: sure
00:05technomancy(clomo being ido-shorthand for clojure-mode)
00:05mmarczyktechnomancy: yup
00:05technomancygreat
00:05mmarczyktechnomancy: I've tried to abide by your contributing guidelines (the blog post, I mean) :-)
00:08technomancynice. don't worry, in real life I'm not as picky as I sound in that post
00:10mmarczyk:-)
00:18technomancymmarczyk: thanks; merged
00:20mmarczyktechnomancy: great! :-)
00:21mmarczykRaynes: that's really neat :-)
00:21Raynes:3
00:58ravaRaynes: why not have the printer in an iframe so the refresh doesn't require the whole page?
00:58Raynesrava: What?
00:58ravahttp://tryclj.licenser.net/
00:58sexpbot"TryClojure"
00:59RaynesBecause I have no clue what I'm doing.
00:59Raynes'bout sums it up.
00:59ravalol
01:00Raynesrava: I'll see about that.
01:18ravaRaynes: the syntax highlighting IS spiffy :)
02:30zmila"=> (i++ 12345678901234)
02:31zmilajava.lang.Exception: EvalReader not allowed when *read-eval* is false."
02:31zmilayour repl doesn't permit BigInts?
02:35zmilas/i++/inc/
02:35sexpbotyour repl doesn't perminct Bincgincnts?
02:43RaynesHeh heh. Fail.
02:51ravahrm, people should watch this ted talk to get functional programming i think: http://www.ted.com/talks/george_whitesides_toward_a_science_of_simplicity.html
02:51sexpbot"George Whitesides: Toward a science of simplicity | Video on TED.com"
03:14scottjrava: I don't agree, I think everything he says in that lecture is either obvious or useless.
04:12vegaithe seq function is a bit of a mystery to me
04:12vegaiit doesn't seem to do much, does it?
04:12vegaidoes it have other uses than returning nil for empty list?
04:12tgkYou can use it to generate seqs from iterables
04:13tgkor on strings
04:17cschreinerrava: I agree
04:19ravacschreiner: maybe i'm inferior for it, but i needed a way of talking about functional programming like a set of simple functions that can be stacked to produce correct complexity
04:21cschreinerrava: I don't know much about "correct"
04:21ravacschreiner: correct as in "the planned for" resultant complexity
04:22cschreinerrava: at some point, you don't want to think about things that are, since you've shifted focus to somewhere different (in your system)
04:22cschreinerrava: this is what complexity is to me
04:22ravacschreiner: like a bunch of functions to manipulate pixels on the screen stacked to render animation
04:23cschreinerrava: I'm with you
05:04BorkdudeI think I'm right about asking Java questions here instead of in #java
05:05Licenser_Borkdude: didn't we had that topic yesterdaz?
05:06BorkdudeLicenser_: yeh, but I tried the #java channel and my thoughts were confirmed ;)
05:06Licenser_so what do you learned?
05:08Borkdudethey aren't as helpful as people in here
05:09Licenser_Borkdude: not quite: don't use java!
05:09BorkdudeLicenser_: of course, I forgot
05:12BorkdudeWhat is the word for 'more specific' question of another question: a specification of the more general question?
05:17Licenser_Borkdude: specific?
05:18BorkdudeLicenser_: and then a noun?
05:20Licenser_hmmm
05:21_atorefinement
05:22Borkdudeah
05:23BorkdudeWhat is the opposite of "generalization"
05:23BorkdudeI would say "specification"
05:24cschreinerdiscrimination?
05:26_atoyeah, although I don't think I've ever heard "specification" used much when referring to questions. Then again, I haven't heard generalization used much when referring to questions either, but it sounds better somehow than specification
05:27_atoI guess I hear contexts more like "more specific version of the question" "could you refine your question?" etc
05:27_atoanother one might be "narrowing"
05:27_atodepending on context
05:28_atoah!
05:28_atoBorkdude: "specialization"
05:28_atothat's a closer oppose to generalization
05:31Borkdude_ato: ah of course
05:31Borkdudetnx
05:33cschreinercan someone point to a good use of the defrecord statement?
05:36cschreinerseems to me that it is just a composition of defprotocol and several implementations?
05:44cschreineroh well, protocols in clojure is almost like protocols in obj-c
05:45AWizzArdcschreiner: defrecord can be the typical building block for your values
05:46AWizzArd(defrecord User [username password name zip age account salary friends])
05:46cschreineryes, I see that, helps to experiment a little :-/
05:46AWizzArd(defrecord Account [money bankname credit])
05:46cschreinerok
05:47cschreinerso to use that instance, Account, I would do what?
05:48AWizzArd(Account. 4000 "Fantasy Bank" "1000")
05:48cschreinersince there is no ctor associated with it
05:49cschreinerah, of course
05:49naeuwould it be wise to use a multimethod to define different implementations of a given function depending on the type of the second argument?
05:49cschreinerlooks like defstruct
05:50AWizzArdAnd such things can then be stored in a user (User. "cschreiner" "pass" "Schreiner" 123 25 (Account. 100 "Schreiner-Bank" 1000) 5000 [])
05:50AWizzArdcschreiner: yes, very much like defstruct, but faster
05:50cschreinerAWizzArd: thats very helpful, thanks!
05:50AWizzArdfor some moments it was planned to not introduce defrecord, but instead let the old defstruct disappear and make the new one be defrecord
05:51AWizzArdBut then for the sake of compatibility defstruct was left in the game, and defrecord was introduced.
05:51cschreinerI see
05:55cschreinercould this be seen as a parameterization of functions?
05:56AWizzArdWhat do you mean by that?
05:57tomojdid I miss the difference between defstruct and defrecord?
05:57tomoj(just got here)
05:58cschreinerhard to explain, since I am not a native speaker, but I see it as: functions that can vary their implemention, since you are passing a *something* (protocol?) into its first arg position
05:58cschreinerthis is how I read the code, perhaps I've got it completely backwards :)
06:01AWizzArdtomoj: defrecord produces a new (jvm) class
06:02AWizzArdcschreiner: that is about polymorphism. Depending on the type of the first arg of a protocoll function a specific implementation is called, and this is decided during runtime.
06:03tomojAWizzArd: of course
06:03tomojso it's like half way between a deftype and a defstruct...?
06:04cschreinerit's an interesting concept
06:04tomojI still feel like I have no idea when to use any of these new things :(
06:04AWizzArdNot necessarily a fight. In principle for pretty much all cases defrecord is the right thing to use.
06:05AWizzArdI don't know, maybe defstruct is now even deprecated.
06:05cschreinertaking the polymorphic perspective, things fall nicely into place
06:05tomojdefrecords act like maps, I assume?
06:05AWizzArdtomoj: yes
06:05AWizzArdcschreiner: Protocolls are a special case of Multimethods.
06:05tomojok, I love the simplicity of maps and am somewhat scared of all this OOP-sounding crap
06:05tomojbut if they still act like maps, I suppose it's ok
06:06AWizzArdthey let you do less things, but much faster, and Protocolls are fine for the typical 90% of all use cases. For the others there is still defmulti.
06:06cschreinerAWizzArd: I never got a proper grasp of multimethods, this thing looks more usable, I think
06:07AWizzArdProtocolls are very similar to the typical polymorphism of C++, Java, C#, Python, Ruby, etc.
06:07AWizzArdThe dispatch on the type of the first argument. That's it.
06:07AWizzArdMultimethods can dispatch on anything and on any of the args.
06:07AWizzArdIt does not have to be the type.
06:08cschreinerwonderful
06:09AWizzArdbut most often most people need in most situations just the type of something, and for those cases Protocolls are preferrable, as they are very performant.
06:09AWizzArdIt is pretty much the original Java speed
06:15tomojaren't protocols _better_ than typical? :)
06:15tomojrich would create something just as good as feature X in C++
06:16tomojs/would/would never/
06:16sexpbotrich would never create something just as good as feature X in C++
06:30AWizzArdtomoj: with Protocolls you can extend existing classes with functionality without the need to have their sources
06:39tomojyou can do that in java, too :(
06:39tomoj(yes?)
06:40vegaitomoj: no
06:40cschreinernope
06:40cschreineryou can in obj-c
06:40vegaiwell, I guess you can do it somehow in java too
06:40vegaiafter all, clojure's kinda doing it.
06:42BorkdudeAWizzArd: is protocols similar to Extension Methods in C# maybe?
06:42ChousukeThe classes are not extended
06:42Chousukethe protocol is
06:43Chousukea protocol covers a set of classes and that set is extensible
06:44BorkdudeChousuke: in C# it is just syntactic sugar, you add static methods around classes, but it seems they are part of the classes themselves
06:44Chousukeso they wrap the class?
06:45Borkdudeyes, but you can call them as if they belong to the class
06:45Borkdudethey don't change the original code
06:45Chousukeright.
07:00tomojah, yes, I see what you can't do in java that you can with protocols, I think
07:01naeuif I want to create a new thread to use a polling mechanism (essentially calling a function, obtaining a value and then conditionally calling a set of callbacks with that value) what might be an idiomatic approach?
07:02AWizzArdtomoj: just write your own java interface offering the method foo() and make Strings implementing this interface.
07:02AWizzArdYou will see that this is not trivial, because you can't add this to the source code of the class String.
07:02AWizzArdThough this may change in Java 7, where interface injection might become available.
07:06tomojhadn't heard about that, cool
08:09samlhow do I start out compojure on windows?
08:09tomojshould be the same as compojure anywhere else
08:10tomojI mean, once you've got clojure working
08:10samllein is experimental on windows
08:11tomojand lein, then, too :/
08:11tomojbut compojure itself should be any different, I mean
08:12AWizzArdsaml: instead of a compojure.jar just let your CP point to the sources. You can download them from github as .zip and unpack them somewhere (into your CP).
08:13samlokiez. is it easy to package a clojure web application into a single jar that could be run as java -jar blah.jar 8080 ?
08:14samloh it's java i think i know where to look
08:18Chousukesaml: leiningen makes that pretty easy
08:18Chousukethough the resulting jar will be quite large :P
08:19samlwhy would it be large?
08:19AWizzArdIt is also not be difficult with Ant.
08:19samlclojure + clojure-contrib + .... or does leiningen add its own libraries to jar?
08:19AWizzArd-be
08:20chousersort-by takes a keyfn, sorted-set-by takes a comparator
08:20chouserseems unfortunate
08:20hamzastand alone compojure app is around 7mb...
08:23AWizzArdchouser: also the differences of how the comparators of sorted sets and sorted maps need to be written is irritating
08:23chouseroh, how are they different?
08:25chouser,(sorted-set-by #(compare (count %1) (count %2)) "z" "cab" "al")
08:25clojurebot#{"z" "al" "cab"}
08:25chouser,(sorted-map-by #(compare (count %1) (count %2)) "z" :a "cab" :b "al" :c)
08:25clojurebot{"z" :a, "al" :c, "cab" :b}
08:26Chousukesaml: it puts in your own code and all of its dependencies
08:26samlChousuke: ah thanks. i'll try lein
08:27naeuI still struggle to get my head into a functional style. How would I cleanly apply a function to each key and val in a map to produce another map?
08:29chousernaeu: there are a couple ways
08:29naeui.e. i want to define an anonymous function which takes two params, k and v and for every pair of k and v in a given map, a new entry in a new map with key k and value being the result of the function would be created
08:29naeu(if that makes any sense)
08:29AWizzArdchouser: a sorted-map's compare will compare two keys, while the one for sorted-sets will compare two values
08:29chousernaeu: (apply conj ...) can take a seq of key/value pairs and use them to build a map
08:30chouserAWizzArd: how else could it possibly be? You want your maps sorted by value!?
08:31AWizzArdimagine you have a (defrecord User [username passwort ...]) Then a compare for a sorted set could look like (fn [^String u1, ^String u2] (.compareToIgnoreCase (:name @u1) (:name @u2)))
08:31chousernaeu: 'into' does that as well.
08:31chouser,(into {} (map (fn [[k v]] [(str k "-san") (inc v)]) {:a 1 :b 2 :c 3})){":a-san" 2, ":b-san" 3, ":c-san" 4}
08:31clojurebot{":a-san" 2, ":b-san" 3, ":c-san" 4}
08:31AWizzArdchouser: no no, it has to be this way, just wanted to point out that this can be irritating
08:32chouserAWizzArd: oh, ok. I tend to think of the things in a set as "keys" so I hadn't noticed.
08:33AWizzArdchouser: and another difficulty is with subseq. Sometimes the start-test and end-test are not intuitive
08:33chouser,(into {} (map (fn [[k v]] [(str k "-san") (inc v)]) {:a 1 :b 2 :c 3}))
08:33clojurebot{":a-san" 2, ":b-san" 3, ":c-san" 4}
08:33AWizzArdplus it would be very nice if there were a (submap ...) and/or (subset ...)
08:34naeuchouser: thanks, that looks interesting
08:34naeuneed to spend some time musing over it first though
08:34AWizzArdchouser: and even nicer it would be if there could be shared structure for those. If you have a set filling 5 GB RAM and then get a subset of it for another 2 GB, it would be neat if those could fit into some few kb/mb.
08:35naeuchouser: mostly because " Returns a new coll consisting of to-coll with all of the items of from-coll conjoined" still sounds alien to me
08:36naeuthe clojure docs often remind me of the times Susanna, my wife, used to discuss matters pertaining to doctors with her medic friends
08:36chousernaeu: 'into' is very useful. it essentially lets you "pour" a seq into whatever collection you give it (a map in this case)
08:36chouseryou could also use 'zipmap' for this if you prefer
08:36chouser,(let [m {:a 1 :b 2 :c 3}] (zipmap (map #(str % "-san") (keys m)) (map inc (vals m))))
08:36clojurebot{":c-san" 4, ":b-san" 3, ":a-san" 2}
08:37Licenser_naeu: as in you have the feeling you have to know it to understand it?
08:37naeuchouser: now why doesn't the doc say something in the manner with which you described
08:37naeuLicenser_: yeah, as in there's this whole other externally incomprehensible domain vocabulary in use
08:37Licenser_naeu: look for walton it is very helpufl
08:37chousernaeu: I couldn't tell you. The current docstring for into and the "pour into" analogy are both straight from rhickey.
08:38Licenser_$walton into
08:38sexpbotCommand not found. No entiendo lo que estás diciendo.
08:38naeuchouser: I'm sure the vocabulary used will only be a positive aspect in the future
08:38Chousukenaeu: "coll" means any clojure collection, and conjoin is the generic "insert" operation for collections
08:39naeuchouser: from what I've seen of Rich it seems that he's very keen on using explicit vocab where necessary, and rightly so
08:39naeuit's just that it's hard when you're an outsider
08:39Chousukeanalogous to cons with lists I suppose.
08:39Chousukebut works for vectors, sets and maps too
08:39Licenser_http://getclojure.org:8080/examples/into
08:40naeuit feels like clojure people will be able to have highly efficient discussions regarding concurrent process which will only sound like gobeldygook to others
08:40Chousukeheh.
08:40rhudsonThe basic definition of (into to from) is (reduce conj to from) -- the doc string pretty much says the latter in English.
08:41Chousukethe actual implementation of into is somewhat more efficient though :)
08:41chouserhm, it's a shame into-array is mixed with into on the walton page
08:41Chousukebut that's the nice thing about it. you don't need to care.
08:41rhudsonChousuke: right, but that's the essence. (And the 1.0 def)
08:41Chousukeit's just the most efficient way to pour a collection into another
08:41naeudo you think we'll see implementations of core functions become even more efficient with the new protocol stuff?
08:41Chousukemost likely
08:42Chousukethere's already an InternalReduce protocol isn't there?
08:42chouserdefn: it'd be great to have a link from the walton page to the irc log it came from, for related discussion.
08:42rhudsonWhat's walton?
08:42chouserrhudson: http://getclojure.org:8080/examples/into
08:43chouserreplace "into" there with the fn name of your choice
08:44naeuis there anyway of getting an offline cache of walton?
08:44naeuit looks remarkably useful
08:46chousernaeu: interesting idea. I don't know of any.
08:46naeui often try and code offline to remove distractions
08:46chousernaeu: wait, when are you on a computer and yet offline? :-)
08:47chouserah
08:47naeui've recently taken to coding in coffeeshops and libraries
08:47chousernaeu: there's this clever invention sometimes called wifi you should check out...
08:47naeuso i have an offline copy of the Java API
08:48chouser:-)
08:48SynrGbiiig
08:48SynrGme, the bus ... and wifi connectivity is ... spotty
08:48SynrGand my eee is too small for the whole freaking java API
08:48naeuchouser: yeah, but I lack discipline sometimes which needs to be enforced by no wifi ;-)
08:49SynrGi need to somehow choose some minimal subset that covers what i'd most likely need for clojure
08:49chouserI'll stop teasing you now. :-)
08:49naeuit's one of the reasons I love git so much
08:50naeuand my hard disk - i love my hard disk ;-)
08:50chousernaeu: I could send you the irc logs that walton uses -- grepping them might be nearly as useful, if less pretty.
08:50naeuchouser: I already have a copy of all the irc logs which I use quite a bit
08:51SynrGhmm. i should set up squid on my eee or something
08:51naeuI appreciated the simplicity and focus of walton
08:51chousernaeu: oh, yeah? where'd you get the logs from?
08:51naeubut it would rock if walton linked back to the irc logs for context (as someone recently mentioned)
08:51naeuchouser: hmmm, good question. That, I can't remember
08:52chousernaeu: you have them in .html form?
08:52naeuno, plain text
08:52chouserhuh. ok.
08:52naeui enjoyed reading the early days
08:52naeuwith just 10 or so people in the room
09:11bsteuberdoes the quote "Mutable Objects are the new Spaghetti Code" come from Rich?
09:12chouserhe said something at least roughly like that
09:17bsteuberchouser: ok, now I got the original quote
09:28hugodis it possible to define a new annotation in clojure?
09:28rhickeyhugod: no
09:29hugodrhickey: thanks. Is there a fundamental problem in doing so?
09:29rhickeyhugod: annotations are a Java thing, and supporting them in Clojure is strictly about complying with existing Java APIs that require them. I don't encourage their use otherwise
09:30rhickeyClojure can't really add anything over Java in defining them
09:30hugodrhickey: ok, but there is no way of adding metadata to deftype classes without them
09:32rhickeyhugod: true
09:32chousera try/catch block is cheap when no exception is thrown, right?
09:32rhickeychouser: yes
09:32rhickeyin Java
09:33chouserbut not in ...?
09:34AWizzArdMoin frank.
09:34Licenser_rhickey: may I ask a question regarding copyright?
09:35rhickeychouser: I wouldn't want to say, as improvements are always possible. But known cheap in Java
09:35rhickeyLicenser_: sure
09:35Licenser_I'd like to use the clojure logo on my try-clojure site, is that OK with you?
09:36chouserrhickey: ok, you mean JVM. Not trying to say try/catch may be slower in Clojure but that they may be slower on some host besides JVM?
09:36rhickeychouser: right
09:36chousergreat, thanks.
09:36rhickeyLicenser_: which site?
09:36Licenser_try-clojure.org (like tryhaskel.org) not up yet
09:38rhickeyLicenser_: as long as you are not charging, and the Clojure that is running is official Clojure
09:39rhickeyLicenser_: Clojure logo should only refer to official Clojure lang
09:39Licenser_rhickey: no it's 100% free it's a site for the comunity and it is the official clojure just running in a sandbox
09:39Licenser_*nods*
09:39rhickeyLicenser_: ok then
09:39Licenser_cool :) thanks
09:41arkahnis the ant.clj concurrency example (referenced on http://blip.tv/file/812787 ) still considered idiomatic clojure or are there more recent examples that would be recommended? Trying to learn 'best practices' while learning clojure
09:41sexpbot"Clojure Concurrency"
09:42arkahnspecifically with regards to concurrency
09:47Licenser_question: if I delete a namespace, will all variables in it get CG'ed?
09:47chouserarkahn: I think the concurrency semantics and idioms there are still good. Some of the source idioms (java interop in particular) may be a bit dated.
09:54arkahnchouser: a number of the functions follow the form of "defn 'noun-form', while running, send-off *agent* 'noun-form', fn call to verb-form, sleep" Is that typical/recommended use of agents? It's really kind of cool the first time a person (me) encounters it: if you're still running, make a call to yourself in the future (in serial) then execute the business-end of the code, then sleep for a short while
09:54arkahnchouser: thank you
09:55chouserarkahn: yeah, send-sending agents are still valid, afaik. Nothing's replaced them that I know of.
09:56chouserself-sending
10:32giaceccoHi all!
10:33giaceccoAnybody can suggest a good tutorial to start using leiningen? I followed the short instructions at http://bit.ly/dbuw3u but it fails almost immediately saying that
10:33sexpbot"technomancy's leiningen at master - GitHub"
10:34giacecco[null] Unable to resolve artifact: Unable to get dependency information: Unable to read the metadata file for artifact 'org.clojure:clojure:jar': Error getting POM for 'org.clojure:clojure' from the repository: Unable to store local copy of metadata: Error updating group repository metadata
10:34giaceccoit looks a bit like a file system permission issue
10:34giaceccoand a Maven one, probably
10:36giaceccoyep I was right, running 'sudo lein compile' works fine :-(
10:36savanniIf you're running as yourself, you should be able to download the original lein script and run "lein self-install". It should create everything with the correct permissions.
10:37savanni(I went through this process yesterday, actually)
10:37giaceccoI got to that point savanni
10:37giaceccoinstallation is ok
10:37savanniYou're trying to compile something else with lein?
10:37giaceccoI am compiling for the first time
10:37mmarczykgiacecco: check the permissions on ~/.m2 (and inside it)
10:38giaceccoha!
10:38arkahnnoob question: when is -> needed?
10:38mmarczykgiacecco: maybe even do something like chmod -R u+rwX ~/.m2 (note the capital X)
10:38mmarczykarkahn: it's never *needed*, but may make the code more readable
10:39dnolen,(-> 4 (+ 5) (* 2))
10:39clojurebot18
10:39arkahnmmarczyk: I read it's definition in the clojure api but can't make sense of it
10:39dnoleninstead of
10:39giaceccoit was the permissions of .m2, thanks!
10:40dnolen,(* (+ 4 5) 2)
10:40giaceccosorry my question was the usual idiot one
10:40clojurebot18
10:40mmarczykgiacecco: yw :-)
10:41arkahndnolen: hmm ... I think I get it. So it modifies prefix notation to a notation that reads left to right?
10:41dnolenarkahn: basically
10:41arkahncool - thanks all
10:42fogusarkahn: http://blog.fogus.me/2009/09/04/understanding-the-clojure-macro/
10:42sexpbot"-= Understanding the Clojure -> macro =-"
10:42arkahnI wish that would have been explained in the book Prog Clojure ; )
10:42arkahnfogus: thanks
10:43fogusnp
10:44naeufogus: do you expand anywhere on your recent tweet regarding the power of pre- and post-conditions?
10:44fogusdnolen: I see you're trying to get through to the axisofeval guy. Good luck
10:44fogusnaeu: Yes. In the Joy of Clojure. ;-)
10:44dnolenfogus: I tried, but he seems to be the classic stubborn Lisper, oh well.
10:44naeufogus: haha, cool :-)
10:45dnoleninteresting blog tho.
10:45fogusdnolen: I was worth a shot I suppose. Yes, I agree, pretty good so far... minus the Clojure misrepresentation
10:46fogusand python
10:46fogusand maybe the others that I'm not aware of
10:50mmarczykactually it seems to me that that post is misrepresenting Lisp; traditionally it was the mainstream catching up to Lisp, I think, and not the other way around
10:50mmarczyk(the Clojure post)
10:55savanniIn reference to an earlier conversation (and the reason I re-joined the channel), is leiningen becoming the most commonly used build tool, and is clojars becoming the most common place to publish code?
10:55mmarczykno, they've already become the most commonly used build tool & repo ;-)
10:55savannilol
10:56savanniIs there a time that people push to Maven Central instead of clojars?
10:56mmarczykwell I wouldn't put it past some folks
10:57savanniHeh. Well, still, that tells me exactly how to proceed in building my projects.
10:57savanniThough I will have to one day figure out how to package stuff for ubuntu.
10:59mmarczykmake sure to write up your wisdom once you do :-)
11:01savanniHeh.
11:01savanniI still have write-ups to do for an application that I wrote first in Haskell and then in Clojure. I wanted to do an overall comparison between the two.
11:02mmarczykwhat kind of app?
11:03mmarczykoh, um, my super-late-lunch has just arived, bbl
11:05savanniIt's an app that plays a sound every quarter hour. I wrote it for somebody who needs help keeping track of the passage of time. Uses gnome for the GUI and gstreamer for the sound. Turns out that I couldn't deliver it because I found out at the last second that the Java Gnome libraries never got ported to Windows. Very sad. Should have researched more at the beginning.
11:06savanniBut, I'll have to recode the GUI for the next Ubuntu, anyway, because of policy changes.
11:54Licenseraloa
11:55giaceccoaloa
11:55biribauhi! im new to clojure and lisp, it looks great!
11:56Licenserbiribau: glad you made the decision to give it a try :)
12:07giaceccobiribau: I agree :-)
12:07giaceccoI studied lisp a few years ago, but it showed all its age
12:08giaceccoone of my favourite lisp book is http://bit.ly/gQiU9 , but I needed something more practical
12:08sexpbot"Paradigms of Artificial Intelligence Programming"
12:08giaceccoyes that one
12:08sh10151There was always http://www.gigamonkeys.com/book/ :)
12:08sexpbot"Practical Common Lisp"
12:09biribauoh, i come from haskell, but i feel it lacks some things i love, like reflectivity
12:09savanniAnd then there's http://thinkrelevance.com/blog/2008/09/16/pcl-clojure.html , which translates PCL into Clojure.
12:09sexpbot"PCL -> Clojure"
12:10savannibiribau: I very nearly adopted Haskell instead of Clojure.
12:10sh10151Kind of difficult to adopt Haskell and get paid for programming in it
12:10savanniTrue. But clojure isn't going to make it into my office any time soon, either.
12:11sh10151At least with Clojure you can say "hey, it compiles to a jar file..."
12:11savanniBy "adopted", though, I meant for both personal projects and freelancing.
12:11biribauwell i left haskell about 1 year ago, i recently was looking for a language, im trying a lot of langs but i cant find what im looking for
12:12biribaunobody is perfect
12:12biribaui tryed recently scala also, but i prefer clojure
12:13wlangstrothsh10151: depends on the office
12:13giaceccosh10151: true, but people will be sceptical when you define yourself as a 'clojure lover'
12:14wlangstrothhaha - "clojure lover"
12:14wlangstrothI see a lot of resistance to Lisp, that's for sure. I still don't really know why.
12:15giaceccoLisp is too isolated from the 'real world'
12:15giaceccono libraries etc.
12:15technomancypeople fear what they don't understand
12:15technomancyfor instance, I am terrified of type systems.
12:15stuartsierraClojure doesn't have the library problem, at least, b/c of Java.
12:16wlangstrothtechnomancy: that's probably it
12:16savanniAnd the lisp systems that I tried using could not launch a script from the unix command line and dumped a huge amount of superfluous output that would break any CGI application.
12:16savanniClojure didn't have any of those problems, so I fell in love rapidly.
12:16stuartsierraClojure's still not suitable for CGI, however.
12:16savanniRight, much too slow.
12:16SynrGi'm in an environment, oddly enough, where clojure may be one of the most accessible languages to move to. there aren't a whole lot of languages supported on OpenVMS, but it at least has a well-supported (fsvo "well") jvm
12:16technomancywow, that's the first time I've heard anyone say anything good about using clojure from the CLI
12:16savanniBut, is it suitable when running inside a compojure service?
12:16wlangstrothtechnomancy: fear of type systems is fairly rational
12:16zakwilsonEvery Common Lisp implementation I can think of can shell out in *nix.
12:17giaceccosavanni: what do you use to launch shell scripts from clj btw? I tried http://bit.ly/d6CHPu but it doesn't work
12:17sexpbot"Hugo Duncan : Shell Scripting in Clojure with Pallet"
12:17stuartsierrasavanni: yes
12:17SynrGwe're stuck with 1.5.x on VMS/Alpha, and we don't have our product yet ported to VMS/Itanium
12:17savannigiacecco: I grabbed a CLJ from somewhere, tweaked it a little bit. Admittedly, it is very slow launching, so I don't do it often.
12:17SynrGwhich has 1.6
12:18zakwilsonPeople still use VMS?
12:18savannihttp://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Create_clj_Script
12:18sexpbot"Clojure Programming/Getting Started - Wikibooks, collection of open-content textbooks"
12:18wlangstrothzakwilson: people still use FoxPro - don't you work in IT?
12:18zakwilsonwlangstroth: freelance programmer, no big corporate stuff. Never IT.
12:18SynrGzakwilson: yes indeed. and HP's present obligations to the military will keep it going for years to come i'm sure.
12:19SynrG(though ours is not a military app)
12:19biribaui apologize about the interruption, can anyone explain me the difference between with-monad and do-monad? in haskell terms will be great
12:19SynrGi'm not putting much hope in it for the future tho. tbh, it's a pain in the arse trying to scrabble together the tools i need to do my job
12:19zakwilsonI had the impression VMS was dead ten years ago, not that I have much to base that on.
12:20wlangstrothzakwilson: if you haven't seen the many dinosaurs roaming the earth, consider yourself lucky
12:20SynrGzakwilson: given the choice between being the administrator of a windows server and a VMS server, i'd take the VMS server any day
12:21SynrGtoo bad i make my living as a programmer :/
12:21zakwilsonSynrG: I've never attempted to use Windows for much other than playing games, but I'm not shocked by that.
12:21Chousukebiribau: I don't think there's any haskell equivalent for it :/
12:21Chousukebiribau: with-monad establishes a context where all monad operations are in the specified monad
12:22SynrGwlangstroth: yes. we are tiny dinosaurs who have so far survived the meteor impact and aspire to some day evolving into birds
12:23wlangstrothSynrG: hey, the crocodiles and sharks made it ... I'm not sure which COBOL would be, but that's still big in banking
12:23Chousukebiribau: you can't use monadic functions without setting up the context first. and domonad is just the equivalent of the haskell do notation. If you use it within a with-monad context you don't need to explicitly specify the monad to use
12:23Chousukebiribau: though this is all from memory so I'm not sure if it's entirely accurate.
12:25Chousukebiribau: I suppose with-monad does what you get for "free" with the haskell type system
12:30biribausorry i got dc, so when i have to use domonad insted of with-monad, is there any equivalence or relation between both?
12:30Chousukehm, well, I already answered but apparently you missed it
12:31biribauyep, sorry, my router goes down frequently
12:31Chousukelooks like the logs haven't been updated yet either
12:32Chousukebiribau: http://gist.github.com/397513
12:33LicenserHmm what is clojures state of having stuff run on multiple systems?
12:33ChousukeLicenser: similar to the JVM in general I suppose
12:33ChousukeLicenser: Clojure itself doesn't really address the problem at all.
12:33Licenser*nods* Okay so likely very minimal
12:34Licensersince I'd love to toy with that :P
12:34biribauChousuke: thanks a lot, i think i got the point
12:37LicenserWell once I've my current crazy projects done I'll look into that kind of topic :P
12:37wlangstrothIn Clojure, wouldn't it be rare for someone to actually need with-monad and do-monad?
12:37wlangstroth(I mean for custom monads)
12:37replacaLicenser: although many folks have done a lot of work on distributed Clojure systems with queuing and hadoop
12:38Licenserreplaca: ah that is good to know :)
12:38Licensernever looked into hadoop
12:39replacaLicenser: look at e.g., swarmiji or cascalog
12:39replacaLicenser: the guys at Flightcaster and Rumi are doing this in the large
12:46Licenserreplaca: thanks that looks quite interesting
12:50replacaLicenser: np
12:51replacajust didn't want people think that there's no distributed stuff going on in Clojure. that would be the furthest thing from the truth! :)
12:52Licenserreplaca: *nods* Since clojure is good with one host concurency extinding it to multi host concurency would be quite cool
12:58Ploujis there a list of large companies using clojure?
13:00peregrine81Plouj: looking for a place to apply? :)
13:00Ploujno, just curious, for reference to show my employer :)
13:02peregrine81Plouj: I need an employer who is more flexible. If its not MS its not here.
13:02technomancyPlouj: this might be helpful: http://clojure.org/funders
13:02Ploujtechnomancy: oh yeah, thanks
13:03PloujI saw that before, but forgot about it
13:03sh10151any Emacs JDEE users here?
13:04sh10151I am kind of irritated that it doesn't seem to support maven by default
13:04Chousukeyou actually got it to work?
13:05sh10151JDEE? sure, for stuff that's not maven
13:05sh10151and i can manually do stuff for maven projects
13:05sh10151but that's annoying as well
13:06sh10151seems like one could start over with cedet in emacs 23.2 + swank-clojure
13:06sh10151instead of the comint-based beanshell thingy
13:11naeuIn the ant.clj concurrency example, Rich uses defstructs and he suggests that he's doing this because defstructs share keys so they consume less memory. Is that the only reason to use them, or are there speed benefits too?
13:12naeuAlso, if ant.clj was written for 1.2 would the rewrite be better to use defrecord?
13:12AWizzArdnaeu: yes
13:13naeuAWizzArd: yes to both? :-)
13:14chousernaeu: defstructs primary benefit was space -- the speed improvements were usually negligible.
13:14chouserrecords are smaller and faster than structs
13:15naeuchouser: I'm taking a look at them now
13:16naeuhow do you pull vals out of a record - is the only way to use interop-style mechanisms?
13:17chouserno, use keyword looked (:mykey arecord)
13:17chouserlookup
13:17naeuah, I was trying it the other way round
13:17naeuwhich works for maps as they implement IFn
13:17chouseryeah
13:18naeuso looking up things in records is super fast
13:18naeuyet, is looking up things that have been since assocd to a record the same speed as map?
13:19naeu(as *a* map)
13:20chouserlooking up keys that were not declared in the defrecord is done by falling back on a regular map. So essentially, eys.
13:20chouseryes
13:21naeuchouser: cool, thanks
13:22powr-tocDoes anyone know why leiningen is no longer resolving user.home for me when I run lein deps?
13:22naeuso is it fair to say that everywhere we use a map with an assumed set of keys we should probably consider using a record now
13:22powr-tocI get the following error: Exception in "main" thread /home/rick/projects/foo/${user.home}/.m2/repository not found
13:26chousernaeu: consider, sure. There are probably still cases where a regular map still makes sense.
13:27chouserWhen prototyping it may not be worth locking yourself into a defrecord. maps print readably where defrecords don't (yet).
13:30naeuchouser: ok, cool. Also, what about persistence - maps are implemented by a shared tree structure and records (seem to be) implemented with regular classes. How might the implementation choices affect the performance when modifying large records?
13:31chousernaeu: maps don't share structure when smaller than 32 items, I believe, so records will at least match their performance up to that size.
13:31chousermore than 32 keys in a record is crazy talk! ;-)
13:32naeuhaha, true
13:32chouserif you have real need for that, I guess you'd have to measure your use cases and see
13:32naeuI have very few real needs :-)
13:33chouserlookups will still be faster on a record, I would guess. Dunno about assoc.
13:33AWizzArdWhat I found out so far, for a WebStart application that is inside a signed jar and has the setting <security><all-permissions/></security> in its .jnlp file: a (:require [clojure.contrib.pprint :as p] ...) will cause a java.security.AccessControlException.
13:33powr-tocDoes anyone know why my leiningen refuses to work properly?
13:34powr-tocIt keeps looking for the .m2 repository in the pwd, e.g. /home/rick/projects/project/${user.home}/.m2/repository
13:34powr-tocwhen it should be /home/rick/.m2/repository
13:34LauJensenGuys, does anyone here know of a simple way to turn "Mon Mar 29 20:00:28 CEST 2010" into a UTC string, preferably one which conforms to RFC3339 and by extension RFC4287 3.3 ?
13:35powr-tocit used to work great; but now for reasons unknown to me it's failing
13:35stuartsierraLauJensen: java.util.SimpleDateFormatter
13:35LauJensenstuartsierra: thats for parsing isnt it ?
13:35stuartsierrait does both ways
13:35powr-tocI've tried reinstalling and it still fails :-\
13:36LauJensengreat, I'll check it out, thanks
13:37stuartsierraLauJensen: If you google SimpleDateFormatter (or whatever it's called) plus the RFC, you'll find format strings to match.
13:38LauJensenNow thats a pro tip
13:38stuartsierraheh
13:38BorkdudeI explored the Java Date API today, it was so ugly
13:39stuartsierrahttp://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
13:39BorkdudeAnd most of it was deprecated
13:39sexpbot"SimpleDateFormat (Java 2 Platform SE v1.4.2)"
13:39Borkdude.NET is so much nicer with that respect
13:39Borkdudein
13:39stuartsierraBorkdude: Yeah, but there are Java libs that make it nicer. People seem to like Joda Time.
13:39BorkdudeThen I finally found something that I could use, but then GWT didn't emulate that... grrrr!
13:40stuartsierraSo GWT emulates standard Java classes then?
13:40Licensergaaaa
13:40Borkdudestuartsierra: yes, but not the Calendar class
13:40stuartsierraBorkdude: gee, that would be annoying
13:41Borkdudeit has it's own special date formatting and parsing class which I used eventually
13:41stuartsierraah
13:41stuartsierramakes sense I suppose, since they've got to manage the differences between java.util.Date and Javascript Date.
13:42Borkdudeyes
13:42LauJensen$(-> "Wed, 28 Apr 2010 18:11" java.util.Date. .toString java.util.Date.)
13:42sexpbotDENIED!
13:43LauJensenThats a classic, it reads a string, make it its own, prints it, and then fails to read its own string representation
13:43LauJensen,(-> "Wed, 28 Apr 2010 18:11" java.util.Date. .toString java.util.Date.)
13:43clojurebot#<Date Wed Apr 28 18:11:00 PDT 2010>
13:43LauJensenexcept, with clojurebot it works and in my repl it doesnt... hmmm
13:43BorkdudeLauJensen: now Clojure doesn't promise to read it's printed things back into expressions now does it? ;-)
13:44LauJensenBorkdude: Sober API design demands it
13:44LauJensenBut I dont understand why it works here and not at home... Must be a locale thing
13:44BorkdudeLauJensen: yes, it should, I agree...
13:46BorkdudeWasn't there some kind of (symbol "run" "") problem monday
13:46powr-tocOkay, not sure what was going on but if I remove my .m2 directory and do lein self-install it works... any idea what was up?
13:46Borkdudewith printed symbols and reading it back in, not working
13:47chouseryup
13:47powr-tocit seems like lein is picking up a broken dependency from my repository
13:47Borkdude,(symbol "run" "")
13:47clojurebotrun/
13:48stuartsierraThere's a longstanding debate as to whether 'symbol' and 'keyword' should validate their arguments.
13:49technomancystuartsierra: heh; I have a patch from over a year ago for that.
13:49stuartsierraThere are legitimate arguments both ways.
13:50stuartsierrae.g., if you're using symbols as interned strings and never printing them, why limit them to certain characters?
13:51stuartsierraBut perhaps all such usage should be replaced with String/intern
13:54BorkdudeI didn't actually get the whole problem with (symbol "run" "")
13:54Borkdudeit generates a symbol run/
13:54stuartsierra,(read-string (pr-str (symbol "run" "")))
13:54clojurebotjava.lang.RuntimeException: java.lang.Exception: Invalid token: run/
13:55chouser,run/
13:55clojurebotInvalid token: run/
13:55Borkdude,(pr-str (symbol "run" ""))
13:55clojurebot"run/"
13:55Borkdudethe reader can't handle run/?
13:55Borkdude,(doc read-string)
13:55clojurebot"([s]); Reads one object from the string s"
13:55stuartsierrano, it tries to read it as a namespace-qualified symbol, but there's no symbol name
13:56Borkdudeah, so symbol generates an incorrect symbol name is the problem?
13:56stuartsierrayes
13:56Borkdudeand when is this good?
13:57stuartsierraSome people like to use symbols like strings, in the old Lisp tradition.
13:57stuartsierraOld Lisps had no strings, just symbols.
13:57BorkdudeI see
13:57Borkdudethat's an obscure reason then ?
13:58stuartsierraprobably
13:58Borkdudecan
13:58stuartsierraRich has mused on allowing arbitrary characters in Clojure symbols, like Common Lisp.
13:58Borkdudecan't the Clojure community just decided this is not 'idiomatic Clojure' ? :)
13:58abrenkThe intro page to atoms (http://clojure.org/atoms) is missing a "related functions" section...
13:59Borkdudedecide (-d)
13:59stuartsierraI think most of us already have.
13:59abrenk...took me a while to find reset! - I was wondering if I really had to use swap! with a (fn [_ x] x) argument.
14:00abrenkThe intro only mentions swap! and compare-and-set!.
14:00BorkdudeI can't recall why he did (symbol "run" "") but that must have been an old way of generating code, without ` ?
14:00patrkrisI'm trying to make sure that I have understood obstruction freedom in terms of Clojure's STM. One of the chief reasons that Clojure's STM is *not* obstruction free, is that retries can occur *during* a transaction not just at the end at the commit phase. Is that correct? (Perhaps rhickey will be so kind to answer)
14:01chouserre: (symbol (str "run" "")) "It's for a very.... strange thing we're playing with here at the MIT AI lab" -- rlmcintyre
14:02powr-tocDoes anyone know if leiningen works with enclojure?
14:03powr-tocI mean lein swank specifically
14:03powr-toc(which I guess is a different question entirely)
14:05stuartsierraWhy do you want swank if you're using Enclojure?
14:07technomancypowr-toc: from what I've heard the easiest way to get IDE interop is to use lein pom
14:07technomancyI don't know if Enclojure implements a client for swank
14:10Borkdudechouser: what does (symbol (str "run" "")) generate for a symbol then
14:11Borkdude(str "run" "") is just "run" right?
14:11chouserhm.
14:12chouserindeed. perhaps I misunderstood his issue
14:12chouser,(= 'run (symbol (str "run" "")) (read-string (pr-str (symbol (str "run" "")))))
14:12clojurebottrue
14:26slyphontechnomancy: i'm a little confused, can you replace the functionality of swank-clojure-project using 'M-x slime' and a bunch of configuration?
14:28pdslyphon: yes
14:28slyphonpd: hrm
14:29pdswank-clojure-project is essentially a big (let ((verbose slime-config)) (slime))
14:29pdwith handy hooks and maven support etc
14:30slyphonso you could, in theory use dir-local variables?
14:31slyphonrather .dir-locals.el
14:32pdbarring some emacs antiquity that complicated that, i would think so
14:32slyphonhah
14:37BorkdudeI wanted to try out this Vijual library from git
14:37Borkdudebut leiningen has some trouble downloading the deps
14:37Borkdudecan somebody take a look at this project.clj and see if it's still correct? http://github.com/drcode/vijual/blob/master/project.clj
14:38slyphonprobably replace "1.1.0-alpha-SNAPSHOT" with "1.1.0"
14:38slyphonsame for line 4
14:40Borkdudeslyphon: trying
14:40BorkdudeRepository central will be blacklisted... these msg scare me
14:43Borkdudeit's still trying to download
14:43slyphonuh
14:44slyphonwell, i'm no expert :/
14:44slyphonso take what i say with a grain of salt ;)
14:45stuartsierraSo what should lazytest do with a form like (describe "The foo function" ...)
14:45stuartsierraCreate a Var like the-foo-function-test ?
14:46stuartsierraAdd some metadata somewhere?
14:46ordnungswidrigstuartsierra: what will the var / meta contain?
14:46ordnungswidrigsut
14:46ordnungswidrigstuartsierra: why would I care in the test?
14:46slyphonstuartsierra: you'd have to do some scrubbing on the input...
14:47stuartsierraThe var/meta will contain the assertions for that test.
14:48stuartsierraYou might care when you start reloading test files.
14:48ordnungswidrigah, ok
14:48stuartsierraFor instance, should I try to ensure that reloading the file replaces tests with the same name?
14:48stuartsierraI'm tempted to say no, and provide a function that unloads-and-reloads a namespace.
14:50abrenkBorkdude: seems like Maven cannot reach repo1.maven.org - do you use a proxy?
15:01powr-tocIs there any way to get an enclojure repl with a maven project; without moving to maven-clojure-plugin?
15:04giaceccoquick question for you
15:04Borkdudeabrenk: no
15:04giaceccoif my English is good enough
15:04giaceccoI am doing something simple as the following (def runtime (Runtime/getRuntime))
15:04giacecco(def my-proc (. runtime exec "ls -la"))
15:04giacecco(def my-proc-input (. my-proc getInputStream))
15:05giaceccothe last command returns a java BufferedInputStream but I want a DataInputStream
15:05abrenkBorkdude: Can you open e.g. http://repo1.maven.org/maven2/org/clojure/clojure/1.1.0/clojure-1.1.0.pom in your browser?
15:06giaceccohow do I force the casting of one into the other in Clojure?
15:06Borkdudeabrenk: yes
15:06Borkdudeabrenk: are you assuming I use the project.clj as is?
15:07abrenkBorkdude: Could you perhaps remove the :repositories keyword?
15:08abrenkBorkdude: leiningen has clojars as one of its default repositories so you should not need to specify it
15:09Borkdudeabrenk: removed it, still 1 artifact is missing it says
15:09giaceccoI found my solution! I replace the last of my three lines with (def my-proc-input (java.io.DataInputStream. (. my-proc getInputStream)))
15:09Borkdudegiacecco: glad we could help you
15:10giaceccoborkdude: sometimes, just explaining the problem to someone makes the solution pop up!
15:10abrenkBorkdude: which one's missing?
15:10Borkdudegiacecco: yeh :)
15:10Borkdudeorg.clojure:clojure:jar:1.1.0-alpha-SNAPSHOT
15:10Borkdude
15:11abrenkBorkdude: you should change that to "1.1.0".
15:11abrenkBorkdude: like slyphon recommended
15:11Borkdudeabrenk: that's why I asked if you assumed if I used the project.clj as is
15:12Borkdudebut I will now change that
15:12Borkdudeagain ;)
15:12abrenkokay :)
15:13abrenkthat's why we need more releases referencing stable versions, all those -SNAPSHOT references only lead to problems if you don't really need the bleeding edge.
15:14BorkdudeI removed the lib dir also
15:14Borkdudeso it will get everything from scratch again
15:14abrenkBorkdude: nope
15:14abrenkBorkdude: lib is only a copy of the stuff in ~/.m2/repository
15:15Borkdudeyes, with 'get' I mean copy or download ;)
15:15abrenkthen you're right
15:15Borkdudeabrenk: it works now
15:15Borkdudewithout changing the contrib
15:15abrenkI'd recommend changing contrib to 1.1.0 also.
15:16abrenkclojure and clojure-contrib have coordinated version IIRC
15:16Borkdudeabrenk: when I changed both clojure and contrib in the project.clj it didn't work
15:16Borkdudeso I won't change it ;)
15:17AWizzArdrhickey: does Clojure use its own class loader?
15:18chouserAWizzArd: of course, it has to in order to load bytecode dynamically.
15:19lancepantzAWizzArd: DynamicClassLoader
15:19abrenkBorkdude: strange, but oooookay. If you're happy, I'm happy.
15:21AWizzArdDoes this class loader install a security manager?
15:21abrenkA vijual visualization of the dgraph nodes in my current project would be nice.
15:21AWizzArdWhen I require contrib pprint in a webstart application it fails. I granted in the .jnlp file <all-permissions />, but this only counts for the classloader that loads the app itself.
15:22ivank(loop [max5 (/ 1000 5) max3 (/ 1000 3)]
15:22ivank (+
15:22ivank (if (> max3 0) max3)
15:22ivank (if (> max5 0) max5)
15:22ivank (recur (- max5 0) (- max3 0))))
15:22Hodappthat was almost a drive-by pasteflood
15:23ivankthis gets a unsupported op error. says recur must be in tail position
15:23ivankhow is that not tail position
15:23ninjuddAWizzArd: DynamicClassLoader should delegate to the AppClassLoader before trying to load anything on its own
15:23tomojyou're adding it to something
15:23pdivank: it's an argument to +
15:23pd+ is in the tail position
15:23ivankhmmm, ok
15:23ivankmakes sense
15:24tomojtail position doesn't just mean "at the bottom" :(
15:24tomojit means you can't do anything with the result, just return it
15:24AWizzArdThe JNLPClassLoader is the one that is granted all permissions.
15:25ninjuddAWizzArd: what does (.getParent DynamicClassLoader) return?
15:25Borkdudeabrenk: vijual is now running on my system
15:26ninjuddAWizzArd: or may be (.getParent (.getParent DynamicClassLoader)), seems to wrap it twice
15:27abrenkBorkdude: then start vijualizing :-)
15:28Borkdudeabrenk: now using contrib 1.1.0, don't know what I did wrong, but up and running. tnx
15:28abrenkyou're welcome
15:28Borkdudeabrenk: yes, I think I'm going to make this: http://i.imgur.com/9pKiI.jpg
15:29abrenkBorkdude: Yeah!
15:30lpetithi
15:41sidshow do I use a defrecord Abc declared in namespace pqr in namespace xyz?
15:42stuartsierrasids: import it
15:42stuartsierrait's a class
15:42lpetitsids: either you define a factory function for creating new instances, and your users will access it e.g. via (pqr/make-Abc ...), either you do as stuart said
15:42sidsstuartsierra: tried, isn't woring, throws a ClassNotFoundException
15:43sidslpetit: I actually want to extend the defrecord, not create an instance of it
15:44stuartsierrasids: you can't extend defrecords
15:44stuartsierraoh you mean extend to a protocol?
15:44lpetitsids: "extend the defrecord" ?? You mean extend a Procol on this defrecord ?
15:44sidsstuartsierra: yes, extend a protocol for this defrecord
15:45sidslpetit: sorry, I meant use it in a call to extend-protocol
15:46stuartsierrasids: Check the name. (defrecord Abc) in namespace com.example produces the class named "com.example.Abc"
15:46stuartsierraso you should be able to (import 'com.example.Abc) then
15:46lpetitstuartsierra: for extending a protocol on a type/record, isn't there another way than to explictly provide the class name ? Some times ago there was the possibility to use fully qualified keywords, no ?
15:46stuartsierralpetit: yes, that's gone now that datatypes are real classes
15:47sidsstuartsierra: that's what I tried, I'll recheck
15:47stuartsierrasids: does the name have any hyphens in it? Those become underscores in the class name
15:47lpetitstuartsierra: ok, I thought it was maybe still present, at least for the records part of the story
15:48stuartsierralpetit: don't think so
15:49lpetitstuartsierra: you're right, of course.
15:50sidsstuartsierra: it wasn't working because the two namespaces were rewuire'ing each other, fixed that and it works now; thanks
15:50giaceccoquick question: I can't find where to download clojure and contrib APIs' docs
15:52stuartsierragiacecco: browse at http://richhickey.github.com/clojure/
15:53stuartsierradownload from "download source" link on http://github.com/richhickey/clojure/tree/gh-pages
15:53giaceccothat's it
15:54stuartsierrasame for contrib, just change "clojure" to "clojure-contrib" in those URLs
15:56giaceccostuartsierra: great thanks
15:56stuartsierragiacecco: you're welcome
15:56DuneManone can build docs from the a head checkout, right?
15:58stuartsierraI think you need to download the auto-doc tool, but then yes
16:07dlowewhat build system is popular these days?
16:07lancepantzant
16:07lancepantzjust kidding.
16:08lancepantznot really though
16:08wlangstrothdlowe: I'm partial to leiningen
16:09lancepantzi'm actually currently putting in a lot of effort to migrate from ant to lein
16:09wlangstrothant is good if you're used to configure-make-make install
16:09dloweI'm used to asdf from the common lisp world
16:10dlowelein looks comparable
16:11wlangstrothit is. It's a wrapper over maven, which can be intimidating
16:11dlowelein is an abstraction layer over both maven and ant?
16:11dlowehm
16:13wlangstrothI guess like anything else, once you get into the groove, it's fine (using project.clj)
16:14wlangstrothant wouldn't be that bad, either, I guess, but lein's project file is in clojure
16:15tomojanother option is maven, either regular old maven or polyglot
16:27Licensercooookies!
16:33naeuin agent functions what is the first param that's passed by the functions send and send-off?
16:34chouserthe first arg of an agent action fn is the current value of the agent
16:35chouser,(send (agent :initial-value) #(prn :first-arg-is %1))
16:35clojurebot#<Agent@7f19e2: :initial-value>
16:35chousermeh
16:35chouser,promise
16:35clojurebot#<core$promise__7326 clojure.core$promise__7326@1ab4788>
16:35chouser,(let [first-arg (promise)] (send (agent :initial-value) #(deliver first-arg %1)) @first-arg)
16:36clojurebot:initial-value
16:36Borkdudewow, dotrace is cool
16:36naeuhmm, perhaps i'm not using agents in an idiomatic way then
16:36naeui don't care about the previous value
16:36naeuthe new value is obtained by io
16:37naeuI'm trying to create a poller for a 3D mouse
16:37DuneManwhy not just have a thread that does the polling?
16:37powr-tochas anyone managed to get an enclojure REPL going inside a maven project?
16:38naeuDuneMan: I'm not really sure how to use threads in Java/Clojure yet
16:38DuneManIt seems to me agents are more appropriate for when you actually want to do message passing.
16:38naeuI read up on the ant.clj demo, and watched Rich's video which was really enlightening
16:38DuneMannaue: (doto (Thread. f "MyThread") (.start))
16:38naeuand in that he doesn't use any threads
16:39naeuwell, not explicitly
16:39DuneMansince all clojure functions are runnable/callable, you can just pass a function to the Thread constructor and start it
16:39DuneManand you're on your way.
16:39DuneManfor an example of this check out server-socket in clojure-contrib
16:40naeuoh ok
16:40naeui just didn't think it was appropriate to call Java threads in my code like this unless I was doing interop
16:40grzmanyone recently getting an error with lein? http://gist.github.com/394692
16:41grzmclojure.lang.Cons cannot be cast to clojure.lang.Named
16:41grzmclojure.lang.Cons cannot be cast to clojure.lang.Named (help.clj:5)
16:41naeuI guess I'm still struggling to know when to look for something in clojure and when to look for something in java
16:41technomancyI did some looking on github, and only two of the last 100 projects used solely ant
16:41technomancysurprised me, but just a bit
16:42DuneMannaeu: I've been going with the "Look for the abstraction I want in the clojure docs, and clojure-contrib. If it's not there, write a clojure interface to the java way"
16:42naeuDuneMan: I'm not at ease enough to do that yet. I'm still flailing around :-)
16:42DuneManbut I'm pretty new to this, technomancy would probably have a better opinion to listen to.
16:43abrenkHm. The problem with uncompiled Clojure code and project.clj - you can forget dependencies.
16:43naeuwell, i got my poller working with agents :-)
16:43abrenkincanter-charts' project.clj does not declare a depency on incanter-stats but uses it.
16:44DuneMani may just be too used to my normal way of desiging multi-threaded programs, instead of using agents all over.
16:45powr-tocIs there anything special about the REPL you get in labrepl/enclojure?
16:45powr-tocBecause I can't seem to recreate it for other projects
16:45abrenkAny Incanter committer here?
16:45liebkeabrenk: what function from stats is it?
16:45naeuDuneMan: I have the advantage/disadvantage of not really having done any serious multi-treaded programming
16:46DuneManAh, yeah. not having to unlearn old habits.
16:46abrenkliebke: incanter.stats :only (quantile quantile-normal cumulative-mean sd)
16:47technomancy~1d2
16:47clojurebotexcusez-moi
16:47technomancy,1d2
16:47clojurebotInvalid number: 1d2
16:47technomancyclojurebot: 1d2
16:47clojurebotExcuse me?
16:47technomancy...
16:47kotarak,1r2
16:47clojurebotRadix out of range
16:47defn,Q
16:47clojurebot<-nil-<
16:47hiredmanclojurebot: 1d6
16:47clojurebotExcuse me?
16:47kotarak,2r1
16:47clojurebot1
16:47liebkeah, you mean it doesn't show a dependency in the project.clj file? the module called incanter-core includes the namespace called incanter.stats
16:48hiredmannuts then
16:48abrenkliebke: Ah... incanter.stats is contained in incanter-core... strange.
16:48liebkeyeah, a bit confusing.
16:48liebkeincanter modules are based on third party dependencies
16:48abrenkliebke: I get java.lang.ExceptionInInitializerError (charts.clj:1762)
16:48liebkeincanter.core depends only on parallel colt
16:48abrenkliebke: Incanter 1.2.2
16:49liebkesounds like the error when you have conflicting versions of clojure
16:49liebkedo you have a dependency on clojure 1.1
16:49abrenkYeah.
16:49liebkethe current version only works with clojure 1.2
16:49hiredmanclojurebot: 1d6
16:49clojurebotPardon?
16:49abrenkthat explains a lot
16:49hiredman1d2
16:49clojurebot2
16:49hiredmanbah
16:50abrenkliebke: What's the last version that works with Clojure 1.1?
16:50liebke1.0
16:50abrenkthx
16:52pjstadig~1d2
16:52clojurebotPardon?
16:52hiredman1d2
16:52clojurebot1
16:52hiredmanclojurebot: weirdo
16:52clojurebotI don't understand.
16:52abrenkliebke: okay, Maven shows a conflict between clojure version 1.1.0 and 1.2.0-master-SNAPSHOT
16:52pjstadig1d2
16:52clojurebot2
16:52technomancywe need a less violent version of botmack
16:52technomancy*botsmack
16:52technomancysomething to express irritation without resorting to force
16:52hiredmanor a more violent version of botsnack
16:53liebkeabrenk: for version 1.0?
16:53pjstadigyes
16:53abrenkliebke: no, still 1.2.2
16:53pjstadigbotslaponthewrists
16:54liebkeokay
16:54abrenkliebke: I just wanted to check if I could have found that conflict using maven
16:54liebkeah
16:56abrenkThe Dependency Hierarchy in Eclipse's POM Editor shows the conflict.
16:59powr-toclabrepl/enclojure seems to be broken
17:01abrenkliebke: there's no 1.0 release on clojars... but I guess for toying around and a first proof of concept I can use 0.9.0
17:01powr-tocWe're using the latest enclojure and Netbeans 6.8 on Windows
17:01liebkeabrenk: 1.0 wasn't compatible with clojars, go to http://repo.incanter.org
17:01sexpbot"Incanter: Statistical Computing and Graphics Environment for Clojure"
17:01powr-tocwe no longer get syntax highlighting, nor do we see "Start project repl"
17:05Ploujjava 7 isn't going to have tail call optimizations, is it?
17:06AWizzArdguys, after hours and hours of frustration, reading and trying things out I am now finally able to deploy any Clojure application (with gui and such) via WebStart. Applets would also be possible, with full user rights. Wow.
17:07AWizzArdno more html+js madness, incompatibilities, crossbrowser issues, stateless connections, etc
17:08abrenkliebke: okay, another repo, got that. The groupId is still org.incanter I've got the artifacts now, but still no luck:
17:08ninjuddAWizzArd: sweet! so, what was the classloader problem?
17:08abrenkuser=> (use '(incanter core charts)) --> java.lang.IllegalAccessError: grid-apply is not public (charts.clj:19)
17:09abrenkBut I will figure it out. Thanks for your help.
17:09AWizzArdninjudd: the Clojure class loader simply grants no rights at all
17:09liebkeI don't think grid-apply is in version 1.0
17:09ninjuddAWizzArd: hmm, so how did you fix it?
17:09AWizzArdand the <all-permissions /> tag only grants permissions for the JNPLclassLodaer
17:10AWizzArdninjudd: I had to put my own grant_all.policy file into the signed jar that I deploy.
17:10AWizzArdThen, when the program starts I load this as a resource out of the jar and replace the System policy with mine.
17:10ninjuddhuh, so is this a bug in the clojure classloader?
17:10abrenkliebke: my bad, I still had a copy of the 1.2.2 charts.clj in my src folder. Everythings alright now!
17:11AWizzArdAfter that I can (require 'my.real.programs.ns) and (eval '(my.real.programs.ns/real-startup-fn))
17:11liebkeabrenk: great
17:11AWizzArdninjudd: well, not a bug, but it does not assume to run in a sandbox
17:12AWizzArdHere a Sun employee explains that it is the responsibility of the classloader author to care about Permissions: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4809366
17:12sexpbot"Bug ID: 4809366 all-permissions does not grant permission for getClassLoader()"
17:12ninjuddAWizzArd: are you ahead-of-time compiling your clojure files?
17:12AWizzArdyes
17:13AWizzArdmy ant script compiles them, jars them, puts the policy file into the jar, signs it, and then moves everything into the right folder
17:15_brian2_DuneMan : hi
17:15DuneManhi
17:15ninjuddoh. i don't understand classloader security managers very well, but i had assumed that if the class is loaded by the parent classloader then its security would apply
17:15ninjuddbut i guess that isn't correct
17:17_brian2_DuneMan : i'm trying to use congomongo after authenticated login (which works becase I can do some things like grab the first record
17:17_brian2_but congomongo doesnt seem to work
17:17AWizzArdninjudd: true, intuitively one would think so, but Sun confirmed that this should not be the case.
17:18AWizzArdThose security mechanisms are great, they allow you to let any application run, in principle, but when you want to use Clojure, then it means you really need a good manual to do it.
17:18_brian2_can't say something (NO_SOURCE_FILE:0)
17:19DuneMannowhere in the traceback does it say anything about some code you wrote?
17:19AWizzArdToday I WebStarted my first "Hello World" with clj-pivot
17:20_brian2_no
17:20BorkdudeWhen I do C-x k <RET> in Erc, is this a good way to leave a channel
17:22DuneMan_brian2_: Have the code down to something small enough that you can paste it on paste.lisp.org?
17:22_brian2_ok
17:23DuneManalso, Im assuming this is single-threaded?
17:23_brian2_yes
17:24tomojBorkdude: #erc
17:25Borkdudetomoj: tnx
17:31quotemstrIs it possible to write Eclipse extensions in Clojure?
17:32Chousukeprobably
17:32zakwilson_quotemstr: almost certainly. There's not much you can do in Java you can't do with Clojure's Java interop. I don't know if anybody has done it though.
17:32Chousukeclojure is just a jvm library. :P
17:32_brian2_Duneman : http://clojure.pastebin.com/L0eiMZQS (I left the password in, i'll change it later)
17:33quotemstrAh, okay. We were talking in #emacs about how it ought to be just as easy to write editor extensions for a Java editor in Clojure as it is to write editor extensions for Emacs in Elisp.
17:35Chousukewell hm
17:35_brian2_DuneMan : http://clojure.pastebin.com/L0eiMZQS (I left the password in, i'll change it later)
17:35Chousukethat's not quite true, as a java editor will still have an inflexible (static, java-style) design
17:35Chousukemost of emacs' customisability comes naturally from it being implemented in lisp
17:36AWizzArdquotemstr: only with the difference that you need 5 university degrees to start "scripting" Eclipse or NetBeans, while as with Emacs you can start after a few hours.
17:36quotemstrI've never looked at the Eclipse and NetBeans extension APIs.
17:36quotemstrAre they really that bad?
17:37AWizzArdvery evil stuff
17:37ninjuddtechnomancy: does lein pull down dependencies of dependencies automatically when i do 'lein deps'?
17:38AWizzArdlayers over layers of layers of complexity and bureaucracy
17:38quotemstrOh, wonderful.
17:38quotemstrAnd I thought Firefox with its components system was bad.
17:40Licenserfor those interested in swing in clojure: http://blog.licenser.net/2010/05/11/the-ease-of-guis
17:40sexpbot"lice! : The ease of gui's."
17:40tomojannotations are the only problem I've run into
17:41quotemstrcjl?
17:41technomancyninjudd: yeah
17:41tomojI think writing hudson plugins requires their use, unfortunately
17:41quotemstrStupid TLAs.
17:42ninjuddtechnomancy: i was looking for the code that does it, but i suppose that comes from maven, right?
17:42technomancyyup
17:42ChousukeLicenser: I think the font on your blog is way too small :P
17:43Licenser?
17:44ninjuddtechnomancy: cool, do you know if native-deps pulls native-dependencies of your dependencies too?
17:44BorkdudeLicenser: nice :) now I'll wait for a library that can convert that code to a website instead of swing ;)
17:45technomancyninjudd: I haven't used it, but I suspect it does
17:45ninjuddhow would it do it? by adding the dep to the pom file?
17:45LicenserBorkdude: look at the pivo lib
17:46BorkdudeLicenser: it sounds delicious, but where can I find it?
17:47zakwilsonNext time I need a GUI, I'll be using that.
17:47technomancyninjudd: sorry, I don't know anything about native deps. see if you can catch dnolen when he's around.
17:47ninjuddtechnomancy: ok, thanks, i will
17:47zakwilsonBecause there are so many Java programmers out there who already know Swing?
17:48quotemstrDon't most?
17:48LicenserBorkdude: it's clj-pivot I think
17:48zakwilsonDunno. I wrote an applet once.
17:48quotemstrhttp://www.javalobby.org/java/forums/t101605.html
17:48sexpbot"Roundtrip: From Swing to Ajax and back!"
17:49quotemstrThen there's GWT.
17:49Borkdudezakwilson: GWT solves that problem partially, it lets you program in Java but it generates client side websites for you
17:49zakwilsonI think Swing is widely regarded as horrid by the sort of people who would have the skill required to write an html/JS implementation of it.
17:50Licenserzakwilson: swing IS horrible. But it is shipped with java which is a big +
17:50Borkdudeyou mean Java is more horrible, so Swing looks better?
17:50LicenserBorkdude: no because you don't need to install anything extra, swing goes for a jvm app for free
17:51quotemstrAIUI, what's more horrible is that plenty of developers see Swing as a model to imitate.
17:51zakwilsonLicenser: that's why I'd want to use it for a GUI app that had to run on a bunch of random machines, but I can't imagine wanting to use it for web stuff where you can run whatever you like on your server.
17:52Licenserzakwilson: me neither :P
17:53quotemstrzakwilson: SWT?
17:54DuneMan_brian2_: What happens if you use a fetch-one there?
17:54_brian2_same problem
17:55_brian2_can't call something
17:55DuneManthat is some oddly formatted clojure
17:55_brian2_hmm
17:55_brian2_why?
17:55DuneManWell, part of it is that you're doing stuff really... weridly
17:55clojurebothttp://clojure.org/rationale
17:56DuneManmongo! does creates a new mongodb connection and binds it to *mong-config*
17:56_brian2_its a mixed o a bit
17:56DuneMan*mongo-config*
17:56Borkdudewhy does clojurebot say that out of the blue?
17:56_brian2_ok
17:56technomancyBorkdude: clojurebot is an evolving intelligence
17:57technomancyit's practicing for the Turing test finals at the end of the semester.
17:57technomancyhehe
17:57DuneMan_brian2_: So your creation of a mongo instance isn't being used by the congomongo calls
17:57Borkdudeclojurebot: do you also do eliza kind of conversations?
17:57clojurebotExcuse me?
17:57_brian2_yea, I kind thoght that
17:57Borkdudeclojurebot: you know what I'm talking about
17:57clojurebotHuh?
17:57Borkdudeclojurebot: don't pretend
17:57clojurebotPardon?
17:58_brian2_do I need to do more homewrok?
17:58_brian2_homework
17:58_brian2_like read congomongo code
17:59DuneMan_brian2_: You could patch congomongo to accept authentication information in the mongo! call. You could do the autentication directly on the (:mongo *mongo-config*) instance
17:59_brian2_ok
17:59_brian2_i'll look at that
18:01DuneManyou could make your own version of mongo! that does what you want, or even wraps the libary version.
18:01DuneManlots of options, some better than others.
18:03_brian2_without knowing much, the java library athenticates on the db variable
18:03_brian2_but you're saying the mongo instance
18:03_brian2_?
18:04_brian2_mongo athenticates at the database level
18:04DuneManah, yes, on the db
18:05_brian2_so yo're comment above isn't correct, right?
18:05DuneManyea. (:db *mongo-config*)
18:06_brian2_ok, I'll give it a try, thanks!
18:11Borkdudehttp://tryclojure.licenser.net/ is basically the same as tryclj.licenser.net, only a different presentation?
18:11sexpbot"TryClojure"
18:12BorkdudeLicenser?
18:16abrenkLicenser: I will definately check out clj-swing... why do you like gridbag so much? clojure.contrib has such a nice wrapper around miglayout.
18:19abrenkLicenser: and take a look at dgraph - nice way to propagate state changes to dependent components
18:20srcererJust watching some of the Clojure stuff on infoq and wondering about the fifth reference type. Is that what 1.1 added as transients, or something else that was/will be added?
18:21Licenserabhi__: abrenk I took grid layout from stuarts example
18:21Licenserabrenk: I mean
18:21Licenserand I think miglayout is an aditional dependency right?
18:21abrenkyep
18:22LicenserI qouls pewdEW RO FO QIRHOUR
18:22abrenkbut it's really much more fun that gridbag
18:22LicenserBorkdude: it has the same roots I took some modifcations to the code and added a diferent gui
18:27LicenserBorkdude: Raynes and me decided we'd need something like tryhaskel, and since we made clj-sandbox we decided we should just make it. So he started and I offered to do the hosten. After a while we figured to aproach it on two ways see what works out better in the end :) so currently there are two forks of the same thing
18:28BorkdudeLicenser: what are basically the two approaches?
18:29Licensercurrently mostly forms (all self made) vs pure JS/AJAX (and (adjusted) scripts from other places that made stuff already)
18:30BorkdudeLicenser: I think I will mention your version on my Twitter account @cleotd
18:31Borkdudeit's only maybe annoying that newbe's can't do def or defn
18:32LicenserBorkdude: yea it's a security thing, since I did not came up with a good way to not make the service slowly die for out of memory exceptions when you can def stuff :P
18:33Borkdudeideone.com supports it
18:34quotemstrLicenser: Put each session in a sandbox, limit the maximum size of each sandbox, and expire sandboxes with a timeout?
18:34Licenserquotemstr: yes but limit the size is the hard question and I'm not sure how clojure handles deleted namespaces
18:34DuneManrestart the jvm once a minute!
18:34quotemstrLicenser: Too complicated. Use separate unix processes.
18:35Licenserneither of those seems like a clean solution to me :(
18:36quotemstrI think of process isolation as a very clean solution myself.
18:36DuneMansometimes I prefer the solutions that I think of immediately to the clean ones
18:36RaynesBorkdude: you can use def and defn in mine, btw.
18:36Borkdudemaybe you can host it on GAE and then memory is not your problem anymore? ;)
18:37BorkdudeRaynes: ah, +1
18:38Borkdudeanother thing I miss is parenthesis matching and incompleted input throws and exception
18:38Borkdudeinstead of the possibility to complete it
18:39Borkdudeso maybe those would be nice features to add, but I'm sure you have lots on your lists already?
18:47_brian2_DuneMan : in my namespace I have (:use somnium.congomongo) , so like (mongo!) true , but it doesn't know what this is "unable to resolve symbol: *mongo-config*
18:50lancepantzanyone used the repl-fix branch of lein with any luck?
18:53DuneManbrian: *mongo-config* is in somnium.congomongo.config: (use '[somnium.congomongo.config :only [*mongo-config*]])
18:53DuneManthen you can use @*mongo-config*
18:53_brian2_hmm, ok
18:53DuneMan(reading congomongo.clj is useful :-))
18:54_brian2_yea, I am still learning clojure ;-)
18:54technomancylancepantz: it's been merged to master; shouldn't need the branch anymore
18:55lancepantzah, cool- thanks
19:01technomancyhow do you define your own .meta method in reify?
19:06technomancyI thought defrecord was the one that didn't let you define your own meta semantics
19:24ivankhow do i add an item to the end of a list/vector?
19:28technomancyivank: conj adds to the end of a vector. there's no good way to add to the end of a list.
19:28powr-tocdepends on the concrete type... lists grow at the front, vectors the end... conj will do this
19:32ivankah,
19:32ivankcheers
19:35ivankwhen nesting loops, can i get a recur on the inner to go to the outer
19:42MadWombatHello
19:43powr-tocivank, not that I know of... why do you need loops?
19:43ivankthinking in wrong mindset?
19:43powr-tocmost likely :-)
19:44powr-tocwhat are you trying to do?
19:44ivankfind all primes up to n
19:44powr-toctry looking at map
19:45ivankdon't see how map works for this
19:45powr-toccombining it with filter should work for a simple brute force solution
19:46powr-tocor use a list comprehension (for)
19:46ivankugh, for is ugly
19:47powr-toc(filter is-prime? (iterate inc 0))
19:52ivankthat'll do the whole is-prime? every time though,
19:52technomancypowr-toc: not if you def it to a top-level var
19:52technomancycourse then you hold the head
19:53powr-toctechnomancy: naturally you wouldn't want to do that :-)
19:55powr-tocivank: yes, it's the brute force method... do you need to use a sieve?
19:55lancepantztechnomancy: using the lein 1.2 master, 'lein repl' just 'prints [null] user=>' and exits, have you seen that before?
19:56lancepantzguess that quote should be after prints
19:56powr-tocbecause you could probably memoize is-prime? if memory isn't a concern...
19:57ivankmemoize?
19:58powr-toc,memoize
19:58clojurebot#<core$memoize__6555 clojure.core$memoize__6555@b1babb>
19:58powr-toc,(doc memoize)
19:58clojurebot"([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use."
19:59ivankah, not quite
19:59ivanksince im looking the list of primes, i can use the list of n primes to calculate the n+1 prime
20:02powr-tocyou mean the sieve of erastothenese
20:02DuneManI got robbed at gunpoint once while writing a multithreaded prime sieve
20:02MadWombatcan someone explain hpw struct-maps are optimized? what are the cases where struct-map is faster than a regular hash-map?
20:03DuneManand my poorly ventialated dual AMD Athalon freaked out 'cause I had a bug.... and the machine locked up tight from overheating
20:03DuneMan... unpleasant.
20:03DuneManAthelon ? how do you spell that
20:03DuneManAthlon
20:04powr-tocMadWombat: they share their keys... so checks are on identity not equality; and you save memory as the keys are only stored once
20:05MadWombatpowr-toc: OK, thanks
20:06DuneManMy coworker bob says "I think they're implemented under the hood as java classes"
20:06DuneMannot sure if that's true, but it would make sense. Key access would just be field lookup.
20:09powr-tocDuneMan: all clojure collections are implemented in java right now :-) ... but no, they're not classes (at least in 1.1) they're implemented in terms of IPersistentMap
20:12powr-tocI think your coworkers thinking of records, due in 1.2; which are implemented as classes
20:42alexykis there a faster way to negate a map than,
20:42alexyk,(->> {:a 2 :b 1 :d 4} (map (fn [[k v]] [k (- v)])) (into {}))
20:42clojurebot{:a -2, :b -1, :d -4}
20:42alexykgenerally, is the a fun to work on a map and leave it a map?
20:43lancepantzi always do it as you did
20:43lancepantzdoesn't mean i'm right though :)
20:44alexyklancepantz: well it works! BTW I think I understand why tokyo was slow to write on my ext3
20:44alexykit spent all the time in kjournald
20:44alexykfolks reported turning journaling off in FS to speed up TC
20:44alexykext3 seems especially bad after 2-3 GB
20:45lancepantzoh wow, that's good to know
20:45alexykso you guys can try to format some fast crappy FS to compare write speeds on your giant mormon graph :)
20:46lancepantzdo you remember what your benchmarks were after switching?
20:46alexyklancepantz: I didn't do it yet, I just googled for tokyo cabinet kjournald and it fished out a stackoverflow answer like above
20:47alexykbut I've seen kjournald dominate my top during writes, with 1.7% CPU load
20:49alexyklancepantz: the fun thing is, loading without :prrotobuf-load is not much slower than with it. First I created protobufs but not db-init with :load and :dump, and read is 270 secs vs 200 with :load protobuf-load...
20:49ninjuddalexyk: i'd be interested to know how much of the slowness was due to ext3 and how much was due to not using protobufs
20:50ninjuddalexyk: did using protobuf dump affect the write time at all?
20:51alexykninjudd: for now, I do the following. First, I launch 8 agents protobuffing adjacency lists of each node. Now I have a list of the form, [[u1 proto1] [u2 proto2]...] -- conj'd after all agents finish. Then I hand it off to tokyo write with protobuf-dump. For 3 mil nodes, I get 400 seconds for protobuffing. And 500 seconds best write, much faster than before -- when I'm lucky; or 3,900 seconds today when I'm not.
20:52alexykbtw, manual map/reduce works faster than pmap; or it may be a fluke.
20:52alexykso protobuffing seems to indeed speed things up
20:53alexykninjudd: I wonder if kyoto cabinet's concurrency is better
20:53alexykperhaps then we can read/write in threads
20:54powr-tocalexyk: I don't know if it's slower or not, but you can also (merge-with - my-map my-map my-map) :-)
20:54alexykpowr-toc: that surely would set some Java people's hair on fire :)
20:55alexykpowr-toc: that deserves to be measured on a huge map
20:55powr-tocsure is combustible :-)
20:56ninjuddalexyk: from what i understand, kyoto is slightly slower for a single thread but may be faster for multiple threads
20:56ninjuddit would be an interesting test
20:57alexykninjudd: yeah, another option
20:57ninjuddi'm working on a new version of jiraph that uses deftype and has pluggable storage engines, so i should be able to support kyoto pretty easily
20:57alexykninjudd: but anything protobuffering is simple to pmap anyways
20:58alexykninjudd: cool, worth giving JE another chance
20:58alexyksice JE does parallel reads just fine
20:58alexyksince
20:59ninjuddsure, JE was much slower for us
20:59ninjuddbut it would be a good option for people who want a pure Java implementation
22:13chessguyrunning clojure inside of eclipse, and every time i try to "run as clojure repl" i get an unhandled event loop exception. anyone else had this?
23:27peregrine81I'm trying to setup compojure+appengine, I'm using leiningan and if I use org.buntin/compojure "0.4.0-SNAPSHOT" as opposed to compojure in my project.clj I can get it to work. But if I use regular compojure it gives me a File not found could not locate compojure_init.class
23:46technomancyso: considering including the lein-swank plugin in swank-clojure.
23:46technomancyit's like 17 lines
23:46technomancyyea or nay?