2010-05-11
| 00:00 | rlmcintyre | but 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:01 | technomancy | rlmcintyre: you still need shell scripts in there somewhere to set up the classpath |
| 00:01 | mmarczyk | technomancy: is your long-term (?) plan to remove swank-clojure.el altogether? |
| 00:02 | technomancy | a pure-clojure CLI app would be very, very awkward |
| 00:02 | mmarczyk | technomancy: asking because I'm trying to figure out where best to try and squeeze in slime-repl advice stuff for colouring |
| 00:02 | technomancy | mmarczyk: 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:02 | technomancy | mmarczyk: could be a candidate for an entirely separate package |
| 00:03 | hiredman | technomancy: need to compile clojure to sh |
| 00:04 | technomancy | hiredman: or port it to another host |
| 00:04 | rava | namely what i'm liking most is that i've been able to abstract away my remaining needed shell/perl scripts into a dsl |
| 00:04 | mmarczyk | technomancy: I take it you expect clojure-mode to be enough to use slime-repl though? |
| 00:04 | technomancy | mmarczyk: yes, but slime-repl is not a dependency of clojure-mode |
| 00:04 | mmarczyk | technomancy: also, I've sent you a pull request for the basic refactoring needed for a sane approach to coloured repl |
| 00:04 | technomancy | mmarczyk: there are two defuns in clojure-mode that pertain to slime.el, but they're clearly optional. |
| 00:05 | technomancy | mmarczyk: cool, pull requests for clomo? |
| 00:05 | mmarczyk | technomancy: sure |
| 00:05 | technomancy | (clomo being ido-shorthand for clojure-mode) |
| 00:05 | mmarczyk | technomancy: yup |
| 00:05 | technomancy | great |
| 00:05 | mmarczyk | technomancy: I've tried to abide by your contributing guidelines (the blog post, I mean) :-) |
| 00:08 | technomancy | nice. don't worry, in real life I'm not as picky as I sound in that post |
| 00:10 | mmarczyk | :-) |
| 00:18 | technomancy | mmarczyk: thanks; merged |
| 00:20 | mmarczyk | technomancy: great! :-) |
| 00:21 | mmarczyk | Raynes: that's really neat :-) |
| 00:21 | Raynes | :3 |
| 00:58 | rava | Raynes: why not have the printer in an iframe so the refresh doesn't require the whole page? |
| 00:58 | Raynes | rava: What? |
| 00:58 | rava | http://tryclj.licenser.net/ |
| 00:58 | sexpbot | "TryClojure" |
| 00:59 | Raynes | Because I have no clue what I'm doing. |
| 00:59 | Raynes | 'bout sums it up. |
| 00:59 | rava | lol |
| 01:00 | Raynes | rava: I'll see about that. |
| 01:18 | rava | Raynes: the syntax highlighting IS spiffy :) |
| 02:30 | zmila | "=> (i++ 12345678901234) |
| 02:31 | zmila | java.lang.Exception: EvalReader not allowed when *read-eval* is false." |
| 02:31 | zmila | your repl doesn't permit BigInts? |
| 02:35 | zmila | s/i++/inc/ |
| 02:35 | sexpbot | your repl doesn't perminct Bincgincnts? |
| 02:43 | Raynes | Heh heh. Fail. |
| 02:51 | rava | hrm, 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:51 | sexpbot | "George Whitesides: Toward a science of simplicity | Video on TED.com" |
| 03:14 | scottj | rava: I don't agree, I think everything he says in that lecture is either obvious or useless. |
| 04:12 | vegai | the seq function is a bit of a mystery to me |
| 04:12 | vegai | it doesn't seem to do much, does it? |
| 04:12 | vegai | does it have other uses than returning nil for empty list? |
| 04:12 | tgk | You can use it to generate seqs from iterables |
| 04:13 | tgk | or on strings |
| 04:17 | cschreiner | rava: I agree |
| 04:19 | rava | cschreiner: 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:21 | cschreiner | rava: I don't know much about "correct" |
| 04:21 | rava | cschreiner: correct as in "the planned for" resultant complexity |
| 04:22 | cschreiner | rava: 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:22 | cschreiner | rava: this is what complexity is to me |
| 04:22 | rava | cschreiner: like a bunch of functions to manipulate pixels on the screen stacked to render animation |
| 04:23 | cschreiner | rava: I'm with you |
| 05:04 | Borkdude | I think I'm right about asking Java questions here instead of in #java |
| 05:05 | Licenser_ | Borkdude: didn't we had that topic yesterdaz? |
| 05:06 | Borkdude | Licenser_: yeh, but I tried the #java channel and my thoughts were confirmed ;) |
| 05:06 | Licenser_ | so what do you learned? |
| 05:08 | Borkdude | they aren't as helpful as people in here |
| 05:09 | Licenser_ | Borkdude: not quite: don't use java! |
| 05:09 | Borkdude | Licenser_: of course, I forgot |
| 05:12 | Borkdude | What is the word for 'more specific' question of another question: a specification of the more general question? |
| 05:17 | Licenser_ | Borkdude: specific? |
| 05:18 | Borkdude | Licenser_: and then a noun? |
| 05:20 | Licenser_ | hmmm |
| 05:21 | _ato | refinement |
| 05:22 | Borkdude | ah |
| 05:23 | Borkdude | What is the opposite of "generalization" |
| 05:23 | Borkdude | I would say "specification" |
| 05:24 | cschreiner | discrimination? |
| 05:26 | _ato | yeah, 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 | _ato | I guess I hear contexts more like "more specific version of the question" "could you refine your question?" etc |
| 05:27 | _ato | another one might be "narrowing" |
| 05:27 | _ato | depending on context |
| 05:28 | _ato | ah! |
| 05:28 | _ato | Borkdude: "specialization" |
| 05:28 | _ato | that's a closer oppose to generalization |
| 05:31 | Borkdude | _ato: ah of course |
| 05:31 | Borkdude | tnx |
| 05:33 | cschreiner | can someone point to a good use of the defrecord statement? |
| 05:36 | cschreiner | seems to me that it is just a composition of defprotocol and several implementations? |
| 05:44 | cschreiner | oh well, protocols in clojure is almost like protocols in obj-c |
| 05:45 | AWizzArd | cschreiner: defrecord can be the typical building block for your values |
| 05:46 | AWizzArd | (defrecord User [username password name zip age account salary friends]) |
| 05:46 | cschreiner | yes, I see that, helps to experiment a little :-/ |
| 05:46 | AWizzArd | (defrecord Account [money bankname credit]) |
| 05:46 | cschreiner | ok |
| 05:47 | cschreiner | so to use that instance, Account, I would do what? |
| 05:48 | AWizzArd | (Account. 4000 "Fantasy Bank" "1000") |
| 05:48 | cschreiner | since there is no ctor associated with it |
| 05:49 | cschreiner | ah, of course |
| 05:49 | naeu | would it be wise to use a multimethod to define different implementations of a given function depending on the type of the second argument? |
| 05:49 | cschreiner | looks like defstruct |
| 05:50 | AWizzArd | And such things can then be stored in a user (User. "cschreiner" "pass" "Schreiner" 123 25 (Account. 100 "Schreiner-Bank" 1000) 5000 []) |
| 05:50 | AWizzArd | cschreiner: yes, very much like defstruct, but faster |
| 05:50 | cschreiner | AWizzArd: thats very helpful, thanks! |
| 05:50 | AWizzArd | for some moments it was planned to not introduce defrecord, but instead let the old defstruct disappear and make the new one be defrecord |
| 05:51 | AWizzArd | But then for the sake of compatibility defstruct was left in the game, and defrecord was introduced. |
| 05:51 | cschreiner | I see |
| 05:55 | cschreiner | could this be seen as a parameterization of functions? |
| 05:56 | AWizzArd | What do you mean by that? |
| 05:57 | tomoj | did I miss the difference between defstruct and defrecord? |
| 05:57 | tomoj | (just got here) |
| 05:58 | cschreiner | hard 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:58 | cschreiner | this is how I read the code, perhaps I've got it completely backwards :) |
| 06:01 | AWizzArd | tomoj: defrecord produces a new (jvm) class |
| 06:02 | AWizzArd | cschreiner: 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:03 | tomoj | AWizzArd: of course |
| 06:03 | tomoj | so it's like half way between a deftype and a defstruct...? |
| 06:04 | cschreiner | it's an interesting concept |
| 06:04 | tomoj | I still feel like I have no idea when to use any of these new things :( |
| 06:04 | AWizzArd | Not necessarily a fight. In principle for pretty much all cases defrecord is the right thing to use. |
| 06:05 | AWizzArd | I don't know, maybe defstruct is now even deprecated. |
| 06:05 | cschreiner | taking the polymorphic perspective, things fall nicely into place |
| 06:05 | tomoj | defrecords act like maps, I assume? |
| 06:05 | AWizzArd | tomoj: yes |
| 06:05 | AWizzArd | cschreiner: Protocolls are a special case of Multimethods. |
| 06:05 | tomoj | ok, I love the simplicity of maps and am somewhat scared of all this OOP-sounding crap |
| 06:05 | tomoj | but if they still act like maps, I suppose it's ok |
| 06:06 | AWizzArd | they 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:06 | cschreiner | AWizzArd: I never got a proper grasp of multimethods, this thing looks more usable, I think |
| 06:07 | AWizzArd | Protocolls are very similar to the typical polymorphism of C++, Java, C#, Python, Ruby, etc. |
| 06:07 | AWizzArd | The dispatch on the type of the first argument. That's it. |
| 06:07 | AWizzArd | Multimethods can dispatch on anything and on any of the args. |
| 06:07 | AWizzArd | It does not have to be the type. |
| 06:08 | cschreiner | wonderful |
| 06:09 | AWizzArd | but 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:09 | AWizzArd | It is pretty much the original Java speed |
| 06:15 | tomoj | aren't protocols _better_ than typical? :) |
| 06:15 | tomoj | rich would create something just as good as feature X in C++ |
| 06:16 | tomoj | s/would/would never/ |
| 06:16 | sexpbot | rich would never create something just as good as feature X in C++ |
| 06:30 | AWizzArd | tomoj: with Protocolls you can extend existing classes with functionality without the need to have their sources |
| 06:39 | tomoj | you can do that in java, too :( |
| 06:39 | tomoj | (yes?) |
| 06:40 | vegai | tomoj: no |
| 06:40 | cschreiner | nope |
| 06:40 | cschreiner | you can in obj-c |
| 06:40 | vegai | well, I guess you can do it somehow in java too |
| 06:40 | vegai | after all, clojure's kinda doing it. |
| 06:42 | Borkdude | AWizzArd: is protocols similar to Extension Methods in C# maybe? |
| 06:42 | Chousuke | The classes are not extended |
| 06:42 | Chousuke | the protocol is |
| 06:43 | Chousuke | a protocol covers a set of classes and that set is extensible |
| 06:44 | Borkdude | Chousuke: in C# it is just syntactic sugar, you add static methods around classes, but it seems they are part of the classes themselves |
| 06:44 | Chousuke | so they wrap the class? |
| 06:45 | Borkdude | yes, but you can call them as if they belong to the class |
| 06:45 | Borkdude | they don't change the original code |
| 06:45 | Chousuke | right. |
| 07:00 | tomoj | ah, yes, I see what you can't do in java that you can with protocols, I think |
| 07:01 | naeu | if 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:02 | AWizzArd | tomoj: just write your own java interface offering the method foo() and make Strings implementing this interface. |
| 07:02 | AWizzArd | You will see that this is not trivial, because you can't add this to the source code of the class String. |
| 07:02 | AWizzArd | Though this may change in Java 7, where interface injection might become available. |
| 07:06 | tomoj | hadn't heard about that, cool |
| 08:09 | saml | how do I start out compojure on windows? |
| 08:09 | tomoj | should be the same as compojure anywhere else |
| 08:10 | tomoj | I mean, once you've got clojure working |
| 08:10 | saml | lein is experimental on windows |
| 08:11 | tomoj | and lein, then, too :/ |
| 08:11 | tomoj | but compojure itself should be any different, I mean |
| 08:12 | AWizzArd | saml: 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:13 | saml | okiez. is it easy to package a clojure web application into a single jar that could be run as java -jar blah.jar 8080 ? |
| 08:14 | saml | oh it's java i think i know where to look |
| 08:18 | Chousuke | saml: leiningen makes that pretty easy |
| 08:18 | Chousuke | though the resulting jar will be quite large :P |
| 08:19 | saml | why would it be large? |
| 08:19 | AWizzArd | It is also not be difficult with Ant. |
| 08:19 | saml | clojure + clojure-contrib + .... or does leiningen add its own libraries to jar? |
| 08:19 | AWizzArd | -be |
| 08:20 | chouser | sort-by takes a keyfn, sorted-set-by takes a comparator |
| 08:20 | chouser | seems unfortunate |
| 08:20 | hamza | stand alone compojure app is around 7mb... |
| 08:23 | AWizzArd | chouser: also the differences of how the comparators of sorted sets and sorted maps need to be written is irritating |
| 08:23 | chouser | oh, how are they different? |
| 08:25 | chouser | ,(sorted-set-by #(compare (count %1) (count %2)) "z" "cab" "al") |
| 08:25 | clojurebot | #{"z" "al" "cab"} |
| 08:25 | chouser | ,(sorted-map-by #(compare (count %1) (count %2)) "z" :a "cab" :b "al" :c) |
| 08:25 | clojurebot | {"z" :a, "al" :c, "cab" :b} |
| 08:26 | Chousuke | saml: it puts in your own code and all of its dependencies |
| 08:26 | saml | Chousuke: ah thanks. i'll try lein |
| 08:27 | naeu | I 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:29 | chouser | naeu: there are a couple ways |
| 08:29 | naeu | i.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:29 | naeu | (if that makes any sense) |
| 08:29 | AWizzArd | chouser: a sorted-map's compare will compare two keys, while the one for sorted-sets will compare two values |
| 08:29 | chouser | naeu: (apply conj ...) can take a seq of key/value pairs and use them to build a map |
| 08:30 | chouser | AWizzArd: how else could it possibly be? You want your maps sorted by value!? |
| 08:31 | AWizzArd | imagine 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:31 | chouser | naeu: 'into' does that as well. |
| 08:31 | chouser | ,(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:31 | clojurebot | {":a-san" 2, ":b-san" 3, ":c-san" 4} |
| 08:31 | AWizzArd | chouser: no no, it has to be this way, just wanted to point out that this can be irritating |
| 08:32 | chouser | AWizzArd: oh, ok. I tend to think of the things in a set as "keys" so I hadn't noticed. |
| 08:33 | AWizzArd | chouser: and another difficulty is with subseq. Sometimes the start-test and end-test are not intuitive |
| 08:33 | chouser | ,(into {} (map (fn [[k v]] [(str k "-san") (inc v)]) {:a 1 :b 2 :c 3})) |
| 08:33 | clojurebot | {":a-san" 2, ":b-san" 3, ":c-san" 4} |
| 08:33 | AWizzArd | plus it would be very nice if there were a (submap ...) and/or (subset ...) |
| 08:34 | naeu | chouser: thanks, that looks interesting |
| 08:34 | naeu | need to spend some time musing over it first though |
| 08:34 | AWizzArd | chouser: 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:35 | naeu | chouser: 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:36 | naeu | the clojure docs often remind me of the times Susanna, my wife, used to discuss matters pertaining to doctors with her medic friends |
| 08:36 | chouser | naeu: 'into' is very useful. it essentially lets you "pour" a seq into whatever collection you give it (a map in this case) |
| 08:36 | chouser | you could also use 'zipmap' for this if you prefer |
| 08:36 | chouser | ,(let [m {:a 1 :b 2 :c 3}] (zipmap (map #(str % "-san") (keys m)) (map inc (vals m)))) |
| 08:36 | clojurebot | {":c-san" 4, ":b-san" 3, ":a-san" 2} |
| 08:37 | Licenser_ | naeu: as in you have the feeling you have to know it to understand it? |
| 08:37 | naeu | chouser: now why doesn't the doc say something in the manner with which you described |
| 08:37 | naeu | Licenser_: yeah, as in there's this whole other externally incomprehensible domain vocabulary in use |
| 08:37 | Licenser_ | naeu: look for walton it is very helpufl |
| 08:37 | chouser | naeu: I couldn't tell you. The current docstring for into and the "pour into" analogy are both straight from rhickey. |
| 08:38 | Licenser_ | $walton into |
| 08:38 | sexpbot | Command not found. No entiendo lo que estás diciendo. |
| 08:38 | naeu | chouser: I'm sure the vocabulary used will only be a positive aspect in the future |
| 08:38 | Chousuke | naeu: "coll" means any clojure collection, and conjoin is the generic "insert" operation for collections |
| 08:39 | naeu | chouser: from what I've seen of Rich it seems that he's very keen on using explicit vocab where necessary, and rightly so |
| 08:39 | naeu | it's just that it's hard when you're an outsider |
| 08:39 | Chousuke | analogous to cons with lists I suppose. |
| 08:39 | Chousuke | but works for vectors, sets and maps too |
| 08:39 | Licenser_ | http://getclojure.org:8080/examples/into |
| 08:40 | naeu | it feels like clojure people will be able to have highly efficient discussions regarding concurrent process which will only sound like gobeldygook to others |
| 08:40 | Chousuke | heh. |
| 08:40 | rhudson | The basic definition of (into to from) is (reduce conj to from) -- the doc string pretty much says the latter in English. |
| 08:41 | Chousuke | the actual implementation of into is somewhat more efficient though :) |
| 08:41 | chouser | hm, it's a shame into-array is mixed with into on the walton page |
| 08:41 | Chousuke | but that's the nice thing about it. you don't need to care. |
| 08:41 | rhudson | Chousuke: right, but that's the essence. (And the 1.0 def) |
| 08:41 | Chousuke | it's just the most efficient way to pour a collection into another |
| 08:41 | naeu | do you think we'll see implementations of core functions become even more efficient with the new protocol stuff? |
| 08:41 | Chousuke | most likely |
| 08:42 | Chousuke | there's already an InternalReduce protocol isn't there? |
| 08:42 | chouser | defn: it'd be great to have a link from the walton page to the irc log it came from, for related discussion. |
| 08:42 | rhudson | What's walton? |
| 08:42 | chouser | rhudson: http://getclojure.org:8080/examples/into |
| 08:43 | chouser | replace "into" there with the fn name of your choice |
| 08:44 | naeu | is there anyway of getting an offline cache of walton? |
| 08:44 | naeu | it looks remarkably useful |
| 08:46 | chouser | naeu: interesting idea. I don't know of any. |
| 08:46 | naeu | i often try and code offline to remove distractions |
| 08:46 | chouser | naeu: wait, when are you on a computer and yet offline? :-) |
| 08:47 | chouser | ah |
| 08:47 | naeu | i've recently taken to coding in coffeeshops and libraries |
| 08:47 | chouser | naeu: there's this clever invention sometimes called wifi you should check out... |
| 08:47 | naeu | so i have an offline copy of the Java API |
| 08:48 | chouser | :-) |
| 08:48 | SynrG | biiig |
| 08:48 | SynrG | me, the bus ... and wifi connectivity is ... spotty |
| 08:48 | SynrG | and my eee is too small for the whole freaking java API |
| 08:48 | naeu | chouser: yeah, but I lack discipline sometimes which needs to be enforced by no wifi ;-) |
| 08:49 | SynrG | i need to somehow choose some minimal subset that covers what i'd most likely need for clojure |
| 08:49 | chouser | I'll stop teasing you now. :-) |
| 08:49 | naeu | it's one of the reasons I love git so much |
| 08:50 | naeu | and my hard disk - i love my hard disk ;-) |
| 08:50 | chouser | naeu: I could send you the irc logs that walton uses -- grepping them might be nearly as useful, if less pretty. |
| 08:50 | naeu | chouser: I already have a copy of all the irc logs which I use quite a bit |
| 08:51 | SynrG | hmm. i should set up squid on my eee or something |
| 08:51 | naeu | I appreciated the simplicity and focus of walton |
| 08:51 | chouser | naeu: oh, yeah? where'd you get the logs from? |
| 08:51 | naeu | but it would rock if walton linked back to the irc logs for context (as someone recently mentioned) |
| 08:51 | naeu | chouser: hmmm, good question. That, I can't remember |
| 08:52 | chouser | naeu: you have them in .html form? |
| 08:52 | naeu | no, plain text |
| 08:52 | chouser | huh. ok. |
| 08:52 | naeu | i enjoyed reading the early days |
| 08:52 | naeu | with just 10 or so people in the room |
| 09:11 | bsteuber | does the quote "Mutable Objects are the new Spaghetti Code" come from Rich? |
| 09:12 | chouser | he said something at least roughly like that |
| 09:17 | bsteuber | chouser: ok, now I got the original quote |
| 09:28 | hugod | is it possible to define a new annotation in clojure? |
| 09:28 | rhickey | hugod: no |
| 09:29 | hugod | rhickey: thanks. Is there a fundamental problem in doing so? |
| 09:29 | rhickey | hugod: 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:30 | rhickey | Clojure can't really add anything over Java in defining them |
| 09:30 | hugod | rhickey: ok, but there is no way of adding metadata to deftype classes without them |
| 09:32 | rhickey | hugod: true |
| 09:32 | chouser | a try/catch block is cheap when no exception is thrown, right? |
| 09:32 | rhickey | chouser: yes |
| 09:32 | rhickey | in Java |
| 09:33 | chouser | but not in ...? |
| 09:34 | AWizzArd | Moin frank. |
| 09:34 | Licenser_ | rhickey: may I ask a question regarding copyright? |
| 09:35 | rhickey | chouser: I wouldn't want to say, as improvements are always possible. But known cheap in Java |
| 09:35 | rhickey | Licenser_: sure |
| 09:35 | Licenser_ | I'd like to use the clojure logo on my try-clojure site, is that OK with you? |
| 09:36 | chouser | rhickey: 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:36 | rhickey | chouser: right |
| 09:36 | chouser | great, thanks. |
| 09:36 | rhickey | Licenser_: which site? |
| 09:36 | Licenser_ | try-clojure.org (like tryhaskel.org) not up yet |
| 09:38 | rhickey | Licenser_: as long as you are not charging, and the Clojure that is running is official Clojure |
| 09:39 | rhickey | Licenser_: Clojure logo should only refer to official Clojure lang |
| 09:39 | Licenser_ | 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:39 | Licenser_ | *nods* |
| 09:39 | rhickey | Licenser_: ok then |
| 09:39 | Licenser_ | cool :) thanks |
| 09:41 | arkahn | is 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:41 | sexpbot | "Clojure Concurrency" |
| 09:42 | arkahn | specifically with regards to concurrency |
| 09:47 | Licenser_ | question: if I delete a namespace, will all variables in it get CG'ed? |
| 09:47 | chouser | arkahn: 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:54 | arkahn | chouser: 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:54 | arkahn | chouser: thank you |
| 09:55 | chouser | arkahn: yeah, send-sending agents are still valid, afaik. Nothing's replaced them that I know of. |
| 09:56 | chouser | self-sending |
| 10:32 | giacecco | Hi all! |
| 10:33 | giacecco | Anybody 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:33 | sexpbot | "technomancy's leiningen at master - GitHub" |
| 10:34 | giacecco | [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:34 | giacecco | it looks a bit like a file system permission issue |
| 10:34 | giacecco | and a Maven one, probably |
| 10:36 | giacecco | yep I was right, running 'sudo lein compile' works fine :-( |
| 10:36 | savanni | If 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:37 | savanni | (I went through this process yesterday, actually) |
| 10:37 | giacecco | I got to that point savanni |
| 10:37 | giacecco | installation is ok |
| 10:37 | savanni | You're trying to compile something else with lein? |
| 10:37 | giacecco | I am compiling for the first time |
| 10:37 | mmarczyk | giacecco: check the permissions on ~/.m2 (and inside it) |
| 10:38 | giacecco | ha! |
| 10:38 | arkahn | noob question: when is -> needed? |
| 10:38 | mmarczyk | giacecco: maybe even do something like chmod -R u+rwX ~/.m2 (note the capital X) |
| 10:38 | mmarczyk | arkahn: it's never *needed*, but may make the code more readable |
| 10:39 | dnolen | ,(-> 4 (+ 5) (* 2)) |
| 10:39 | clojurebot | 18 |
| 10:39 | arkahn | mmarczyk: I read it's definition in the clojure api but can't make sense of it |
| 10:39 | dnolen | instead of |
| 10:39 | giacecco | it was the permissions of .m2, thanks! |
| 10:40 | dnolen | ,(* (+ 4 5) 2) |
| 10:40 | giacecco | sorry my question was the usual idiot one |
| 10:40 | clojurebot | 18 |
| 10:40 | mmarczyk | giacecco: yw :-) |
| 10:41 | arkahn | dnolen: hmm ... I think I get it. So it modifies prefix notation to a notation that reads left to right? |
| 10:41 | dnolen | arkahn: basically |
| 10:41 | arkahn | cool - thanks all |
| 10:42 | fogus | arkahn: http://blog.fogus.me/2009/09/04/understanding-the-clojure-macro/ |
| 10:42 | sexpbot | "-= Understanding the Clojure -> macro =-" |
| 10:42 | arkahn | I wish that would have been explained in the book Prog Clojure ; ) |
| 10:42 | arkahn | fogus: thanks |
| 10:43 | fogus | np |
| 10:44 | naeu | fogus: do you expand anywhere on your recent tweet regarding the power of pre- and post-conditions? |
| 10:44 | fogus | dnolen: I see you're trying to get through to the axisofeval guy. Good luck |
| 10:44 | fogus | naeu: Yes. In the Joy of Clojure. ;-) |
| 10:44 | dnolen | fogus: I tried, but he seems to be the classic stubborn Lisper, oh well. |
| 10:44 | naeu | fogus: haha, cool :-) |
| 10:45 | dnolen | interesting blog tho. |
| 10:45 | fogus | dnolen: I was worth a shot I suppose. Yes, I agree, pretty good so far... minus the Clojure misrepresentation |
| 10:46 | fogus | and python |
| 10:46 | fogus | and maybe the others that I'm not aware of |
| 10:50 | mmarczyk | actually 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:50 | mmarczyk | (the Clojure post) |
| 10:55 | savanni | In 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:55 | mmarczyk | no, they've already become the most commonly used build tool & repo ;-) |
| 10:55 | savanni | lol |
| 10:56 | savanni | Is there a time that people push to Maven Central instead of clojars? |
| 10:56 | mmarczyk | well I wouldn't put it past some folks |
| 10:57 | savanni | Heh. Well, still, that tells me exactly how to proceed in building my projects. |
| 10:57 | savanni | Though I will have to one day figure out how to package stuff for ubuntu. |
| 10:59 | mmarczyk | make sure to write up your wisdom once you do :-) |
| 11:01 | savanni | Heh. |
| 11:01 | savanni | I 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:02 | mmarczyk | what kind of app? |
| 11:03 | mmarczyk | oh, um, my super-late-lunch has just arived, bbl |
| 11:05 | savanni | It'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:06 | savanni | But, I'll have to recode the GUI for the next Ubuntu, anyway, because of policy changes. |
| 11:54 | Licenser | aloa |
| 11:55 | giacecco | aloa |
| 11:55 | biribau | hi! im new to clojure and lisp, it looks great! |
| 11:56 | Licenser | biribau: glad you made the decision to give it a try :) |
| 12:07 | giacecco | biribau: I agree :-) |
| 12:07 | giacecco | I studied lisp a few years ago, but it showed all its age |
| 12:08 | giacecco | one of my favourite lisp book is http://bit.ly/gQiU9 , but I needed something more practical |
| 12:08 | sexpbot | "Paradigms of Artificial Intelligence Programming" |
| 12:08 | giacecco | yes that one |
| 12:08 | sh10151 | There was always http://www.gigamonkeys.com/book/ :) |
| 12:08 | sexpbot | "Practical Common Lisp" |
| 12:09 | biribau | oh, i come from haskell, but i feel it lacks some things i love, like reflectivity |
| 12:09 | savanni | And then there's http://thinkrelevance.com/blog/2008/09/16/pcl-clojure.html , which translates PCL into Clojure. |
| 12:09 | sexpbot | "PCL -> Clojure" |
| 12:10 | savanni | biribau: I very nearly adopted Haskell instead of Clojure. |
| 12:10 | sh10151 | Kind of difficult to adopt Haskell and get paid for programming in it |
| 12:10 | savanni | True. But clojure isn't going to make it into my office any time soon, either. |
| 12:11 | sh10151 | At least with Clojure you can say "hey, it compiles to a jar file..." |
| 12:11 | savanni | By "adopted", though, I meant for both personal projects and freelancing. |
| 12:11 | biribau | well 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:12 | biribau | nobody is perfect |
| 12:12 | biribau | i tryed recently scala also, but i prefer clojure |
| 12:13 | wlangstroth | sh10151: depends on the office |
| 12:13 | giacecco | sh10151: true, but people will be sceptical when you define yourself as a 'clojure lover' |
| 12:14 | wlangstroth | haha - "clojure lover" |
| 12:14 | wlangstroth | I see a lot of resistance to Lisp, that's for sure. I still don't really know why. |
| 12:15 | giacecco | Lisp is too isolated from the 'real world' |
| 12:15 | giacecco | no libraries etc. |
| 12:15 | technomancy | people fear what they don't understand |
| 12:15 | technomancy | for instance, I am terrified of type systems. |
| 12:15 | stuartsierra | Clojure doesn't have the library problem, at least, b/c of Java. |
| 12:16 | wlangstroth | technomancy: that's probably it |
| 12:16 | savanni | And 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:16 | savanni | Clojure didn't have any of those problems, so I fell in love rapidly. |
| 12:16 | stuartsierra | Clojure's still not suitable for CGI, however. |
| 12:16 | savanni | Right, much too slow. |
| 12:16 | SynrG | i'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:16 | technomancy | wow, that's the first time I've heard anyone say anything good about using clojure from the CLI |
| 12:16 | savanni | But, is it suitable when running inside a compojure service? |
| 12:16 | wlangstroth | technomancy: fear of type systems is fairly rational |
| 12:16 | zakwilson | Every Common Lisp implementation I can think of can shell out in *nix. |
| 12:17 | giacecco | savanni: what do you use to launch shell scripts from clj btw? I tried http://bit.ly/d6CHPu but it doesn't work |
| 12:17 | sexpbot | "Hugo Duncan : Shell Scripting in Clojure with Pallet" |
| 12:17 | stuartsierra | savanni: yes |
| 12:17 | SynrG | we're stuck with 1.5.x on VMS/Alpha, and we don't have our product yet ported to VMS/Itanium |
| 12:17 | savanni | giacecco: 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:17 | SynrG | which has 1.6 |
| 12:18 | zakwilson | People still use VMS? |
| 12:18 | savanni | http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Create_clj_Script |
| 12:18 | sexpbot | "Clojure Programming/Getting Started - Wikibooks, collection of open-content textbooks" |
| 12:18 | wlangstroth | zakwilson: people still use FoxPro - don't you work in IT? |
| 12:18 | zakwilson | wlangstroth: freelance programmer, no big corporate stuff. Never IT. |
| 12:18 | SynrG | zakwilson: yes indeed. and HP's present obligations to the military will keep it going for years to come i'm sure. |
| 12:19 | SynrG | (though ours is not a military app) |
| 12:19 | biribau | i apologize about the interruption, can anyone explain me the difference between with-monad and do-monad? in haskell terms will be great |
| 12:19 | SynrG | i'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:19 | zakwilson | I had the impression VMS was dead ten years ago, not that I have much to base that on. |
| 12:20 | wlangstroth | zakwilson: if you haven't seen the many dinosaurs roaming the earth, consider yourself lucky |
| 12:20 | SynrG | zakwilson: given the choice between being the administrator of a windows server and a VMS server, i'd take the VMS server any day |
| 12:21 | SynrG | too bad i make my living as a programmer :/ |
| 12:21 | zakwilson | SynrG: I've never attempted to use Windows for much other than playing games, but I'm not shocked by that. |
| 12:21 | Chousuke | biribau: I don't think there's any haskell equivalent for it :/ |
| 12:21 | Chousuke | biribau: with-monad establishes a context where all monad operations are in the specified monad |
| 12:22 | SynrG | wlangstroth: yes. we are tiny dinosaurs who have so far survived the meteor impact and aspire to some day evolving into birds |
| 12:23 | wlangstroth | SynrG: hey, the crocodiles and sharks made it ... I'm not sure which COBOL would be, but that's still big in banking |
| 12:23 | Chousuke | biribau: 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:23 | Chousuke | biribau: though this is all from memory so I'm not sure if it's entirely accurate. |
| 12:25 | Chousuke | biribau: I suppose with-monad does what you get for "free" with the haskell type system |
| 12:30 | biribau | sorry i got dc, so when i have to use domonad insted of with-monad, is there any equivalence or relation between both? |
| 12:30 | Chousuke | hm, well, I already answered but apparently you missed it |
| 12:31 | biribau | yep, sorry, my router goes down frequently |
| 12:31 | Chousuke | looks like the logs haven't been updated yet either |
| 12:32 | Chousuke | biribau: http://gist.github.com/397513 |
| 12:33 | Licenser | Hmm what is clojures state of having stuff run on multiple systems? |
| 12:33 | Chousuke | Licenser: similar to the JVM in general I suppose |
| 12:33 | Chousuke | Licenser: Clojure itself doesn't really address the problem at all. |
| 12:33 | Licenser | *nods* Okay so likely very minimal |
| 12:34 | Licenser | since I'd love to toy with that :P |
| 12:34 | biribau | Chousuke: thanks a lot, i think i got the point |
| 12:37 | Licenser | Well once I've my current crazy projects done I'll look into that kind of topic :P |
| 12:37 | wlangstroth | In Clojure, wouldn't it be rare for someone to actually need with-monad and do-monad? |
| 12:37 | wlangstroth | (I mean for custom monads) |
| 12:37 | replaca | Licenser: although many folks have done a lot of work on distributed Clojure systems with queuing and hadoop |
| 12:38 | Licenser | replaca: ah that is good to know :) |
| 12:38 | Licenser | never looked into hadoop |
| 12:39 | replaca | Licenser: look at e.g., swarmiji or cascalog |
| 12:39 | replaca | Licenser: the guys at Flightcaster and Rumi are doing this in the large |
| 12:46 | Licenser | replaca: thanks that looks quite interesting |
| 12:50 | replaca | Licenser: np |
| 12:51 | replaca | just 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:52 | Licenser | replaca: *nods* Since clojure is good with one host concurency extinding it to multi host concurency would be quite cool |
| 12:58 | Plouj | is there a list of large companies using clojure? |
| 13:00 | peregrine81 | Plouj: looking for a place to apply? :) |
| 13:00 | Plouj | no, just curious, for reference to show my employer :) |
| 13:02 | peregrine81 | Plouj: I need an employer who is more flexible. If its not MS its not here. |
| 13:02 | technomancy | Plouj: this might be helpful: http://clojure.org/funders |
| 13:02 | Plouj | technomancy: oh yeah, thanks |
| 13:03 | Plouj | I saw that before, but forgot about it |
| 13:03 | sh10151 | any Emacs JDEE users here? |
| 13:04 | sh10151 | I am kind of irritated that it doesn't seem to support maven by default |
| 13:04 | Chousuke | you actually got it to work? |
| 13:05 | sh10151 | JDEE? sure, for stuff that's not maven |
| 13:05 | sh10151 | and i can manually do stuff for maven projects |
| 13:05 | sh10151 | but that's annoying as well |
| 13:06 | sh10151 | seems like one could start over with cedet in emacs 23.2 + swank-clojure |
| 13:06 | sh10151 | instead of the comint-based beanshell thingy |
| 13:11 | naeu | In 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:12 | naeu | Also, if ant.clj was written for 1.2 would the rewrite be better to use defrecord? |
| 13:12 | AWizzArd | naeu: yes |
| 13:13 | naeu | AWizzArd: yes to both? :-) |
| 13:14 | chouser | naeu: defstructs primary benefit was space -- the speed improvements were usually negligible. |
| 13:14 | chouser | records are smaller and faster than structs |
| 13:15 | naeu | chouser: I'm taking a look at them now |
| 13:16 | naeu | how do you pull vals out of a record - is the only way to use interop-style mechanisms? |
| 13:17 | chouser | no, use keyword looked (:mykey arecord) |
| 13:17 | chouser | lookup |
| 13:17 | naeu | ah, I was trying it the other way round |
| 13:17 | naeu | which works for maps as they implement IFn |
| 13:17 | chouser | yeah |
| 13:18 | naeu | so looking up things in records is super fast |
| 13:18 | naeu | yet, is looking up things that have been since assocd to a record the same speed as map? |
| 13:19 | naeu | (as *a* map) |
| 13:20 | chouser | looking up keys that were not declared in the defrecord is done by falling back on a regular map. So essentially, eys. |
| 13:20 | chouser | yes |
| 13:21 | naeu | chouser: cool, thanks |
| 13:22 | powr-toc | Does anyone know why leiningen is no longer resolving user.home for me when I run lein deps? |
| 13:22 | naeu | so 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:22 | powr-toc | I get the following error: Exception in "main" thread /home/rick/projects/foo/${user.home}/.m2/repository not found |
| 13:26 | chouser | naeu: consider, sure. There are probably still cases where a regular map still makes sense. |
| 13:27 | chouser | When prototyping it may not be worth locking yourself into a defrecord. maps print readably where defrecords don't (yet). |
| 13:30 | naeu | chouser: 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:31 | chouser | naeu: 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:31 | chouser | more than 32 keys in a record is crazy talk! ;-) |
| 13:32 | naeu | haha, true |
| 13:32 | chouser | if you have real need for that, I guess you'd have to measure your use cases and see |
| 13:32 | naeu | I have very few real needs :-) |
| 13:33 | chouser | lookups will still be faster on a record, I would guess. Dunno about assoc. |
| 13:33 | AWizzArd | What 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:33 | powr-toc | Does anyone know why my leiningen refuses to work properly? |
| 13:34 | powr-toc | It keeps looking for the .m2 repository in the pwd, e.g. /home/rick/projects/project/${user.home}/.m2/repository |
| 13:34 | powr-toc | when it should be /home/rick/.m2/repository |
| 13:34 | LauJensen | Guys, 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:35 | powr-toc | it used to work great; but now for reasons unknown to me it's failing |
| 13:35 | stuartsierra | LauJensen: java.util.SimpleDateFormatter |
| 13:35 | LauJensen | stuartsierra: thats for parsing isnt it ? |
| 13:35 | stuartsierra | it does both ways |
| 13:35 | powr-toc | I've tried reinstalling and it still fails :-\ |
| 13:36 | LauJensen | great, I'll check it out, thanks |
| 13:37 | stuartsierra | LauJensen: If you google SimpleDateFormatter (or whatever it's called) plus the RFC, you'll find format strings to match. |
| 13:38 | LauJensen | Now thats a pro tip |
| 13:38 | stuartsierra | heh |
| 13:38 | Borkdude | I explored the Java Date API today, it was so ugly |
| 13:39 | stuartsierra | http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html |
| 13:39 | Borkdude | And most of it was deprecated |
| 13:39 | sexpbot | "SimpleDateFormat (Java 2 Platform SE v1.4.2)" |
| 13:39 | Borkdude | .NET is so much nicer with that respect |
| 13:39 | Borkdude | in |
| 13:39 | stuartsierra | Borkdude: Yeah, but there are Java libs that make it nicer. People seem to like Joda Time. |
| 13:39 | Borkdude | Then I finally found something that I could use, but then GWT didn't emulate that... grrrr! |
| 13:40 | stuartsierra | So GWT emulates standard Java classes then? |
| 13:40 | Licenser | gaaaa |
| 13:40 | Borkdude | stuartsierra: yes, but not the Calendar class |
| 13:40 | stuartsierra | Borkdude: gee, that would be annoying |
| 13:41 | Borkdude | it has it's own special date formatting and parsing class which I used eventually |
| 13:41 | stuartsierra | ah |
| 13:41 | stuartsierra | makes sense I suppose, since they've got to manage the differences between java.util.Date and Javascript Date. |
| 13:42 | Borkdude | yes |
| 13:42 | LauJensen | $(-> "Wed, 28 Apr 2010 18:11" java.util.Date. .toString java.util.Date.) |
| 13:42 | sexpbot | DENIED! |
| 13:43 | LauJensen | Thats a classic, it reads a string, make it its own, prints it, and then fails to read its own string representation |
| 13:43 | LauJensen | ,(-> "Wed, 28 Apr 2010 18:11" java.util.Date. .toString java.util.Date.) |
| 13:43 | clojurebot | #<Date Wed Apr 28 18:11:00 PDT 2010> |
| 13:43 | LauJensen | except, with clojurebot it works and in my repl it doesnt... hmmm |
| 13:43 | Borkdude | LauJensen: now Clojure doesn't promise to read it's printed things back into expressions now does it? ;-) |
| 13:44 | LauJensen | Borkdude: Sober API design demands it |
| 13:44 | LauJensen | But I dont understand why it works here and not at home... Must be a locale thing |
| 13:44 | Borkdude | LauJensen: yes, it should, I agree... |
| 13:46 | Borkdude | Wasn't there some kind of (symbol "run" "") problem monday |
| 13:46 | powr-toc | Okay, 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:46 | Borkdude | with printed symbols and reading it back in, not working |
| 13:47 | chouser | yup |
| 13:47 | powr-toc | it seems like lein is picking up a broken dependency from my repository |
| 13:47 | Borkdude | ,(symbol "run" "") |
| 13:47 | clojurebot | run/ |
| 13:48 | stuartsierra | There's a longstanding debate as to whether 'symbol' and 'keyword' should validate their arguments. |
| 13:49 | technomancy | stuartsierra: heh; I have a patch from over a year ago for that. |
| 13:49 | stuartsierra | There are legitimate arguments both ways. |
| 13:50 | stuartsierra | e.g., if you're using symbols as interned strings and never printing them, why limit them to certain characters? |
| 13:51 | stuartsierra | But perhaps all such usage should be replaced with String/intern |
| 13:54 | Borkdude | I didn't actually get the whole problem with (symbol "run" "") |
| 13:54 | Borkdude | it generates a symbol run/ |
| 13:54 | stuartsierra | ,(read-string (pr-str (symbol "run" ""))) |
| 13:54 | clojurebot | java.lang.RuntimeException: java.lang.Exception: Invalid token: run/ |
| 13:55 | chouser | ,run/ |
| 13:55 | clojurebot | Invalid token: run/ |
| 13:55 | Borkdude | ,(pr-str (symbol "run" "")) |
| 13:55 | clojurebot | "run/" |
| 13:55 | Borkdude | the reader can't handle run/? |
| 13:55 | Borkdude | ,(doc read-string) |
| 13:55 | clojurebot | "([s]); Reads one object from the string s" |
| 13:55 | stuartsierra | no, it tries to read it as a namespace-qualified symbol, but there's no symbol name |
| 13:56 | Borkdude | ah, so symbol generates an incorrect symbol name is the problem? |
| 13:56 | stuartsierra | yes |
| 13:56 | Borkdude | and when is this good? |
| 13:57 | stuartsierra | Some people like to use symbols like strings, in the old Lisp tradition. |
| 13:57 | stuartsierra | Old Lisps had no strings, just symbols. |
| 13:57 | Borkdude | I see |
| 13:57 | Borkdude | that's an obscure reason then ? |
| 13:58 | stuartsierra | probably |
| 13:58 | Borkdude | can |
| 13:58 | stuartsierra | Rich has mused on allowing arbitrary characters in Clojure symbols, like Common Lisp. |
| 13:58 | Borkdude | can't the Clojure community just decided this is not 'idiomatic Clojure' ? :) |
| 13:58 | abrenk | The intro page to atoms (http://clojure.org/atoms) is missing a "related functions" section... |
| 13:59 | Borkdude | decide (-d) |
| 13:59 | stuartsierra | I think most of us already have. |
| 13:59 | abrenk | ...took me a while to find reset! - I was wondering if I really had to use swap! with a (fn [_ x] x) argument. |
| 14:00 | abrenk | The intro only mentions swap! and compare-and-set!. |
| 14:00 | Borkdude | I can't recall why he did (symbol "run" "") but that must have been an old way of generating code, without ` ? |
| 14:00 | patrkris | I'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:01 | chouser | re: (symbol (str "run" "")) "It's for a very.... strange thing we're playing with here at the MIT AI lab" -- rlmcintyre |
| 14:02 | powr-toc | Does anyone know if leiningen works with enclojure? |
| 14:03 | powr-toc | I mean lein swank specifically |
| 14:03 | powr-toc | (which I guess is a different question entirely) |
| 14:05 | stuartsierra | Why do you want swank if you're using Enclojure? |
| 14:07 | technomancy | powr-toc: from what I've heard the easiest way to get IDE interop is to use lein pom |
| 14:07 | technomancy | I don't know if Enclojure implements a client for swank |
| 14:10 | Borkdude | chouser: what does (symbol (str "run" "")) generate for a symbol then |
| 14:11 | Borkdude | (str "run" "") is just "run" right? |
| 14:11 | chouser | hm. |
| 14:12 | chouser | indeed. perhaps I misunderstood his issue |
| 14:12 | chouser | ,(= 'run (symbol (str "run" "")) (read-string (pr-str (symbol (str "run" ""))))) |
| 14:12 | clojurebot | true |
| 14:26 | slyphon | technomancy: i'm a little confused, can you replace the functionality of swank-clojure-project using 'M-x slime' and a bunch of configuration? |
| 14:28 | pd | slyphon: yes |
| 14:28 | slyphon | pd: hrm |
| 14:29 | pd | swank-clojure-project is essentially a big (let ((verbose slime-config)) (slime)) |
| 14:29 | pd | with handy hooks and maven support etc |
| 14:30 | slyphon | so you could, in theory use dir-local variables? |
| 14:31 | slyphon | rather .dir-locals.el |
| 14:32 | pd | barring some emacs antiquity that complicated that, i would think so |
| 14:32 | slyphon | hah |
| 14:37 | Borkdude | I wanted to try out this Vijual library from git |
| 14:37 | Borkdude | but leiningen has some trouble downloading the deps |
| 14:37 | Borkdude | can 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:38 | slyphon | probably replace "1.1.0-alpha-SNAPSHOT" with "1.1.0" |
| 14:38 | slyphon | same for line 4 |
| 14:40 | Borkdude | slyphon: trying |
| 14:40 | Borkdude | Repository central will be blacklisted... these msg scare me |
| 14:43 | Borkdude | it's still trying to download |
| 14:43 | slyphon | uh |
| 14:44 | slyphon | well, i'm no expert :/ |
| 14:44 | slyphon | so take what i say with a grain of salt ;) |
| 14:45 | stuartsierra | So what should lazytest do with a form like (describe "The foo function" ...) |
| 14:45 | stuartsierra | Create a Var like the-foo-function-test ? |
| 14:46 | stuartsierra | Add some metadata somewhere? |
| 14:46 | ordnungswidrig | stuartsierra: what will the var / meta contain? |
| 14:46 | ordnungswidrig | sut |
| 14:46 | ordnungswidrig | stuartsierra: why would I care in the test? |
| 14:46 | slyphon | stuartsierra: you'd have to do some scrubbing on the input... |
| 14:47 | stuartsierra | The var/meta will contain the assertions for that test. |
| 14:48 | stuartsierra | You might care when you start reloading test files. |
| 14:48 | ordnungswidrig | ah, ok |
| 14:48 | stuartsierra | For instance, should I try to ensure that reloading the file replaces tests with the same name? |
| 14:48 | stuartsierra | I'm tempted to say no, and provide a function that unloads-and-reloads a namespace. |
| 14:50 | abrenk | Borkdude: seems like Maven cannot reach repo1.maven.org - do you use a proxy? |
| 15:01 | powr-toc | Is there any way to get an enclojure repl with a maven project; without moving to maven-clojure-plugin? |
| 15:04 | giacecco | quick question for you |
| 15:04 | Borkdude | abrenk: no |
| 15:04 | giacecco | if my English is good enough |
| 15:04 | giacecco | I am doing something simple as the following (def runtime (Runtime/getRuntime)) |
| 15:04 | giacecco | (def my-proc (. runtime exec "ls -la")) |
| 15:04 | giacecco | (def my-proc-input (. my-proc getInputStream)) |
| 15:05 | giacecco | the last command returns a java BufferedInputStream but I want a DataInputStream |
| 15:05 | abrenk | Borkdude: 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:06 | giacecco | how do I force the casting of one into the other in Clojure? |
| 15:06 | Borkdude | abrenk: yes |
| 15:06 | Borkdude | abrenk: are you assuming I use the project.clj as is? |
| 15:07 | abrenk | Borkdude: Could you perhaps remove the :repositories keyword? |
| 15:08 | abrenk | Borkdude: leiningen has clojars as one of its default repositories so you should not need to specify it |
| 15:09 | Borkdude | abrenk: removed it, still 1 artifact is missing it says |
| 15:09 | giacecco | I found my solution! I replace the last of my three lines with (def my-proc-input (java.io.DataInputStream. (. my-proc getInputStream))) |
| 15:09 | Borkdude | giacecco: glad we could help you |
| 15:10 | giacecco | borkdude: sometimes, just explaining the problem to someone makes the solution pop up! |
| 15:10 | abrenk | Borkdude: which one's missing? |
| 15:10 | Borkdude | giacecco: yeh :) |
| 15:10 | Borkdude | org.clojure:clojure:jar:1.1.0-alpha-SNAPSHOT |
| 15:10 | Borkdude | |
| 15:11 | abrenk | Borkdude: you should change that to "1.1.0". |
| 15:11 | abrenk | Borkdude: like slyphon recommended |
| 15:11 | Borkdude | abrenk: that's why I asked if you assumed if I used the project.clj as is |
| 15:12 | Borkdude | but I will now change that |
| 15:12 | Borkdude | again ;) |
| 15:12 | abrenk | okay :) |
| 15:13 | abrenk | that'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:14 | Borkdude | I removed the lib dir also |
| 15:14 | Borkdude | so it will get everything from scratch again |
| 15:14 | abrenk | Borkdude: nope |
| 15:14 | abrenk | Borkdude: lib is only a copy of the stuff in ~/.m2/repository |
| 15:15 | Borkdude | yes, with 'get' I mean copy or download ;) |
| 15:15 | abrenk | then you're right |
| 15:15 | Borkdude | abrenk: it works now |
| 15:15 | Borkdude | without changing the contrib |
| 15:15 | abrenk | I'd recommend changing contrib to 1.1.0 also. |
| 15:16 | abrenk | clojure and clojure-contrib have coordinated version IIRC |
| 15:16 | Borkdude | abrenk: when I changed both clojure and contrib in the project.clj it didn't work |
| 15:16 | Borkdude | so I won't change it ;) |
| 15:17 | AWizzArd | rhickey: does Clojure use its own class loader? |
| 15:18 | chouser | AWizzArd: of course, it has to in order to load bytecode dynamically. |
| 15:19 | lancepantz | AWizzArd: DynamicClassLoader |
| 15:19 | abrenk | Borkdude: strange, but oooookay. If you're happy, I'm happy. |
| 15:21 | AWizzArd | Does this class loader install a security manager? |
| 15:21 | abrenk | A vijual visualization of the dgraph nodes in my current project would be nice. |
| 15:21 | AWizzArd | When 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:22 | ivank | (loop [max5 (/ 1000 5) max3 (/ 1000 3)] |
| 15:22 | ivank | (+ |
| 15:22 | ivank | (if (> max3 0) max3) |
| 15:22 | ivank | (if (> max5 0) max5) |
| 15:22 | ivank | (recur (- max5 0) (- max3 0)))) |
| 15:22 | Hodapp | that was almost a drive-by pasteflood |
| 15:23 | ivank | this gets a unsupported op error. says recur must be in tail position |
| 15:23 | ivank | how is that not tail position |
| 15:23 | ninjudd | AWizzArd: DynamicClassLoader should delegate to the AppClassLoader before trying to load anything on its own |
| 15:23 | tomoj | you're adding it to something |
| 15:23 | pd | ivank: it's an argument to + |
| 15:23 | pd | + is in the tail position |
| 15:23 | ivank | hmmm, ok |
| 15:23 | ivank | makes sense |
| 15:24 | tomoj | tail position doesn't just mean "at the bottom" :( |
| 15:24 | tomoj | it means you can't do anything with the result, just return it |
| 15:24 | AWizzArd | The JNLPClassLoader is the one that is granted all permissions. |
| 15:25 | ninjudd | AWizzArd: what does (.getParent DynamicClassLoader) return? |
| 15:25 | Borkdude | abrenk: vijual is now running on my system |
| 15:26 | ninjudd | AWizzArd: or may be (.getParent (.getParent DynamicClassLoader)), seems to wrap it twice |
| 15:27 | abrenk | Borkdude: then start vijualizing :-) |
| 15:28 | Borkdude | abrenk: now using contrib 1.1.0, don't know what I did wrong, but up and running. tnx |
| 15:28 | abrenk | you're welcome |
| 15:28 | Borkdude | abrenk: yes, I think I'm going to make this: http://i.imgur.com/9pKiI.jpg |
| 15:29 | abrenk | Borkdude: Yeah! |
| 15:30 | lpetit | hi |
| 15:41 | sids | how do I use a defrecord Abc declared in namespace pqr in namespace xyz? |
| 15:42 | stuartsierra | sids: import it |
| 15:42 | stuartsierra | it's a class |
| 15:42 | lpetit | sids: 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:42 | sids | stuartsierra: tried, isn't woring, throws a ClassNotFoundException |
| 15:43 | sids | lpetit: I actually want to extend the defrecord, not create an instance of it |
| 15:44 | stuartsierra | sids: you can't extend defrecords |
| 15:44 | stuartsierra | oh you mean extend to a protocol? |
| 15:44 | lpetit | sids: "extend the defrecord" ?? You mean extend a Procol on this defrecord ? |
| 15:44 | sids | stuartsierra: yes, extend a protocol for this defrecord |
| 15:45 | sids | lpetit: sorry, I meant use it in a call to extend-protocol |
| 15:46 | stuartsierra | sids: Check the name. (defrecord Abc) in namespace com.example produces the class named "com.example.Abc" |
| 15:46 | stuartsierra | so you should be able to (import 'com.example.Abc) then |
| 15:46 | lpetit | stuartsierra: 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:46 | stuartsierra | lpetit: yes, that's gone now that datatypes are real classes |
| 15:47 | sids | stuartsierra: that's what I tried, I'll recheck |
| 15:47 | stuartsierra | sids: does the name have any hyphens in it? Those become underscores in the class name |
| 15:47 | lpetit | stuartsierra: ok, I thought it was maybe still present, at least for the records part of the story |
| 15:48 | stuartsierra | lpetit: don't think so |
| 15:49 | lpetit | stuartsierra: you're right, of course. |
| 15:50 | sids | stuartsierra: it wasn't working because the two namespaces were rewuire'ing each other, fixed that and it works now; thanks |
| 15:50 | giacecco | quick question: I can't find where to download clojure and contrib APIs' docs |
| 15:52 | stuartsierra | giacecco: browse at http://richhickey.github.com/clojure/ |
| 15:53 | stuartsierra | download from "download source" link on http://github.com/richhickey/clojure/tree/gh-pages |
| 15:53 | giacecco | that's it |
| 15:54 | stuartsierra | same for contrib, just change "clojure" to "clojure-contrib" in those URLs |
| 15:56 | giacecco | stuartsierra: great thanks |
| 15:56 | stuartsierra | giacecco: you're welcome |
| 15:56 | DuneMan | one can build docs from the a head checkout, right? |
| 15:58 | stuartsierra | I think you need to download the auto-doc tool, but then yes |
| 16:07 | dlowe | what build system is popular these days? |
| 16:07 | lancepantz | ant |
| 16:07 | lancepantz | just kidding. |
| 16:08 | lancepantz | not really though |
| 16:08 | wlangstroth | dlowe: I'm partial to leiningen |
| 16:09 | lancepantz | i'm actually currently putting in a lot of effort to migrate from ant to lein |
| 16:09 | wlangstroth | ant is good if you're used to configure-make-make install |
| 16:09 | dlowe | I'm used to asdf from the common lisp world |
| 16:10 | dlowe | lein looks comparable |
| 16:11 | wlangstroth | it is. It's a wrapper over maven, which can be intimidating |
| 16:11 | dlowe | lein is an abstraction layer over both maven and ant? |
| 16:11 | dlowe | hm |
| 16:13 | wlangstroth | I guess like anything else, once you get into the groove, it's fine (using project.clj) |
| 16:14 | wlangstroth | ant wouldn't be that bad, either, I guess, but lein's project file is in clojure |
| 16:15 | tomoj | another option is maven, either regular old maven or polyglot |
| 16:27 | Licenser | cooookies! |
| 16:33 | naeu | in agent functions what is the first param that's passed by the functions send and send-off? |
| 16:34 | chouser | the first arg of an agent action fn is the current value of the agent |
| 16:35 | chouser | ,(send (agent :initial-value) #(prn :first-arg-is %1)) |
| 16:35 | clojurebot | #<Agent@7f19e2: :initial-value> |
| 16:35 | chouser | meh |
| 16:35 | chouser | ,promise |
| 16:35 | clojurebot | #<core$promise__7326 clojure.core$promise__7326@1ab4788> |
| 16:35 | chouser | ,(let [first-arg (promise)] (send (agent :initial-value) #(deliver first-arg %1)) @first-arg) |
| 16:36 | clojurebot | :initial-value |
| 16:36 | Borkdude | wow, dotrace is cool |
| 16:36 | naeu | hmm, perhaps i'm not using agents in an idiomatic way then |
| 16:36 | naeu | i don't care about the previous value |
| 16:36 | naeu | the new value is obtained by io |
| 16:37 | naeu | I'm trying to create a poller for a 3D mouse |
| 16:37 | DuneMan | why not just have a thread that does the polling? |
| 16:37 | powr-toc | has anyone managed to get an enclojure REPL going inside a maven project? |
| 16:38 | naeu | DuneMan: I'm not really sure how to use threads in Java/Clojure yet |
| 16:38 | DuneMan | It seems to me agents are more appropriate for when you actually want to do message passing. |
| 16:38 | naeu | I read up on the ant.clj demo, and watched Rich's video which was really enlightening |
| 16:38 | DuneMan | naue: (doto (Thread. f "MyThread") (.start)) |
| 16:38 | naeu | and in that he doesn't use any threads |
| 16:39 | naeu | well, not explicitly |
| 16:39 | DuneMan | since all clojure functions are runnable/callable, you can just pass a function to the Thread constructor and start it |
| 16:39 | DuneMan | and you're on your way. |
| 16:39 | DuneMan | for an example of this check out server-socket in clojure-contrib |
| 16:40 | naeu | oh ok |
| 16:40 | naeu | i just didn't think it was appropriate to call Java threads in my code like this unless I was doing interop |
| 16:40 | grzm | anyone recently getting an error with lein? http://gist.github.com/394692 |
| 16:41 | grzm | clojure.lang.Cons cannot be cast to clojure.lang.Named |
| 16:41 | grzm | clojure.lang.Cons cannot be cast to clojure.lang.Named (help.clj:5) |
| 16:41 | naeu | I guess I'm still struggling to know when to look for something in clojure and when to look for something in java |
| 16:41 | technomancy | I did some looking on github, and only two of the last 100 projects used solely ant |
| 16:41 | technomancy | surprised me, but just a bit |
| 16:42 | DuneMan | naeu: 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:42 | naeu | DuneMan: I'm not at ease enough to do that yet. I'm still flailing around :-) |
| 16:42 | DuneMan | but I'm pretty new to this, technomancy would probably have a better opinion to listen to. |
| 16:43 | abrenk | Hm. The problem with uncompiled Clojure code and project.clj - you can forget dependencies. |
| 16:43 | naeu | well, i got my poller working with agents :-) |
| 16:43 | abrenk | incanter-charts' project.clj does not declare a depency on incanter-stats but uses it. |
| 16:44 | DuneMan | i may just be too used to my normal way of desiging multi-threaded programs, instead of using agents all over. |
| 16:45 | powr-toc | Is there anything special about the REPL you get in labrepl/enclojure? |
| 16:45 | powr-toc | Because I can't seem to recreate it for other projects |
| 16:45 | abrenk | Any Incanter committer here? |
| 16:45 | liebke | abrenk: what function from stats is it? |
| 16:45 | naeu | DuneMan: I have the advantage/disadvantage of not really having done any serious multi-treaded programming |
| 16:46 | DuneMan | Ah, yeah. not having to unlearn old habits. |
| 16:46 | abrenk | liebke: incanter.stats :only (quantile quantile-normal cumulative-mean sd) |
| 16:47 | technomancy | ~1d2 |
| 16:47 | clojurebot | excusez-moi |
| 16:47 | technomancy | ,1d2 |
| 16:47 | clojurebot | Invalid number: 1d2 |
| 16:47 | technomancy | clojurebot: 1d2 |
| 16:47 | clojurebot | Excuse me? |
| 16:47 | technomancy | ... |
| 16:47 | kotarak | ,1r2 |
| 16:47 | clojurebot | Radix out of range |
| 16:47 | defn | ,Q |
| 16:47 | clojurebot | <-nil-< |
| 16:47 | hiredman | clojurebot: 1d6 |
| 16:47 | clojurebot | Excuse me? |
| 16:47 | kotarak | ,2r1 |
| 16:47 | clojurebot | 1 |
| 16:47 | liebke | ah, 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:48 | hiredman | nuts then |
| 16:48 | abrenk | liebke: Ah... incanter.stats is contained in incanter-core... strange. |
| 16:48 | liebke | yeah, a bit confusing. |
| 16:48 | liebke | incanter modules are based on third party dependencies |
| 16:48 | abrenk | liebke: I get java.lang.ExceptionInInitializerError (charts.clj:1762) |
| 16:48 | liebke | incanter.core depends only on parallel colt |
| 16:48 | abrenk | liebke: Incanter 1.2.2 |
| 16:49 | liebke | sounds like the error when you have conflicting versions of clojure |
| 16:49 | liebke | do you have a dependency on clojure 1.1 |
| 16:49 | abrenk | Yeah. |
| 16:49 | liebke | the current version only works with clojure 1.2 |
| 16:49 | hiredman | clojurebot: 1d6 |
| 16:49 | clojurebot | Pardon? |
| 16:49 | abrenk | that explains a lot |
| 16:49 | hiredman | 1d2 |
| 16:49 | clojurebot | 2 |
| 16:49 | hiredman | bah |
| 16:50 | abrenk | liebke: What's the last version that works with Clojure 1.1? |
| 16:50 | liebke | 1.0 |
| 16:50 | abrenk | thx |
| 16:52 | pjstadig | ~1d2 |
| 16:52 | clojurebot | Pardon? |
| 16:52 | hiredman | 1d2 |
| 16:52 | clojurebot | 1 |
| 16:52 | hiredman | clojurebot: weirdo |
| 16:52 | clojurebot | I don't understand. |
| 16:52 | abrenk | liebke: okay, Maven shows a conflict between clojure version 1.1.0 and 1.2.0-master-SNAPSHOT |
| 16:52 | pjstadig | 1d2 |
| 16:52 | clojurebot | 2 |
| 16:52 | technomancy | we need a less violent version of botmack |
| 16:52 | technomancy | *botsmack |
| 16:52 | technomancy | something to express irritation without resorting to force |
| 16:52 | hiredman | or a more violent version of botsnack |
| 16:53 | liebke | abrenk: for version 1.0? |
| 16:53 | pjstadig | yes |
| 16:53 | abrenk | liebke: no, still 1.2.2 |
| 16:53 | pjstadig | botslaponthewrists |
| 16:54 | liebke | okay |
| 16:54 | abrenk | liebke: I just wanted to check if I could have found that conflict using maven |
| 16:54 | liebke | ah |
| 16:56 | abrenk | The Dependency Hierarchy in Eclipse's POM Editor shows the conflict. |
| 16:59 | powr-toc | labrepl/enclojure seems to be broken |
| 17:01 | abrenk | liebke: 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:01 | powr-toc | We're using the latest enclojure and Netbeans 6.8 on Windows |
| 17:01 | liebke | abrenk: 1.0 wasn't compatible with clojars, go to http://repo.incanter.org |
| 17:01 | sexpbot | "Incanter: Statistical Computing and Graphics Environment for Clojure" |
| 17:01 | powr-toc | we no longer get syntax highlighting, nor do we see "Start project repl" |
| 17:05 | Plouj | java 7 isn't going to have tail call optimizations, is it? |
| 17:06 | AWizzArd | guys, 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:07 | AWizzArd | no more html+js madness, incompatibilities, crossbrowser issues, stateless connections, etc |
| 17:08 | abrenk | liebke: okay, another repo, got that. The groupId is still org.incanter I've got the artifacts now, but still no luck: |
| 17:08 | ninjudd | AWizzArd: sweet! so, what was the classloader problem? |
| 17:08 | abrenk | user=> (use '(incanter core charts)) --> java.lang.IllegalAccessError: grid-apply is not public (charts.clj:19) |
| 17:09 | abrenk | But I will figure it out. Thanks for your help. |
| 17:09 | AWizzArd | ninjudd: the Clojure class loader simply grants no rights at all |
| 17:09 | liebke | I don't think grid-apply is in version 1.0 |
| 17:09 | ninjudd | AWizzArd: hmm, so how did you fix it? |
| 17:09 | AWizzArd | and the <all-permissions /> tag only grants permissions for the JNPLclassLodaer |
| 17:10 | AWizzArd | ninjudd: I had to put my own grant_all.policy file into the signed jar that I deploy. |
| 17:10 | AWizzArd | Then, when the program starts I load this as a resource out of the jar and replace the System policy with mine. |
| 17:10 | ninjudd | huh, so is this a bug in the clojure classloader? |
| 17:10 | abrenk | liebke: my bad, I still had a copy of the 1.2.2 charts.clj in my src folder. Everythings alright now! |
| 17:11 | AWizzArd | After that I can (require 'my.real.programs.ns) and (eval '(my.real.programs.ns/real-startup-fn)) |
| 17:11 | liebke | abrenk: great |
| 17:11 | AWizzArd | ninjudd: well, not a bug, but it does not assume to run in a sandbox |
| 17:12 | AWizzArd | Here 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:12 | sexpbot | "Bug ID: 4809366 all-permissions does not grant permission for getClassLoader()" |
| 17:12 | ninjudd | AWizzArd: are you ahead-of-time compiling your clojure files? |
| 17:12 | AWizzArd | yes |
| 17:13 | AWizzArd | my 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:15 | DuneMan | hi |
| 17:15 | ninjudd | oh. 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:15 | ninjudd | but 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:17 | AWizzArd | ninjudd: true, intuitively one would think so, but Sun confirmed that this should not be the case. |
| 17:18 | AWizzArd | Those 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:19 | DuneMan | nowhere in the traceback does it say anything about some code you wrote? |
| 17:19 | AWizzArd | Today I WebStarted my first "Hello World" with clj-pivot |
| 17:20 | _brian2_ | no |
| 17:20 | Borkdude | When I do C-x k <RET> in Erc, is this a good way to leave a channel |
| 17:22 | DuneMan | _brian2_: Have the code down to something small enough that you can paste it on paste.lisp.org? |
| 17:22 | _brian2_ | ok |
| 17:23 | DuneMan | also, Im assuming this is single-threaded? |
| 17:23 | _brian2_ | yes |
| 17:24 | tomoj | Borkdude: #erc |
| 17:25 | Borkdude | tomoj: tnx |
| 17:31 | quotemstr | Is it possible to write Eclipse extensions in Clojure? |
| 17:32 | Chousuke | probably |
| 17:32 | zakwilson_ | 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:32 | Chousuke | clojure 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:33 | quotemstr | Ah, 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:35 | Chousuke | well hm |
| 17:35 | _brian2_ | DuneMan : http://clojure.pastebin.com/L0eiMZQS (I left the password in, i'll change it later) |
| 17:35 | Chousuke | that's not quite true, as a java editor will still have an inflexible (static, java-style) design |
| 17:35 | Chousuke | most of emacs' customisability comes naturally from it being implemented in lisp |
| 17:36 | AWizzArd | quotemstr: 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:36 | quotemstr | I've never looked at the Eclipse and NetBeans extension APIs. |
| 17:36 | quotemstr | Are they really that bad? |
| 17:37 | AWizzArd | very evil stuff |
| 17:37 | ninjudd | technomancy: does lein pull down dependencies of dependencies automatically when i do 'lein deps'? |
| 17:38 | AWizzArd | layers over layers of layers of complexity and bureaucracy |
| 17:38 | quotemstr | Oh, wonderful. |
| 17:38 | quotemstr | And I thought Firefox with its components system was bad. |
| 17:40 | Licenser | for those interested in swing in clojure: http://blog.licenser.net/2010/05/11/the-ease-of-guis |
| 17:40 | sexpbot | "lice! : The ease of gui's." |
| 17:40 | tomoj | annotations are the only problem I've run into |
| 17:41 | quotemstr | cjl? |
| 17:41 | technomancy | ninjudd: yeah |
| 17:41 | tomoj | I think writing hudson plugins requires their use, unfortunately |
| 17:41 | quotemstr | Stupid TLAs. |
| 17:42 | ninjudd | technomancy: i was looking for the code that does it, but i suppose that comes from maven, right? |
| 17:42 | technomancy | yup |
| 17:42 | Chousuke | Licenser: I think the font on your blog is way too small :P |
| 17:43 | Licenser | ? |
| 17:44 | ninjudd | technomancy: cool, do you know if native-deps pulls native-dependencies of your dependencies too? |
| 17:44 | Borkdude | Licenser: nice :) now I'll wait for a library that can convert that code to a website instead of swing ;) |
| 17:45 | technomancy | ninjudd: I haven't used it, but I suspect it does |
| 17:45 | ninjudd | how would it do it? by adding the dep to the pom file? |
| 17:45 | Licenser | Borkdude: look at the pivo lib |
| 17:46 | Borkdude | Licenser: it sounds delicious, but where can I find it? |
| 17:47 | zakwilson | Next time I need a GUI, I'll be using that. |
| 17:47 | technomancy | ninjudd: sorry, I don't know anything about native deps. see if you can catch dnolen when he's around. |
| 17:47 | ninjudd | technomancy: ok, thanks, i will |
| 17:47 | zakwilson | Because there are so many Java programmers out there who already know Swing? |
| 17:48 | quotemstr | Don't most? |
| 17:48 | Licenser | Borkdude: it's clj-pivot I think |
| 17:48 | zakwilson | Dunno. I wrote an applet once. |
| 17:48 | quotemstr | http://www.javalobby.org/java/forums/t101605.html |
| 17:48 | sexpbot | "Roundtrip: From Swing to Ajax and back!" |
| 17:49 | quotemstr | Then there's GWT. |
| 17:49 | Borkdude | zakwilson: GWT solves that problem partially, it lets you program in Java but it generates client side websites for you |
| 17:49 | zakwilson | I 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:50 | Licenser | zakwilson: swing IS horrible. But it is shipped with java which is a big + |
| 17:50 | Borkdude | you mean Java is more horrible, so Swing looks better? |
| 17:50 | Licenser | Borkdude: no because you don't need to install anything extra, swing goes for a jvm app for free |
| 17:51 | quotemstr | AIUI, what's more horrible is that plenty of developers see Swing as a model to imitate. |
| 17:51 | zakwilson | Licenser: 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:52 | Licenser | zakwilson: me neither :P |
| 17:53 | quotemstr | zakwilson: SWT? |
| 17:54 | DuneMan | _brian2_: What happens if you use a fetch-one there? |
| 17:54 | _brian2_ | same problem |
| 17:55 | _brian2_ | can't call something |
| 17:55 | DuneMan | that is some oddly formatted clojure |
| 17:55 | _brian2_ | hmm |
| 17:55 | _brian2_ | why? |
| 17:55 | DuneMan | Well, part of it is that you're doing stuff really... weridly |
| 17:55 | clojurebot | http://clojure.org/rationale |
| 17:56 | DuneMan | mongo! does creates a new mongodb connection and binds it to *mong-config* |
| 17:56 | _brian2_ | its a mixed o a bit |
| 17:56 | DuneMan | *mongo-config* |
| 17:56 | Borkdude | why does clojurebot say that out of the blue? |
| 17:56 | _brian2_ | ok |
| 17:56 | technomancy | Borkdude: clojurebot is an evolving intelligence |
| 17:57 | technomancy | it's practicing for the Turing test finals at the end of the semester. |
| 17:57 | technomancy | hehe |
| 17:57 | DuneMan | _brian2_: So your creation of a mongo instance isn't being used by the congomongo calls |
| 17:57 | Borkdude | clojurebot: do you also do eliza kind of conversations? |
| 17:57 | clojurebot | Excuse me? |
| 17:57 | _brian2_ | yea, I kind thoght that |
| 17:57 | Borkdude | clojurebot: you know what I'm talking about |
| 17:57 | clojurebot | Huh? |
| 17:57 | Borkdude | clojurebot: don't pretend |
| 17:57 | clojurebot | Pardon? |
| 17:58 | _brian2_ | do I need to do more homewrok? |
| 17:58 | _brian2_ | homework |
| 17:58 | _brian2_ | like read congomongo code |
| 17:59 | DuneMan | _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:01 | DuneMan | you could make your own version of mongo! that does what you want, or even wraps the libary version. |
| 18:01 | DuneMan | lots 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:04 | DuneMan | ah, yes, on the db |
| 18:05 | _brian2_ | so yo're comment above isn't correct, right? |
| 18:05 | DuneMan | yea. (:db *mongo-config*) |
| 18:06 | _brian2_ | ok, I'll give it a try, thanks! |
| 18:11 | Borkdude | http://tryclojure.licenser.net/ is basically the same as tryclj.licenser.net, only a different presentation? |
| 18:11 | sexpbot | "TryClojure" |
| 18:12 | Borkdude | Licenser? |
| 18:16 | abrenk | Licenser: I will definately check out clj-swing... why do you like gridbag so much? clojure.contrib has such a nice wrapper around miglayout. |
| 18:19 | abrenk | Licenser: and take a look at dgraph - nice way to propagate state changes to dependent components |
| 18:20 | srcerer | Just 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:21 | Licenser | abhi__: abrenk I took grid layout from stuarts example |
| 18:21 | Licenser | abrenk: I mean |
| 18:21 | Licenser | and I think miglayout is an aditional dependency right? |
| 18:21 | abrenk | yep |
| 18:22 | Licenser | I qouls pewdEW RO FO QIRHOUR |
| 18:22 | abrenk | but it's really much more fun that gridbag |
| 18:22 | Licenser | Borkdude: it has the same roots I took some modifcations to the code and added a diferent gui |
| 18:27 | Licenser | Borkdude: 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:28 | Borkdude | Licenser: what are basically the two approaches? |
| 18:29 | Licenser | currently mostly forms (all self made) vs pure JS/AJAX (and (adjusted) scripts from other places that made stuff already) |
| 18:30 | Borkdude | Licenser: I think I will mention your version on my Twitter account @cleotd |
| 18:31 | Borkdude | it's only maybe annoying that newbe's can't do def or defn |
| 18:32 | Licenser | Borkdude: 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:33 | Borkdude | ideone.com supports it |
| 18:34 | quotemstr | Licenser: Put each session in a sandbox, limit the maximum size of each sandbox, and expire sandboxes with a timeout? |
| 18:34 | Licenser | quotemstr: yes but limit the size is the hard question and I'm not sure how clojure handles deleted namespaces |
| 18:34 | DuneMan | restart the jvm once a minute! |
| 18:34 | quotemstr | Licenser: Too complicated. Use separate unix processes. |
| 18:35 | Licenser | neither of those seems like a clean solution to me :( |
| 18:36 | quotemstr | I think of process isolation as a very clean solution myself. |
| 18:36 | DuneMan | sometimes I prefer the solutions that I think of immediately to the clean ones |
| 18:36 | Raynes | Borkdude: you can use def and defn in mine, btw. |
| 18:36 | Borkdude | maybe you can host it on GAE and then memory is not your problem anymore? ;) |
| 18:37 | Borkdude | Raynes: ah, +1 |
| 18:38 | Borkdude | another thing I miss is parenthesis matching and incompleted input throws and exception |
| 18:38 | Borkdude | instead of the possibility to complete it |
| 18:39 | Borkdude | so 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:50 | lancepantz | anyone used the repl-fix branch of lein with any luck? |
| 18:53 | DuneMan | brian: *mongo-config* is in somnium.congomongo.config: (use '[somnium.congomongo.config :only [*mongo-config*]]) |
| 18:53 | DuneMan | then you can use @*mongo-config* |
| 18:53 | _brian2_ | hmm, ok |
| 18:53 | DuneMan | (reading congomongo.clj is useful :-)) |
| 18:54 | _brian2_ | yea, I am still learning clojure ;-) |
| 18:54 | technomancy | lancepantz: it's been merged to master; shouldn't need the branch anymore |
| 18:55 | lancepantz | ah, cool- thanks |
| 19:01 | technomancy | how do you define your own .meta method in reify? |
| 19:06 | technomancy | I thought defrecord was the one that didn't let you define your own meta semantics |
| 19:24 | ivank | how do i add an item to the end of a list/vector? |
| 19:28 | technomancy | ivank: conj adds to the end of a vector. there's no good way to add to the end of a list. |
| 19:28 | powr-toc | depends on the concrete type... lists grow at the front, vectors the end... conj will do this |
| 19:32 | ivank | ah, |
| 19:32 | ivank | cheers |
| 19:35 | ivank | when nesting loops, can i get a recur on the inner to go to the outer |
| 19:42 | MadWombat | Hello |
| 19:43 | powr-toc | ivank, not that I know of... why do you need loops? |
| 19:43 | ivank | thinking in wrong mindset? |
| 19:43 | powr-toc | most likely :-) |
| 19:44 | powr-toc | what are you trying to do? |
| 19:44 | ivank | find all primes up to n |
| 19:44 | powr-toc | try looking at map |
| 19:45 | ivank | don't see how map works for this |
| 19:45 | powr-toc | combining it with filter should work for a simple brute force solution |
| 19:46 | powr-toc | or use a list comprehension (for) |
| 19:46 | ivank | ugh, for is ugly |
| 19:47 | powr-toc | (filter is-prime? (iterate inc 0)) |
| 19:52 | ivank | that'll do the whole is-prime? every time though, |
| 19:52 | technomancy | powr-toc: not if you def it to a top-level var |
| 19:52 | technomancy | course then you hold the head |
| 19:53 | powr-toc | technomancy: naturally you wouldn't want to do that :-) |
| 19:55 | powr-toc | ivank: yes, it's the brute force method... do you need to use a sieve? |
| 19:55 | lancepantz | technomancy: using the lein 1.2 master, 'lein repl' just 'prints [null] user=>' and exits, have you seen that before? |
| 19:56 | lancepantz | guess that quote should be after prints |
| 19:56 | powr-toc | because you could probably memoize is-prime? if memory isn't a concern... |
| 19:57 | ivank | memoize? |
| 19:58 | powr-toc | ,memoize |
| 19:58 | clojurebot | #<core$memoize__6555 clojure.core$memoize__6555@b1babb> |
| 19:58 | powr-toc | ,(doc memoize) |
| 19:58 | clojurebot | "([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:59 | ivank | ah, not quite |
| 19:59 | ivank | since im looking the list of primes, i can use the list of n primes to calculate the n+1 prime |
| 20:02 | powr-toc | you mean the sieve of erastothenese |
| 20:02 | DuneMan | I got robbed at gunpoint once while writing a multithreaded prime sieve |
| 20:02 | MadWombat | can someone explain hpw struct-maps are optimized? what are the cases where struct-map is faster than a regular hash-map? |
| 20:03 | DuneMan | and my poorly ventialated dual AMD Athalon freaked out 'cause I had a bug.... and the machine locked up tight from overheating |
| 20:03 | DuneMan | ... unpleasant. |
| 20:03 | DuneMan | Athelon ? how do you spell that |
| 20:03 | DuneMan | Athlon |
| 20:04 | powr-toc | MadWombat: they share their keys... so checks are on identity not equality; and you save memory as the keys are only stored once |
| 20:05 | MadWombat | powr-toc: OK, thanks |
| 20:06 | DuneMan | My coworker bob says "I think they're implemented under the hood as java classes" |
| 20:06 | DuneMan | not sure if that's true, but it would make sense. Key access would just be field lookup. |
| 20:09 | powr-toc | DuneMan: 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:12 | powr-toc | I think your coworkers thinking of records, due in 1.2; which are implemented as classes |
| 20:42 | alexyk | is there a faster way to negate a map than, |
| 20:42 | alexyk | ,(->> {:a 2 :b 1 :d 4} (map (fn [[k v]] [k (- v)])) (into {})) |
| 20:42 | clojurebot | {:a -2, :b -1, :d -4} |
| 20:42 | alexyk | generally, is the a fun to work on a map and leave it a map? |
| 20:43 | lancepantz | i always do it as you did |
| 20:43 | lancepantz | doesn't mean i'm right though :) |
| 20:44 | alexyk | lancepantz: well it works! BTW I think I understand why tokyo was slow to write on my ext3 |
| 20:44 | alexyk | it spent all the time in kjournald |
| 20:44 | alexyk | folks reported turning journaling off in FS to speed up TC |
| 20:44 | alexyk | ext3 seems especially bad after 2-3 GB |
| 20:45 | lancepantz | oh wow, that's good to know |
| 20:45 | alexyk | so you guys can try to format some fast crappy FS to compare write speeds on your giant mormon graph :) |
| 20:46 | lancepantz | do you remember what your benchmarks were after switching? |
| 20:46 | alexyk | lancepantz: I didn't do it yet, I just googled for tokyo cabinet kjournald and it fished out a stackoverflow answer like above |
| 20:47 | alexyk | but I've seen kjournald dominate my top during writes, with 1.7% CPU load |
| 20:49 | alexyk | lancepantz: 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:49 | ninjudd | alexyk: 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:50 | ninjudd | alexyk: did using protobuf dump affect the write time at all? |
| 20:51 | alexyk | ninjudd: 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:52 | alexyk | btw, manual map/reduce works faster than pmap; or it may be a fluke. |
| 20:52 | alexyk | so protobuffing seems to indeed speed things up |
| 20:53 | alexyk | ninjudd: I wonder if kyoto cabinet's concurrency is better |
| 20:53 | alexyk | perhaps then we can read/write in threads |
| 20:54 | powr-toc | alexyk: I don't know if it's slower or not, but you can also (merge-with - my-map my-map my-map) :-) |
| 20:54 | alexyk | powr-toc: that surely would set some Java people's hair on fire :) |
| 20:55 | alexyk | powr-toc: that deserves to be measured on a huge map |
| 20:55 | powr-toc | sure is combustible :-) |
| 20:56 | ninjudd | alexyk: from what i understand, kyoto is slightly slower for a single thread but may be faster for multiple threads |
| 20:56 | ninjudd | it would be an interesting test |
| 20:57 | alexyk | ninjudd: yeah, another option |
| 20:57 | ninjudd | i'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:57 | alexyk | ninjudd: but anything protobuffering is simple to pmap anyways |
| 20:58 | alexyk | ninjudd: cool, worth giving JE another chance |
| 20:58 | alexyk | sice JE does parallel reads just fine |
| 20:58 | alexyk | since |
| 20:59 | ninjudd | sure, JE was much slower for us |
| 20:59 | ninjudd | but it would be a good option for people who want a pure Java implementation |
| 22:13 | chessguy | running 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:27 | peregrine81 | I'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:46 | technomancy | so: considering including the lein-swank plugin in swank-clojure. |
| 23:46 | technomancy | it's like 17 lines |
| 23:46 | technomancy | yea or nay? |