2010-01-11
| 00:21 | chouser | mebaran151: ha! |
| 00:22 | mebaran151 | in Soviet Russia, Java writes You! |
| 00:23 | mebaran151 | though oddly enough, Java is the opposite of a classless language .... |
| 00:24 | mebaran151 | but it does personify class struggle :) |
| 00:34 | defn | I wonder how many lispers grew up poor... |
| 01:10 | mebaran151 | hmmm |
| 01:10 | mebaran151 | any ClojureQL junkies about? I've got an col declared primary_key and it's still letting in nils |
| 01:44 | Raynes | I wish I could get Slime working with the 'new' branch. :'( |
| 01:55 | mebaran151 | I wish I could get auto-gen id's to work in clojureql |
| 02:54 | mebaran151 | I'm having ClojureQL anxiety |
| 03:29 | LauJensen | Morning team |
| 03:29 | mebaran151 | oh Lau, just who I was looking for :) |
| 03:29 | defn | G'morning |
| 03:30 | mebaran151 | I can't seem to get identity columns to work in derby |
| 03:31 | mebaran151 | le paste: http://gist.github.com/274089 |
| 03:35 | mebaran151 | I also can't seem to get the examples to auto-inc an id either |
| 03:37 | LauJensen | sec |
| 03:38 | LauJensen | Are you working on a recent pull ? |
| 03:38 | mebaran151 | I'm gonna try to document all this on your wiki once I get a chance |
| 03:38 | mebaran151 | fairly recent |
| 03:38 | mebaran151 | my sources have references to auto-inc and not-nulls |
| 03:38 | LauJensen | Great |
| 03:38 | mebaran151 | I'm running Derby 10.4.2 |
| 03:39 | LauJensen | Let me just check my snapshot |
| 03:39 | LauJensen | Yea, its non-nulls instead of not-nulls in my recent push |
| 03:39 | mebaran151 | http://gist.github.com/274092 |
| 03:40 | LauJensen | Same |
| 03:40 | mebaran151 | oh yep it is |
| 03:40 | mebaran151 | but auto-inc should be the same? |
| 03:40 | LauJensen | But as always, if something isn't working, print out the SQL statement and see whats missing, I expect it would be quite clear in this case that NOT NULL was not being set for all those variables you listed |
| 03:41 | mebaran151 | I'll look for an example of compile-sql |
| 03:42 | LauJensen | (with-connection [c (make-con...)] (compile-sql (query tables *) c)) |
| 03:42 | LauJensen | or even better |
| 03:42 | LauJensen | http://whollyweirdwyrd.blogspot.com/2009/12/testing-clojureql.html |
| 03:43 | defn | boom boom chicka chicka boom boom |
| 03:44 | defn | how do i get all of the items after the 2nd item in a list? |
| 03:44 | defn | is there any way better than (rest (rest coll)) |
| 03:44 | LauJensen | ,(drop 2 [1 2 3 4]) |
| 03:44 | clojurebot | (3 4) |
| 03:44 | defn | cool thanks LauJensen |
| 03:45 | LauJensen | (->> [1 2 3 4] rest rest) |
| 03:45 | LauJensen | ,(->> [1 2 3 4] rest rest) |
| 03:45 | clojurebot | (3 4) |
| 03:45 | LauJensen | np |
| 03:45 | unfo- | what is '->>' |
| 03:46 | defn | ,(doc ->>) |
| 03:46 | clojurebot | "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc." |
| 03:46 | unfo- | ah |
| 03:46 | LauJensen | ,(->> (range 10) (filter even?) (map inc)) |
| 03:46 | clojurebot | (1 3 5 7 9) |
| 03:46 | unfo- | fold right, sort of? |
| 03:46 | LauJensen | No map is more like fold right |
| 03:47 | defn | this changes the order of computation |
| 03:47 | LauJensen | Sort of |
| 03:47 | LauJensen | It just takes the first arg and sets it as the last arg to the remaining forms |
| 03:47 | defn | it's like obj.method1.method2.method3 |
| 03:47 | mebaran151 | LauJensen, I'm getting an error, wrong number of args passed to clojureql$fn |
| 03:48 | LauJensen | mebaran151: Paste the culprit please |
| 03:48 | defn | LauJensen: what's the diff between -> and ->> |
| 03:48 | LauJensen | -> threads the first item as the second item, ->> threads the first item as the last item |
| 03:48 | LauJensen | ,(-> #(+ % 2) (map (range 10))) |
| 03:48 | clojurebot | (2 3 4 5 6 7 8 9 10 11) |
| 03:48 | mebaran151 | http://gist.github.com/274096 |
| 03:49 | mebaran151 | I love the Clojure seq library: it's what drew me to the language |
| 03:49 | mebaran151 | I realized I spent most of my time manipulating collections rather than just objects |
| 03:50 | LauJensen | I wish I was that clever - I was really into Common Lisp when Clojure came along, you know what first got me interested? |
| 03:50 | mebaran151 | hm? |
| 03:50 | LauJensen | (javax.swing.JOptionPane/showMessageDialog nil "Hello GUI") |
| 03:50 | mebaran151 | oh heh, I do most of my GUI stuff in Adobe AIR, so I never had to write Soviet GUI |
| 03:51 | LauJensen | mebaran151: I cant anote a gist, but you define c as the connection, but never pass it to compile-sql |
| 03:51 | mebaran151 | I tried both ways |
| 03:51 | mebaran151 | inserting a c after compile-sql produces |
| 03:51 | LauJensen | started]))) == started]) c)) |
| 03:52 | mebaran151 | no multimethod for org.apache.derby.impl |
| 03:53 | mebaran151 | okay got that to work |
| 03:53 | mebaran151 | now I see that I'm not getting nulls and IDENTITY columns, but the real question is why |
| 03:55 | LauJensen | Here I get this "CREATE TABLE invoices (id int NOT NULL GENERATED ALWAYS AS IDENTITY ,consumer_id int NOT NULL ,item_id int NOT NULL ,details varchar(640),snapshot_cap decimal(12, 4),started int NOT NULL ,executed int,expires int,PRIMARY KEY (id))" |
| 03:55 | mebaran151 | hmmmm |
| 03:55 | LauJensen | Next time you can use a paste bin to get annotations |
| 03:56 | mebaran151 | should I repull? |
| 03:56 | mebaran151 | so I'm calling create table correctly but my clojureql is broken |
| 03:56 | LauJensen | Try repulling to a new directory and add that to cp instead, see if you get a different result |
| 03:56 | LauJensen | I have 2 major merge requests coming up, so things will start shaking soon, as 1.0 is coming very close |
| 03:56 | mebaran151 | man I don't have gradle: I borrowed this build |
| 03:57 | LauJensen | hehe |
| 03:57 | LauJensen | Gradle takes what, 25 secs to install ? |
| 03:57 | mebaran151 | never installed it yet |
| 03:57 | mebaran151 | you can't beat lein for the install |
| 03:57 | LauJensen | I think I show how in the blog-post |
| 03:58 | LauJensen | unzip gradle, add 2 env-variables, thats it |
| 03:58 | LauJensen | export PATH=$PATH:/PATH/TO/gradle-0.8/bin |
| 03:58 | LauJensen | export GRADLE_HOME=/PATH/TO/gradle-0.8 |
| 03:58 | mebaran151 | yep I googled |
| 03:59 | mebaran151 | is the version on clojars functional? |
| 04:00 | LauJensen | Yes, but Clojars is broken in that if you search for a repo you rarely get the right one, so clojars.org/clojureql |
| 04:00 | LauJensen | I'm out, highlight 'LauJensen' of privmsg if u need me |
| 04:03 | mebaran151 | thanks Lau |
| 04:03 | mebaran151 | I'll keep on hacking |
| 04:03 | esj | Good Morning, Parentherati. |
| 04:03 | mebaran151 | you've been great |
| 04:11 | LauJensen | *sigh* already back again |
| 04:12 | LauJensen | A customer called me up, because they had some old html data tucked away in a database which they needed to have extracted and ordered. Clojure+CQL made it almost too easy |
| 04:14 | esj | Just so long as the customer doesn't know that |
| 04:15 | LauJensen | They'll be happy to hear it |
| 04:17 | mebaran151 | got gradle up and running |
| 04:17 | mebaran151 | now to go on a building adventure! |
| 04:19 | Raynes | ,(->> 3 .toString println) |
| 04:19 | clojurebot | 3 |
| 04:20 | Raynes | That's pretty cool. |
| 04:20 | Raynes | It backwardizeseses it. :D |
| 04:20 | Raynes | (doc ->) |
| 04:20 | clojurebot | "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc." |
| 04:22 | LauJensen | Haha Raynes - We should ask Rich to update the doc string "Macro which backwardizeses the expressions" |
| 04:22 | Raynes | Absolutely. :) |
| 04:23 | unfo- | what is the diff between -> and ->> ? |
| 04:23 | Raynes | ,(-> 3 .toString (println (str "meow"))) |
| 04:23 | clojurebot | 3 meow |
| 04:23 | Chousuke | the expr is threaded to the second and last place, respectively |
| 04:23 | Raynes | ,(->> 3 .toString (println (str "meow"))) |
| 04:23 | clojurebot | meow 3 |
| 04:23 | Raynes | That is the difference. |
| 04:23 | Raynes | :D |
| 04:23 | unfo- | aaa ty! |
| 04:28 | LauJensen | hehe, somebody will have fun reading this log tonight - First we discuss -> vs ->> and someone asks, whats the diff? 20 minutes later unfo and Raynes repeat the process :) |
| 04:29 | unfo- | :P |
| 04:31 | Raynes | :o |
| 04:41 | LauJensen | Raynes: You accidentally pasted your Twitter update in here :( |
| 04:41 | LauJensen | (just kidding) |
| 04:47 | defn | so... what's the difference between -> and ->>? |
| 04:49 | the-kenny | defn: The position where the argument gets inserted |
| 04:49 | the-kenny | ,(doc ->) |
| 04:49 | clojurebot | "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc." |
| 04:49 | the-kenny | ,(doc ->>) |
| 04:49 | clojurebot | "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc." |
| 04:49 | the-kenny | Second vs. Last |
| 04:49 | defn | the-kenny: i was joking |
| 04:49 | defn | as per Lau's quote above |
| 04:49 | the-kenny | defn: Uh.. sorry. |
| 04:49 | defn | np :) |
| 04:50 | the-kenny | I was writing on a text for my art class and I didn't read the quote |
| 04:52 | esj | ok, so three discussions about -> in, feels like time to figure out emacs and slime :) |
| 04:55 | esj | on a different note. (seriously) A memoized function is in some sense a memory leak. Is there a way to limit the number of values it stores ? Or is this default behaviour and I didn't realise ? |
| 04:56 | unfo- | well it is a stupid cache, in that it does not discriminate and caches every result |
| 04:56 | unfo- | if you want sophistication, implement your own :-) |
| 04:56 | unfo- | this is what i learned from Programming Clojure :) |
| 04:57 | esj | ohoh, the problem with that is that anything I do is, by definiton, stupid. So that's a dead end :) |
| 04:58 | esj | thanks for the answer though, appreciated. |
| 04:58 | unfo- | also worth noting: you can use memoization in conjuntion with lazy-seq to make it lazy :) |
| 04:59 | esj | interesting |
| 04:59 | unfo- | esj, but still if you do (take-nth 100000000000 (some-big-calculations-memoized)) it is still gonna take lotsa memory :)= |
| 05:00 | esj | yeah, unless I use a circular buffer on the memoization :) |
| 05:40 | quizme | is it possible to make the snake game without mutable state ? |
| 05:40 | unfo- | i haven't gotten to the snake game part yet in my ebook ^_^ |
| 05:42 | Raynes | I believe it's possible. |
| 05:53 | Chousuke | quizme: I don't think it's possible to write any game without *some* state, but you sure can keep it down to minimum |
| 05:55 | quizme | chousuke: like you could keep making cheap copies of snake positions for example. |
| 05:57 | Chousuke | you still need to store the position in a ref |
| 05:57 | Chousuke | that's mutable state |
| 05:57 | Chousuke | it's just controlled :) |
| 06:00 | Raynes | It feels possible. :( |
| 06:00 | quizme | whate if the position was a sequence rather than a number |
| 06:01 | quizme | then that sequence could be a series of cheap copies |
| 06:01 | LauJensen | This is a 3 or 4 part series of RETRO games written functionally, can be quite an eye opener in that he reduces much state: http://prog21.dadgum.com/23.html |
| 06:03 | esj | interesting link |
| 06:07 | quizme | great article |
| 06:08 | esj | its nice how Clojure deals with some of the issues with FP he raises. Things like destructuring and persistent types would have been useful to him, I think. |
| 06:12 | hdurer | Sorry, is there anybody here who could help me with leiningen? I have been trying to get at least the sample (from the git repo) working with the stable (or current trunk) leiningen. But the uberjar generated just won't run the app. |
| 06:13 | hdurer | $ java -jar nomnomnom-standalone.jar |
| 06:13 | hdurer | Failed to load Main-Class manifest attribute from |
| 06:13 | hdurer | nomnomnom-standalone.jar |
| 06:13 | crazzyford | have you set main-class in project.clj |
| 06:13 | crazzyford | and called gen-class in that namespace? |
| 06:13 | hdurer | I have done nothing except checkout the git repo and do lein deps; lein compile; lein jar; lein uberjar |
| 06:14 | crazzyford | its not main class, my bad |
| 06:14 | crazzyford | its just :main |
| 06:14 | hdurer | (in the sample/ subdir of the repo) |
| 06:14 | crazzyford | that doesn't have a main |
| 06:14 | hdurer | But sample/src/nom/nom/nom.clj does contain the gen-class as far as I can see |
| 06:14 | crazzyford | look at actual lein for a proper example |
| 06:14 | crazzyford | post us up your project.clj file |
| 06:15 | crazzyford | oh right |
| 06:15 | crazzyford | yeah their sample won't work with uberjar |
| 06:15 | hdurer | Great. |
| 06:15 | crazzyford | in project.clj, you need to set a :main |
| 06:16 | hdurer | I had something that used to work (even the sample used to work with that old version (0.5 something?) |
| 06:16 | crazzyford | so that should be nom.nom.nom or summat like that |
| 06:16 | hdurer | and now everything is broken |
| 06:16 | crazzyford | weird |
| 06:16 | crazzyford | I'ma patch the sample now for ye |
| 06:17 | hdurer | putting a :main nom.nom.nom in the project doesn't fly either |
| 06:18 | hdurer | Oops. Sorry. It does work. |
| 06:18 | crazzyford | I've forked lein, submitting patch as soon as I've tested |
| 06:19 | hdurer | excellent. |
| 06:20 | hdurer | Would you let me know your username on github so I can check now? |
| 06:20 | crazzyford | can you paste your new copy of project.clj |
| 06:20 | crazzyford | just so I'm sure I've set the :main class correctly |
| 06:20 | hdurer | One sec. Let me do a cleanup and try again. On a second machine it just didn't work.... :-( |
| 06:21 | hdurer | Give me sec to see if I can reproducably make it work/fail |
| 06:21 | hdurer | lisppaste8 url? |
| 06:21 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 06:22 | crazzyford | I'm at http://github.com/tcrayford/leiningen |
| 06:22 | crazzyford | check that that project.clj is roughly the same as yours and I'll submit a pull request |
| 06:24 | lisppaste8 | hdurer pasted "New leiningen sample/project.clj" at http://paste.lisp.org/display/93229 |
| 06:24 | crazzyford | exactly the same as mine |
| 06:25 | lisppaste8 | hdurer annotated #93229 "Diff for this file to current master version" at http://paste.lisp.org/display/93229#1 |
| 06:26 | crazzyford | pull request is off |
| 06:26 | crazzyford | cheers |
| 06:27 | hdurer | OK, that does work. I goofed up on the other machine which has "lein" as a symlink to the git repo's version. |
| 06:27 | crazzyford | hah |
| 06:27 | hdurer | Not sure my setup there is broken or if the master branch version doesn't work |
| 06:28 | hdurer | Note that "lein new foo" doesn't include a :main element in foo/project.clj |
| 06:28 | hdurer | So, if that *is* required, the new action should be fixed as well. |
| 06:29 | crazzyford | its only required for uberjars |
| 06:29 | hdurer | I find that the mose useful feature of leiningen |
| 06:29 | hdurer | s/mose/most/ |
| 06:30 | crazzyford | its up to what you're doing with it |
| 06:30 | crazzyford | I never put stuff in jars |
| 06:30 | crazzyford | needs my swank |
| 06:31 | crazzyford | posted that up under lein/issues |
| 06:31 | hdurer | I never got swank working with clojur |
| 06:31 | crazzyford | I can't get it working with lein and it set as a dependancy of my project |
| 06:31 | hdurer | but I am not willing to put much work into it --- swank works fine with my SBCL setup which is more important. |
| 06:32 | crazzyford | so I just compiled an uberjar out of clojure-swank and stuck it in my project under /libs |
| 06:32 | crazzyford | aye |
| 06:32 | crazzyford | I'm kinda new to the whole emacs/slime scene so has been useful |
| 06:42 | neotyk | Hi * |
| 06:43 | rhickey | neotyk: hi |
| 06:43 | neotyk | crazzyford: I use swank-clojure-project |
| 06:43 | quizme | LauJensen: awesome article. I think I understand the functional style of programming much better now. |
| 06:44 | LauJensen | Great |
| 06:44 | neotyk | new post: http://bit.ly/7xi5aK clojure.core/str makes sense now :) |
| 06:45 | LauJensen | Look forward to reading |
| 06:45 | neotyk | I hope I made sense in it |
| 06:45 | neotyk | LauJensen: there should be nothing new for you, this is my learning experience :) |
| 06:45 | neotyk | LauJensen: but I'm looking forward for your comments |
| 06:46 | LauJensen | Ah ok |
| 06:46 | LauJensen | I think I'm dropping a post later today as well so we can exchange blows :) |
| 06:46 | neotyk | great |
| 06:47 | Raynes | I'm going to assume you aren't talking about cocaine. |
| 06:47 | Chousuke | str uses somewhat outdated style :) |
| 06:50 | neotyk | Chousuke: next one is apply |
| 06:50 | neotyk | Chousuke: is apply newer style? |
| 06:52 | Chousuke | ~def apply |
| 06:52 | Chousuke | no :P |
| 06:52 | neotyk | lol |
| 06:52 | neotyk | where do I find new style ? |
| 06:53 | Chousuke | basically, any direct use of . is old-style. Also I think the ((fn ... ) args) thing in str isn't very common anymore. |
| 06:55 | Chousuke | but those are very old functions, anyway :) |
| 06:59 | neotyk | so it would go like .toString and anonymous function defined by #(? |
| 06:59 | Chousuke | or just using let, I guess. |
| 08:02 | defn | loo |
| 08:03 | Raynes | Yay! Leiningen works! |
| 08:05 | Raynes | The uberjar task has got to be the most awesome thing since Clojure itself was first thought up. |
| 08:11 | seths | Raynes: swank-clojure-project is pretty sweet too |
| 08:11 | Raynes | seths: Indeed. |
| 08:42 | Raynes | Leiningen coupled with swank-clojure reduces classpath annoyances exponentially. |
| 08:42 | Raynes | I do believe I'll be prescribing this medication to new patients. |
| 08:46 | seths | Raynes: uberjar will def. be part of my presentation on Leiningen this week to a Clojure meetup |
| 08:46 | Raynes | Good. Because it's awesome. :D |
| 09:12 | chouser | So I implemented the agent error handler proposal yesterday. http://www.assembla.com/spaces/clojure/tickets/30 |
| 09:15 | chouser | I'm least sure about how I moved the error pointer into the same AtomicReference as the action queue, but I think something like that was necessary to manage restart thread-safely. |
| 09:18 | neotyk | ~def for |
| 09:19 | chouser | ah, 'for'. So beautiful in its simplicity. |
| 09:20 | neotyk | LauJensen: thanks for your comment :) you are evil |
| 09:26 | defn | chouser: are there any places in clojure where there is > 3 arity |
| 09:26 | defn | core functions i mean |
| 09:27 | chouser | hm.. there are certainly some that take & rest args of course. |
| 09:27 | defn | nod, is that true n-ary? |
| 09:27 | defn | or is that like unary? |
| 09:28 | defn | like nested unary or soemthing |
| 09:28 | defn | something |
| 09:31 | chouser | I guess I'm not sure what you mean. You can invoke such a function either with specific args to its .invoke method, or with a seq of args to its .applyTo method. |
| 09:35 | defn | chouser: that's what i was looking for, thanks |
| 09:35 | defn | chouser: what news on the book btw? |
| 09:37 | chouser | Well... I think we've got the first draft of chapter 5 complete. But no word on the MEAP of the first 4. Still "any day now" I guess. :-P |
| 09:38 | defn | :) |
| 09:38 | defn | im excited for it |
| 09:39 | chouser | That's encouraging to hear, thanks! |
| 09:41 | rhickey | chouser: looking now - thanks for the patch! |
| 09:42 | defn | are there any clojure libraries to search html documents by xpath and/or css3 selectors? |
| 09:42 | rhickey | typo - "agent-errors ... DEPRECATED: Use 'agent-errors' instead." |
| 09:42 | chouser | heh. |
| 09:42 | chouser | confusing |
| 09:47 | defn | anyone have a parser they recommend for java? |
| 09:47 | rhickey | chouser: at first glance it looks ok (bundling the error so controlled by same CAS) |
| 09:47 | chouser | defn: enlive and c.c.zip-filter both support searching xml and html by vaguely xpath-like expressions. |
| 09:48 | defn | chouser: ah, works for me -- thanks |
| 09:48 | rhickey | chouser: I'll have to spend some more time staring at it |
| 09:48 | chouser | rhickey: ok. you agree something like that was necessary? |
| 09:48 | rhickey | yes, to keep same model |
| 09:48 | rhickey | tricky, right? |
| 09:48 | chouser | yes |
| 09:49 | chouser | that was my second or third attempted solution. |
| 09:49 | rhickey | but much better to keep it than try another |
| 09:50 | Raynes | Wait, chouser is writing a book too? |
| 09:50 | Raynes | :o |
| 09:51 | chouser | so there are some small time-windows that would be tricky (and I think unnecessary) to solve. Like an agent can error out while a 'send' is being set up. In that case, I go ahead and queue it even though the queue is in fail state. |
| 09:52 | chouser | Raynes: Yep, with Fogus. "The Joy of Clojure" ...but we've got nothing to link to or show off yet. |
| 09:52 | Raynes | chouser: Awesome. Hopefully you'll procrastinate until 1.2 comes out, so you can document deftype and reify. :> |
| 09:52 | rhickey | chouser: what happens if someone sends an action in the middle of a restart? |
| 09:54 | chouser | Raynes: I think deftype, reify, and protocols are probably close enough to their final state already -- we plan to cover them regardless of 1.2 timeframe. |
| 09:54 | Raynes | Oh, neat. |
| 09:54 | defn | so im wondering...if i have some foreign jar from some third party, is there a way to know what i need to (use) it as? |
| 09:54 | Raynes | Maybe Practical Clojure will as well. |
| 09:55 | rhickey | chouser: nm, same prior.count logic works across restart and enqueue |
| 09:56 | chouser | right, that was the requirement the drove combining error and the queue |
| 09:56 | rhickey | so should I pull new into master? |
| 09:56 | chouser | so that the execute gets kicked off exactly once |
| 09:56 | chouser | yes! |
| 09:57 | Raynes | Yes! |
| 09:57 | rhickey | chouser: yes, that execute only once logic was the whole trick in the agents |
| 09:58 | defn | i just got enlive from clojars, but can't seem to (use 'enlive), 'enlive.enlive, 'enlive.enlive-html, etc. |
| 09:58 | chouser | and wantinto to do that without locking something on every send drove me to write the ActionQueue class. |
| 09:58 | defn | How do i know what to use it as? |
| 09:59 | Raynes | defn: I'd probably just extract the jar or open the jar in Emacs and see the directory structure. |
| 09:59 | chouser | rhickey: I did feel a little dirty using the ActionQueue concrete class instead of some new interface. Is that okay because it's a private class? |
| 09:59 | rhickey | chouser: yes |
| 09:59 | LauJensen | neotyk: np :) |
| 10:00 | defn | Raynes: thanks |
| 10:00 | rhickey | if you were writing it in Clojure you'd just have had a little map or tuple |
| 10:00 | chouser | rhickey: yep. Instead I got to write 8 yummy word-filled lines. |
| 10:01 | rhickey | go Java! |
| 10:01 | chouser | it's worse because my Java is so lousy. if(error) oops if(error == NULL) gah if(error == null) ... |
| 10:02 | rhickey | ... 23 files changed, 3635 insertions(+), 1011 deletions(-) ... |
| 10:03 | Raynes | Bang. |
| 10:03 | chouser | whee! |
| 10:04 | rhickey | tests pass, contrib tests pass... |
| 10:04 | rhickey | what version of contrib should I be using? |
| 10:05 | rhickey | I had been using master, see all these branches now |
| 10:06 | chouser | contrib 'new' should probably be merged into 'master' as well. |
| 10:06 | ordnungswidrig | hi all |
| 10:06 | rhickey | chouser: I guess after I push this? |
| 10:07 | chouser | yeah, not before. |
| 10:08 | chouser | you could test contrib 'new' too if you want, though I don't think there's much different there |
| 10:10 | rhickey | chouser: that doesn't work at present - contrib/new needs to pull from contrib/master some changes made to deal with release? |
| 10:10 | rhickey | e.g. bytes |
| 10:13 | ordnungswidrig | Is the a quickcheck implementation for clojure? I know clojurecheck is somewhat paused and more about TAP than quickcheck atm |
| 10:15 | chouser | rhickey: ok, I wouldn't bother with it. contrib new has only one commit not in contrib master, and there don't seem to be any tests for it. |
| 10:17 | rhickey | brave new world - http://github.com/richhickey/clojure/commit/e08a7a8add966827179c3431c1e31c56dbd64f40 |
| 10:17 | cemerick | rhickey: oh, very exciting :-) |
| 10:18 | Raynes | ! |
| 10:18 | chouser | brave reify world, you mean. |
| 10:19 | rhickey | I'll take any qualifier other than broken :) |
| 10:22 | rhickey | Raynes: builds with new properties don't clean up old jars |
| 10:22 | rhickey | ant dist will |
| 10:23 | rhickey | Raynes: are you sure? |
| 10:23 | Raynes | Mhm. Just pulled and 'ant'. |
| 10:23 | Raynes | It built 'new' snapshots instead of master snapshots. I assumed you didn't update the 'ant' file before pushing. |
| 10:23 | rhickey | so you'll have both that and clojure-1.2.0-master-SNAPSHOT.jar |
| 10:24 | chouser | looks ok here -- jar filenames and repl startup text both say clojure-1.2.0-master-SNAPSHOT |
| 10:25 | rhickey | chouser: here too |
| 10:25 | Raynes | That's odd. |
| 10:25 | Raynes | Guess I'll re-clone. |
| 10:25 | rhickey | Raynes: do ant dist, then ant |
| 10:25 | rhickey | biab |
| 10:26 | Raynes | Same stuff. |
| 10:28 | spariev | hello, nub question. I've written function to format dates, it works but I wonder could it be made more idiomatic/concise - http://paste.lisp.org/display/93239 |
| 10:31 | esj | spariev - as an aside, if you're going to use dates heavily, take a look at Joda Time. |
| 10:32 | Chousuke | spariev: using rest args seems to be pointless in that case |
| 10:32 | Chousuke | spariev: you should instead make it a function overloaded by arity |
| 10:32 | Raynes | build.clojure.org/snapshots needs new builds. :> |
| 10:33 | Chousuke | spariev: ie. (defn format-date ([date] (format-date date "dd MMM yy")) ([date format] ...)) |
| 10:33 | spariev | esj: thanks, that looks better |
| 10:34 | spariev | Chousuke: ups, I misse, thanks too |
| 10:36 | esbena | how do I join two sequences? (like 'addAll' for java collections) |
| 10:38 | Chousuke | esbena: there's concat |
| 10:38 | esbena | doh |
| 10:38 | Chousuke | esbena: it's lazy, too :) |
| 10:39 | Chousuke | ,(time (first (concat (range 10000000) (range 10000000)))) |
| 10:39 | clojurebot | 0 |
| 10:39 | clojurebot | "Elapsed time: 0.191 msecs" |
| 10:42 | esbena | once again, thx a lot. |
| 10:49 | crazzyford | is there a guide to clojure.stacktrace? |
| 10:50 | crazzyford | I want to see the full cause of an expression, something like (print-stack-trace (/ 1 0)) |
| 10:51 | Chousuke | pst probably takes the exception object |
| 10:51 | Chousuke | which is accessible as *e in the repl |
| 10:52 | crazzyford | perfect |
| 10:52 | crazzyford | chairs |
| 11:08 | Raynes | rhickey: Heh. Just figured out why it was doing that before. I was still on the 'new' branch. :o |
| 11:11 | Raynes | Bleh. swank-clojure still doesn't work, but now I'm actually kind of screwed unless I use 1.1. :\ |
| 11:12 | ordnungswidrig | defprotocol went to master? |
| 11:19 | somnium | Raynes: are you using a slim version of swank? |
| 11:19 | Raynes | somnium: No. |
| 11:20 | Kjellski | Hi there... |
| 11:20 | Raynes | somnium: I think I'm the only one who gets this. Which is great, because then I really am screwed. |
| 11:20 | somnium | Raynes: just put a slim version in lib by hand and it should be all good |
| 11:23 | ordnungswidrig | What's this: "(clojure.core/in-ns 'de.kotka.clojurecheck)" (from http://bitbucket.org/kotarak/clojurecheck/src/tip/src/de/kotka/clojurecheck/combinators.clj) |
| 11:23 | ordnungswidrig | Is this outdated syntax for the ns macro? |
| 11:23 | Raynes | java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V (pprint.clj:1) What the hell does that non-sense mean, anyways? :\ |
| 11:24 | somnium | Raynes: it means contrib needs to be clean and built against the clojure version youre using |
| 11:28 | Raynes | That was it. |
| 11:28 | Raynes | somnium: You sir, are my hero. |
| 11:29 | somnium | =) |
| 11:30 | Raynes | Now, we just need new builds on build.clojure.org/snapshots, and all will be well in the magic kingdom. |
| 11:33 | cemerick | ach, I simply can never remember the signature naming convention for gen-class method impl vars (e.g. -methodName-void-int-int, etc). |
| 11:34 | Raynes | Oh. |
| 11:34 | Raynes | Way ahead of me. |
| 11:34 | Raynes | There /are/ new builds. |
| 11:34 | Raynes | Haha. |
| 11:34 | Raynes | Life is good, man, life is good. |
| 11:36 | Raynes | Aren't any clojure-contrib snapshots yet though. |
| 11:36 | Raynes | Oh, just didn't update the version number. |
| 11:38 | Kjellski | Raynes: Have you tried build.clojure.org? |
| 11:38 | Kjellski | Raynes : for jars it´s fine... |
| 11:55 | crazzzyford | ,(binding [*DB* "foo"] (for [num [1 2 3] (str *DB*))) |
| 11:55 | clojurebot | Unmatched delimiter: ) |
| 11:56 | crazzzyford | ,(binding [*DB* "foo"] (for [num [1 2 3]] (str *DB*))) |
| 11:56 | clojurebot | java.lang.Exception: Unable to resolve var: *DB* in this context |
| 11:56 | crazzzyford | is this meant to happen? |
| 11:56 | Chousuke | yes. |
| 11:56 | crazzzyford | mk |
| 11:56 | crazzzyford | kinda annoying |
| 11:56 | Chousuke | binding is not intended to create new vars |
| 11:57 | crazzzyford | I'm not properly using it like this |
| 11:57 | Chousuke | only to dynamically rebind existing ones, to affect already compiled code that uses the var. |
| 11:58 | crazzzyford | I'm using it for a with-db macro |
| 11:58 | crazzzyford | but I want to look up some more content based on one of the bindings in the for loop |
| 11:58 | Chousuke | eg. (def somevar) (defn foo [] (dostuff-with somevar)) (defn bar [] (binding [somevar 3] (foo))) |
| 11:58 | Chousuke | for is not a loop :) |
| 11:58 | crazzzyford | yeah my syntatic bad |
| 11:58 | hiredman | also, for is lazy |
| 11:59 | crazzzyford | hence I have to do a doall right? |
| 11:59 | crazzzyford | if I'm loading stuff from a db |
| 11:59 | Chousuke | yeah. |
| 11:59 | Raynes | Kjellski: What are you talking about? |
| 12:01 | crazzzyford | heh, the repl's forcing of evaluation was messing me up |
| 12:01 | Kjellski | Raynes: Sorry... read the wrong thing out of your last messages... |
| 12:02 | Raynes | Kjellski: No worries. |
| 12:31 | Raynes | I don't know if they are generated automatically or not, but it needs to be built against master or it isn't going to run with swank-clojure. |
| 13:58 | {newbie} | why? |
| 13:58 | hiredman | that's a first |
| 13:59 | {newbie} | wth |
| 13:59 | {newbie} | was that? |
| 14:03 | mabes | it would appear to be a drive-by stabbing... or something similar |
| 14:03 | fdaoud | FUNCTIONAL HUMOUR? |
| 14:04 | fdaoud | sorry for the caps lock didn't notice |
| 14:11 | defmacro | k |
| 14:28 | technomancy | Raynes: you can use the "new" contrib builds in the mean time |
| 14:36 | LauJensen | I blogged about feeding Reddit to Hadoop: http://www.bestinclass.dk/index.php/2010/01/hadoop-feeding-reddit-to-hadoop/ |
| 14:50 | mebaran151 | hey, Lau, is there anyway to insert-into return the primary key of the record it inserted |
| 14:51 | mebaran151 | the return value of "1" isn't particularly informative, and it would avoid a race condition in trying to get the primary key of a newly inserted row |
| 14:55 | {newbie} | Am I the only one that thinks it wold be nice of letfn worked exactly as let? |
| 14:55 | {newbie} | for example |
| 14:55 | {newbie} | (letfn [zing (fn [x] (println x)] |
| 14:55 | {newbie} | (zing 3)) |
| 14:55 | {newbie} | s/of/if |
| 14:56 | mebaran151 | {newbie}, but then wouldn't it actually be let! |
| 14:56 | {newbie} | dam right! |
| 14:56 | {newbie} | '-.- |
| 14:56 | stuartsierra | mebaran151: Hadoop is not a database. It has no concept of rows or keys. |
| 14:57 | mebaran151 | oh I forgot to mention, I was talking about ClojureQL |
| 14:57 | somnium | you still cant call zing from the body in let, no? |
| 14:57 | mebaran151 | you closed the let there |
| 14:57 | {newbie} | let me test |
| 14:57 | mebaran151 | you need letfn if you want to call the function recursively |
| 14:58 | LauJensen | mebaran151: yes there is |
| 14:58 | {newbie} | mebaran151: The syntax is correct |
| 14:58 | {newbie} | o nvm |
| 14:59 | {newbie} | than was an old example |
| 14:59 | mebaran151 | LauJensen, hmm? |
| 15:00 | LauJensen | ---> priv :P |
| 15:04 | mabes | LauJensen: awesome hadoop post. I've been meaning to look into how to use hadoop w/clojure so this will be perfect learning material. |
| 15:05 | LauJensen | Great - Glad to hear it :) |
| 15:09 | stuartsierra | LauJensen: working on clojure-hadoop 1.1.0 to fix the missing config options |
| 15:09 | LauJensen | stuartsierra: No need :P |
| 15:14 | {newbie} | After I use the seq the results are cached what I don't know is if the access to the cache is random or not |
| 15:15 | {newbie} | s/seq/lazy-seq |
| 15:16 | somnium | {newbie}: seqs are like linked-lists |
| 15:16 | {newbie} | so reusing a seq multiple times is not a very good idea |
| 15:17 | somnium | {newbie}: if you want indexed access bettor off calling vec on it, if thats what you mean |
| 15:19 | {newbie} | yeah, reusing teh seqs is only worthy when doing some king of stream processing |
| 15:37 | stuartsierra | LauJensen: new source on Github, more config options |
| 15:37 | LauJensen | Good work Speedy Gonzales :) |
| 15:37 | stuartsierra | Not tested yet. :) |
| 15:39 | cemerick | would there be interest in << from http://muckandbrass.com/web/x/AgBP being added to contrib? I've found it incredibly useful so far... |
| 15:43 | the-kenny | cemerick: Wow, that looks cool |
| 15:48 | ska2342 | Hi. Is it considered bad style to Thread/sleep in the action of an agent? |
| 15:48 | LauJensen | no |
| 15:48 | cemerick | heh. I'd say so. :-P |
| 15:49 | cemerick | the-kenny: thanks. Not sure if anyone's using it so far, tho. |
| 15:49 | the-kenny | ska2342: No, but I would use send-off to send the agent, or you could block other agents |
| 15:50 | ska2342 | I was thinking about an action which polls some state somewhere (e.g. an URL), saves it and after sleeping sends itself to *agent* again. Yes, send-off would be the way to go. Just to demo the self-calling idiom. |
| 15:50 | LauJensen | cemerick: Looks sweet |
| 16:00 | stuartsierra | ska2342: a Timer may also help |
| 16:00 | hiredman | ScheduledThreadPoolExecutor |
| 16:01 | ska2342 | stuartsierra: Usually I'd use a Timer, but I want to demo the idiom. This is not for a real-life program. |
| 16:02 | stuartsierra | ok |
| 16:02 | hiredman | ScheduledThreadPoolExecutor! |
| 16:05 | ska2342 | hiredman: OK, I've read that it's preferable to Timer. Where do agents come into the game? |
| 16:06 | the-kenny | cemerick: I'll save the snippet here :) |
| 16:06 | hiredman | ska2342: why would they? |
| 16:06 | the-kenny | Btw. any recommendations on a code-snippet-manager? Maybe an emacs plugin? |
| 16:07 | LauJensen | the-kenny: emacs gist integration ? |
| 16:07 | ska2342 | hiredman: because I want to demo them :-) |
| 16:07 | the-kenny | LauJensen: hm.. not really what I'm searching for |
| 16:07 | the-kenny | LauJensen: I want something like a small database for saving snippets in different languages |
| 16:08 | LauJensen | the-kenny: emacs gist integration ? |
| 16:08 | the-kenny | LauJensen: I use gists for showing small snippets of different things for everyone. But there isn't a good search etc. |
| 16:09 | _schulte_ | the-kenny: if you use Emacs you could try an Org-mode file with embedded source-code blocks |
| 16:09 | the-kenny | _schulte_: I like the idea.. is there a way to highlight the blocks in the right language? |
| 16:10 | _schulte_ | the-kenny: org-mode has tags and foldable outline levels which should help for organization, and it has facilities for embedding/exporting/editing the source-code blocks |
| 16:10 | ska2342 | the-kenny: I tried to use the built-in wiki for that ages ago. Didn't work for me, though. Now, what was it's name...? (emacs-wiki-find-file ..something) |
| 16:10 | _schulte_ | the-kenny: yea, hit C-c ' with the point on the code block |
| 16:10 | the-kenny | _schulte_: How do I insert a code-block? (sorry for these annoying questions) |
| 16:11 | crazzzyford | ,(with-meta (ref {}) (:foo {}}) |
| 16:11 | clojurebot | Unmatched delimiter: } |
| 16:12 | crazzzyford | ,(with-meta (ref {}) (:foo {})) |
| 16:12 | clojurebot | java.lang.ClassCastException: clojure.lang.Ref cannot be cast to clojure.lang.IObj |
| 16:12 | _schulte_ | the-kenny: np, I use the following yasnippet http://gist.github.com/274611 |
| 16:12 | crazzzyford | are you not meant to be able to add metadata to refs? |
| 16:12 | _schulte_ | the-kenny: the syntax is described here http://orgmode.org/worg/org-contrib/babel/reference.php#sec-1.1 |
| 16:15 | neotyk | ~def do |
| 16:15 | clojurebot | It's greek to me. |
| 16:15 | neotyk | where does do come from? |
| 16:17 | michaeljaaka | Hi |
| 16:17 | michaeljaaka | I have function http://gist.github.com/274615 |
| 16:18 | michaeljaaka | does it work how it is written in comment? |
| 16:18 | michaeljaaka | it is my fun but I'm not sure if it is eval lazily |
| 16:19 | michaeljaaka | because there is indirect recursion on the same function with overloaded number of arguments |
| 16:19 | michaeljaaka | it simply works like from (concat-seq '(( 1 2 3 4 ) ( 5 6 7 8 ))) |
| 16:19 | michaeljaaka | does ( 1 2 3 4 5 6 7 8 ) |
| 16:20 | Chousuke | (comp apply concat) :P |
| 16:20 | michaeljaaka | hmmm |
| 16:20 | michaeljaaka | the number of sequences it not known |
| 16:20 | michaeljaaka | I mean it is evaluated in lazy way |
| 16:20 | michaeljaaka | and is too big to fit in memory |
| 16:21 | michaeljaaka | does your solution works leazy too? |
| 16:21 | Chousuke | yeah. |
| 16:21 | Chousuke | ,(ffirst (apply concat (repeat (range 1000)))) |
| 16:21 | clojurebot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer |
| 16:22 | Chousuke | hmm. |
| 16:22 | Chousuke | oops |
| 16:22 | Chousuke | ,(first (apply concat (repeat (range 1000)))) |
| 16:22 | michaeljaaka | hmmm apply must know number of sequences |
| 16:22 | clojurebot | 0 |
| 16:22 | michaeljaaka | apply must know number of arguments |
| 16:22 | Chousuke | no it doesn't. that thing there concatenates infinite sequences :) |
| 16:23 | michaeljaaka | and what is comp? |
| 16:23 | Chousuke | actually, not comp |
| 16:23 | Chousuke | partial :P |
| 16:23 | Chousuke | sorry, my mistake |
| 16:24 | michaeljaaka | hmmm, looks like works fine |
| 16:24 | michaeljaaka | I knew that there is already simply way |
| 16:24 | ska2342 | ,(apply concat '((1 2 3) ("a" "b") (6 7))) |
| 16:24 | clojurebot | (1 2 3 "a" "b" 6 7) |
| 16:24 | Chousuke | yeah, it's not always obvious :) |
| 16:26 | michaeljaaka | hmmmm I looks at apply function |
| 16:27 | michaeljaaka | I can see spread is used |
| 16:27 | michaeljaaka | is it because of it apply behaves leazily? |
| 16:29 | stuartsierra | Apply is not lazy. |
| 16:29 | michaeljaaka | so apply concat is not leazy |
| 16:29 | stuartsierra | (apply foo [1 2 3]) ==> (foo 1 2 3) |
| 16:30 | michaeljaaka | because apply must know how many sequences is for concatenation |
| 16:30 | stuartsierra | No |
| 16:30 | stuartsierra | (apply concat (list [1 2] [3 4])) ==> (concat [1 2] [3 4]) |
| 16:30 | stuartsierra | ,(apply concat (list [1 2] [3 4])) |
| 16:30 | clojurebot | (1 2 3 4) |
| 16:32 | hiredman | ,(letfn [(f [& y] (first y))] (apply f (iterate inc 0))) |
| 16:32 | clojurebot | 0 |
| 16:33 | michaeljaaka | hmmmmm, concat has [x y & zs] |
| 16:34 | michaeljaaka | so two first sequences must be known |
| 16:34 | michaeljaaka | and then third and rest is leazily evaluated |
| 16:34 | stuartsierra | no |
| 16:34 | stuartsierra | Concat is always lazy. |
| 16:34 | stuartsierra | ,(take 5 (concat [1 2] (range 10000))) |
| 16:34 | clojurebot | (1 2 0 1 2) |
| 16:35 | ska2342 | ,(apply concat '((1 2 3))) |
| 16:35 | clojurebot | (1 2 3) |
| 16:35 | ska2342 | Or even... |
| 16:35 | ska2342 | ,(concat) |
| 16:35 | clojurebot | () |
| 16:36 | ska2342 | No problems with arity here. |
| 16:36 | stuartsierra | 'concat' attaches lazy sequences together |
| 16:36 | stuartsierra | 'apply' is used when you want to call a function with a bunch of arguments, but you happen to have those arguments in a list |
| 16:37 | michaeljaaka | yes but concat has no declaration like |
| 16:37 | michaeljaaka | (defn concat[ & a ] .. ) |
| 16:37 | stuartsierra | ~def concat |
| 16:38 | stuartsierra | 'concat' is defined for 0, 1, 2, or more arguments |
| 16:38 | hiredman | ,(letfn [(f [& y] (first y)) (N [] (iterate inc 0)) (N′ [] (repeatedly N))] (apply f (N′))) |
| 16:38 | clojurebot | Eval-in-box threw an exception:java.lang.OutOfMemoryError: Java heap space |
| 16:38 | michaeljaaka | and 1 2 is too much |
| 16:38 | michaeljaaka | need to have more without 0, 1 and 2 |
| 16:38 | Chousuke | hm? |
| 16:39 | Chousuke | concat works the same for any arity. is there a problem? |
| 16:41 | hiredman | michaeljaaka maybe suffering under the illusions of a. that clojure has lazy evaluation, and b. some imagined mechanisms for the working of this lazy evaluation |
| 16:50 | LongInt | Where can one get Clojure STM case-studies/testimonials? |
| 16:50 | hiredman | clojurebot: Nakatomi space is http://bldgblog.blogspot.com/2010/01/nakatomi-space.html |
| 16:50 | clojurebot | 'Sea, mhuise. |
| 16:52 | rhickey | ,(apply (fn [x & ys] x) (iterate inc 0)) |
| 16:52 | clojurebot | 0 |
| 17:18 | DapperDan | which compojure on clojars works? ato's tries to download clojure 1.1 alpha, hiredman's doesn't have jetty etc. |
| 17:18 | DapperDan | http://clojars.org/search?q=compojure |
| 17:18 | hiredman | the germans |
| 17:18 | hiredman | whose jar doesn't show up in the search |
| 17:20 | hiredman | liebke |
| 17:20 | the-kenny | Germans? |
| 17:20 | hiredman | german's |
| 17:22 | hiredman | I don't know, but for some reason I assume he is german |
| 17:23 | hiredman | http://incanter-blog.org/2009/11/29/incanter-webapp/ <-- one here |
| 17:23 | chouser | does anybody have a clojure collection 'diff' fn? |
| 17:24 | danlarkin | clojure.set/difference |
| 17:24 | DapperDan | hiredman: when i try to run compojure run-server using your jar, i get javax/servlet/ServletOutputStream |
| 17:24 | DapperDan | [Thrown class java.lang.NoClassDefFoundError] |
| 17:25 | DapperDan | chouser: no but i have wanted one. |
| 17:25 | chouser | danlarkin: thanks, I wasn't clear. I've got deeply nested maps and vectors that are unequal, and I want to know why |
| 17:25 | hiredman | DapperDan: *shrug* I just stole a pom from some other compojure |
| 17:26 | DapperDan | hiredman: but how is it 'BETTER'? |
| 17:27 | hiredman | DapperDan: it removes the bits that stop compojure from working on appengine |
| 17:27 | danlarkin | chouser: for that I have no remedy :) |
| 17:27 | chouser | ok |
| 17:41 | mebaran151 | liebke is the best one |
| 17:42 | mebaran151 | I sometimes just browse the clojars maven repo directory listing directly |
| 17:45 | danlarkin | chouser: fess up, is it you or fogus on the cover? http://joyofclojure.com/ |
| 17:46 | chouser | Well, I haven't actually met _fogus_, so I can only assume... |
| 17:46 | `Nate | I'm having trouble installing clojure-contrib |
| 17:46 | `Nate | I installed clojure as per this url: http://riddell.us/tutorial/clojure/clojure.html |
| 17:46 | `Nate | and the repl works |
| 17:46 | `Nate | but the line (:use clojure.contrib.str-utils) yields java.lang.ClassNotFoundException: clojure.contrib.str-utils (NO_SOURCE_FILE:1) |
| 17:46 | `Nate | Can anybody help me out? |
| 17:48 | hiredman | gar |
| 17:48 | hiredman | yet another tutorial referencing the deprecated clojure.lang.Repl |
| 17:48 | hiredman | come on! |
| 17:48 | hiredman | (but I doubt that has anything to do with your problem) |
| 17:48 | hiredman | `Nate: you don't have contrib on your classpath |
| 17:49 | ghotli | `Nate: This is how i got set up with clojure recently. That tutorial is a bit outdated. http://thoughtadventures.blogspot.com/2010/01/setting-up-clojure-repl-with-emacs-and.html |
| 17:49 | hiredman | ~dirt simple |
| 17:49 | clojurebot | simple setup is http://www.thelastcitadel.com/dirt-simple-clojure |
| 17:49 | `Nate | Thanks |
| 17:50 | hiredman | doesn't tell you how to get clojure.jar or clojure-contrib.jar |
| 17:58 | `Nate | I don't think it's the classpath, the command (System/getProperty "java.class.path") shows both the clojure.jar and the clojure-contrib.jar to be on the classpath |
| 17:58 | `Nate | yet (:use clojure.contrib.str-utils) still doesn't work |
| 18:00 | `Nate | hiredman: I have the right jars on the classpath, is there any way that I could have messed up the creation of the contrib jar? |
| 18:01 | esbena | do I need to do something special to get clojure to use both of my cpu-cores? (I have a pure breadth first algorithm - which only use one core :( ) |
| 18:01 | `Nate | I built it with "ant -Dclojure.jar=/path/to/clojure.jar" |
| 18:01 | hiredman | `Nate: how do you know you have the right jars on the classpath? |
| 18:02 | `Nate | (System/getProperty "java.class.path") in the repl |
| 18:02 | hiredman | ah |
| 18:02 | hiredman | where did you get contrib? |
| 18:02 | `Nate | the git repo |
| 18:02 | hiredman | specifically? |
| 18:03 | `Nate | git://github.com/richhickey/clojure-contrib.git |
| 18:04 | {newbie} | does anyone here use a free java profiler with clojure? |
| 18:04 | Chousuke | esbena: there's no automatic parallelisation. |
| 18:04 | Chousuke | esbena: but you can use futures or agents or whatnot |
| 18:05 | hiredman | `Nate: what about (:use clojure.contrib.base64) |
| 18:05 | `Nate | no dice |
| 18:06 | hiredman | so your jar is busted |
| 18:06 | `Nate | I also tried putting the src/ directory of clojure-contrib on the path |
| 18:06 | `Nate | not sure if that should have worked |
| 18:06 | `Nate | but it didn't |
| 18:06 | hiredman | what is the output of the ant run? |
| 18:06 | `Nate | thanks for all of the help, by the way |
| 18:06 | `Nate | one sec |
| 18:06 | hiredman | pastebin please |
| 18:07 | esbena | Chousuke: I use pmap on the top level - shouldn't that spawn more threads? |
| 18:07 | hiredman | (doc pmap) |
| 18:07 | clojurebot | "([f coll] [f coll & colls]); Like map, except f is applied in parallel. Semi-lazy in that the parallel computation stays ahead of the consumption, but doesn't realize the entire result unless required. Only useful for computationally intensive functions where the time of f dominates the coordination overhead." |
| 18:07 | Chousuke | esbena: yes |
| 18:07 | Chousuke | esbena: however, make sure you're not spawning too many threads. |
| 18:08 | `Nate | hiredman: http://pastebin.com/meae327d |
| 18:08 | esbena | Chousuke: I know .. but it bugs me greatly that the threads doesn't run on the second core.. |
| 18:08 | Chousuke | esbena: maybe the work is too lightweight |
| 18:09 | Chousuke | esbena: ie. you don't get enough work to distribute beneficially across multiple cores. |
| 18:09 | hiredman | and without changing directories, staying right where you are, what does java -cp ../clojure/clojure.jar:clojure-contrib.jar clojure.main -e "(use 'clojure.contrib.base64)" output? |
| 18:10 | Chousuke | esbena: pmap is also semi-lazy |
| 18:10 | `Nate | nothing: looks like it worked |
| 18:10 | `Nate | looks like I may have a problem with my clj script |
| 18:10 | hiredman | `Nate: possibly |
| 18:11 | `Nate | I can probably take it from here, thanks |
| 18:11 | hiredman | people tend to turn out pretty horrible scripts |
| 18:11 | hiredman | I recommend against using them |
| 18:12 | `Nate | heh, thanks |
| 18:13 | `Nate | ok, I got it working |
| 18:13 | `Nate | much appreciated |
| 18:25 | scode | Hmm, is there an idiomatic way to do a get whereby you can distinguish between nil-the-value and nil-it-didn't-exist? |
| 18:25 | scode | Supposing I want to implement an associative structure (lru cache) where I would like to avoid a two-way test-and-get. |
| 18:25 | the-kenny | scode: You can supply an "nil" parameter |
| 18:26 | the-kenny | ,(doc get) |
| 18:26 | clojurebot | "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present." |
| 18:26 | the-kenny | (get {:foo nil} :bar false) |
| 18:26 | the-kenny | ,(get {:foo nil} :bar false) |
| 18:26 | clojurebot | false |
| 18:26 | the-kenny | ,(get {:foo nil} :foo false) |
| 18:26 | clojurebot | nil |
| 18:26 | scode | the-kenny: Ah! Great. Thanks! |
| 18:26 | the-kenny | You're welcome |
| 18:26 | scode | (This is a case where I like multiple return values like in CL :)) |
| 18:26 | the-kenny | scode: Yeah, I like them too |
| 18:27 | mebaran151 | hiredman, did you ever get the app-engine sdk into maven? |
| 19:06 | the-kenny | _schulte_: org-babel looks really awesome, thank you! |
| 19:15 | jolby | the-kenny: If you are using org-babel and Clojure together, there is a little documentation covering setup/basic usage now: http://orgmode.org/worg/org-contrib/babel/languages/org-babel-doc-clojure.php |
| 19:19 | the-kenny | jolby: Thanks! |
| 19:30 | tolstoy | I notice on the mailing list there's an RC2 for clojure.contrib 1.1. Alas, no mention of actually where to download it. |
| 19:30 | tolstoy | Is there a place to download clojure-contribs? |
| 19:31 | tolstoy | Ah: http://code.google.com/p/clojure-contrib/ |
| 19:42 | I314159 | Hi |
| 19:42 | I314159 | Does anyone know if there's an example of using the trace library online? |
| 19:49 | scottj | Any existing code for getting a seq of all the connections between a node and all other nodes of a graph? I know c.contrib has a graph library but given {:a [:b] :b [:a :d] :d [:b :e] :e [:d]} if I pass :b I want to get ((:b :a) (:b :d) (:b :d :e)) |
| 19:51 | scottj | and I don't think the contrib graph.clj has that functionality |
| 19:55 | scottj | I314159: http://wave.thewe.net/2009/12/17/logging-and-debugging-in-clojure-followup-complete-tracing/ |
| 19:56 | I314159 | thx! |
| 20:53 | technomancy | did anything change in clojure.test in the past month that would cause rebinding clojure.test/test-var to quit working? |
| 20:53 | technomancy | hrm; no changes to clojure.test since the first of december |
| 20:59 | seths | techonmancy: w/r/t leiningen, is the logo the mustachioed gentleman at http://technomancy.us/131? |
| 21:00 | seths | opps, that should have said technomancy: |
| 21:00 | technomancy | seths: yep |
| 21:00 | technomancy | I need to integrate it into the readme so it shows on github. |
| 21:01 | seths | great! Unless you prefer otherwise I'll use it in a presentation? |
| 21:02 | seths | probably the small version on Flickr |
| 21:02 | technomancy | the best version I have is http://p.hagelb.org/leiningen.png |
| 21:02 | technomancy | complete with background transparency |
| 21:03 | seths | running into a 403 on that |
| 21:04 | technomancy | my bad; try again |
| 21:05 | seths | same thing, might be some caching somewhere |
| 21:05 | seths | the image on technomancy.us has transparency, size works for me |
| 21:05 | technomancy | ok |
| 21:05 | seths | thx! |
| 22:09 | Drakeson | using clojars.org, how can I download a jar file directly? |
| 22:10 | Drakeson | is there a "lein download foo/bar version" ? |
| 22:19 | liebke | Drakeson: you can browse the repository directly: http://clojars.org/repo/ |
| 22:22 | Drakeson | liebke: cool. thanks :) |
| 22:22 | liebke | np |
| 22:27 | Drakeson | how does one hunt for libraries? is there a way to obtain a local cache of some meta-data about libraries in clojars and maven repositories? |
| 22:35 | mebaran151 | heh, I just accidentally deleted my homedir |
| 22:35 | mebaran151 | I'm debating whether now should be the time I become a unix hacker |
| 22:39 | mebaran151 | *emacs hacker |
| 22:40 | Drakeson | go for it |
| 22:41 | arohner | if you become an emacs hacker, your entire home dir will be open in emacs |
| 22:41 | arohner | and then you can just C-x s |
| 22:41 | mebaran151 | unix has taught me how not to value my data |
| 22:41 | mebaran151 | the data is ephemeral |
| 22:41 | mebaran151 | anything I care about I put up on bitbucket |
| 22:42 | mebaran151 | because it is simply inevitable that I will destroy my homedir |
| 22:42 | mebaran151 | that's what I learned as a sysadmin :) |
| 22:43 | mebaran151 | that's why it is absolutely necessary to send snapshots to s3 (whch I did for all my customers) |
| 22:44 | mebaran151 | alright, where should I start as a lisp hacker |
| 22:44 | mebaran151 | *emacs hacker |
| 22:50 | mebaran151 | I'm on Ubuntu 9.10 |
| 22:51 | hiredman | eh? |
| 22:52 | mebaran151 | having destroyed my homedir, I think it's a sign I should be using emacs for clojure dev |
| 23:02 | mebaran151 | how do I get the classpath slime is using? |
| 23:11 | defn | mebaran151: first step, get emacs23 and compile from source |
| 23:12 | defn | mebaran151: step two, start reading other people's configs and build a small config of your own. only edit your config with emacs |
| 23:13 | defn | mabes: step three, become frustrated and consider giving up |
| 23:13 | defn | mebaran151: step four, resist this urge and alias vim to emacs -nw |
| 23:15 | blbrown_win | ~ |
| 23:15 | clojurebot | No entiendo |
| 23:15 | blbrown_win | ~(+ 1 1) |
| 23:15 | clojurebot | :negative/num-1 + :positive/num-1 = :zero/zero |
| 23:15 | blbrown_win | ~(+ 1.0 1.0) |
| 23:15 | clojurebot | FAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b |
| 23:15 | blbrown_win | ~help |
| 23:15 | clojurebot | http://www.khanacademy.org/ |
| 23:16 | blbrown_win | `(+1 1) |
| 23:16 | blbrown_win | what is the syntax to invoke a command |
| 23:16 | chouser | , |
| 23:16 | clojurebot | EOF while reading |
| 23:16 | blbrown_win | ,(+ 1 1) |
| 23:16 | clojurebot | 2 |
| 23:17 | blbrown_win | ,(new java.util.Date) |
| 23:17 | clojurebot | #<Date Mon Jan 11 20:23:17 PST 2010> |
| 23:18 | blbrown_win | hmm, clojurebot must be in... Texas! |
| 23:19 | hiredman | nope |
| 23:22 | Raynes | I would probably use Vim, but then I installed M-x nterm, M-x paredit, and actually tried VimClojure. :D |
| 23:22 | Raynes | nterm > eshell |
| 23:24 | Raynes | I don't believe there is a way to run a shell inside of Vim like you can in Emacs. Dreamkiller. |
| 23:25 | defn | Do people use emacs as a java ide? |
| 23:25 | defn | Is it better to learn eclipse or netbeans? |
| 23:25 | defn | (as opposed to emacs) |
| 23:25 | Raynes | It could be a Java IDE.' |
| 23:26 | defn | sure it 'could', but do people do it, and are those people effective? |
| 23:26 | somnium | defn: if youre in emacs already try out cedet first |
| 23:26 | defn | i have cedet |
| 23:26 | somnium | then Im not sure what youre looking for in the ides |
| 23:27 | defn | oh, i didnt mean to suggest ive used cedet |
| 23:27 | defn | only that i have it |
| 23:29 | Raynes | Emacs is an effective IDE for pretty much anything, if you know what you're doing it. |
| 23:36 | G0SUB | I need some tips about configuring the logging system when using c.c.logging. can anyone help? |
| 23:36 | ctdean | Maybe, go ahead |
| 23:37 | G0SUB | ctdean: well, I want all my logs to go to a file, which is rotated, etc. |
| 23:37 | defn | Raynes: yeah I mean, i figured as much, but that doesn't mean it's always the *best* IDE |
| 23:37 | G0SUB | ctdean: I would also like to change the log format |
| 23:38 | Raynes | defn: Well, there really /isn't/ a best IDE for anything. It's really what works best for you. |
| 23:38 | Raynes | If that is Netbeans or Emacs, so be it. |
| 23:38 | ctdean | G0SUB: So what you need to do is create a .properties file (or files) and put them in your classpath. Since the logging system uses existing java libararies you need to configure those libs |
| 23:38 | arohner | defn: emacs is the best thing on the planet for editing text, period. Personally, I expect my editor to be just that, an editor |
| 23:39 | ctdean | I use log4j and I can post my .properties files if you'de like |
| 23:39 | arohner | I use other tools when I want to debug or profile |
| 23:39 | G0SUB | ctdean: please do. thanks in advance. |
| 23:40 | arohner | defn: I don't expect my editor to refactor my code. I claim I'm productive, but I'm used to what some people would call primitive development environments. it works for me. YMMV |
| 23:41 | ctdean | log4j .properties files http://gist.github.com/274916 http://gist.github.com/274915 |
| 23:42 | blbrown_win | hiredman what is wrong with the #java administrators never understood that community |
| 23:42 | Raynes | All hail the gist. |
| 23:42 | somnium | and at a glance, things like Xrefactory exist |
| 23:42 | somnium | ^^ wrt emacs capabilities vs. ides |
| 23:42 | hiredman | blbrown_win: huh? |
| 23:42 | G0SUB | ctdean: so I put it somewhere in the classpath. do I have to load the file explicitly? |
| 23:43 | ctdean | G0SUB: Yes, put it in the root of your classpath with those filenames. No need to load them yourself, the lib will do it |
| 23:43 | hiredman | there was a #jvm for a few days once |
| 23:43 | hiredman | it had three people in it |
| 23:44 | G0SUB | ctdean: cool. any other config needed? or can I just use (logging/debug) etc. straightaway? |
| 23:45 | ctdean | G0SUB: I think that's it. make sure the directory exists for the file, load c.c.logging, and go nuts |
| 23:45 | G0SUB | ctdean: hehe, yahoo! Any refs for what else I can put in those properties files? |
| 23:46 | ctdean | G0SUB: btw, I didn't know much about this before I created those two files. SO I just read the docs log4j, etc |
| 23:49 | mebaran151 | defn, do I really need emacs23, 22 isn't good enough? |
| 23:49 | Raynes | mebaran151: emacs 23, it's whats for dinner, tonight. |
| 23:50 | G0SUB | ctdean: "Note: your log configuration should display the name that was passed to the logging implementation, and not perform stack-inspection, otherwise you'll see something like "fn__72$impl_write_BANG__39__auto____81" in your logs." |
| 23:50 | G0SUB | ctdean: does the current config address that? |
| 23:50 | defn | mebaran151: it makes a huge difference in comfort |
| 23:51 | defn | tft ftw |
| 23:51 | ctdean | G0SUB: you're testing the limits of my knowledge here :), I think that is the %c in conversionPattern property. |
| 23:51 | ctdean | Try it and see! |
| 23:52 | G0SUB | ctdean: ah, no problem. I am a complete Java n00b. that's why I was asking. Thanks a lot :) |
| 23:52 | mebaran151 | defn |
| 23:52 | mebaran151 | okay |
| 23:52 | mebaran151 | apt-getting |
| 23:53 | defn | no, dont get the package |
| 23:53 | defn | compile from source |
| 23:53 | mebaran151 | I gotta compile it? why's |
| 23:53 | defn | what distro are you on? |
| 23:53 | defn | ubuntu 9.10? |
| 23:53 | ctdean | G0SUB: it's all good, I know a lot about Java, but very little about the libs, go figure, lol. sort of an oxymoron |
| 23:53 | mebaran151 | Ubuntu 9.10 |
| 23:53 | G0SUB | ctdean: hehe |
| 23:53 | mebaran151 | it seems pretty recent |
| 23:53 | defn | the package doesnt have cedet setup right which became annoying |
| 23:53 | mebaran151 | okay |
| 23:53 | mebaran151 | sigh |
| 23:53 | defn | itll probably work for your fine though |
| 23:54 | defn | just get the package since compiling cramps your style |
| 23:54 | defn | ;) |
| 23:54 | G0SUB | ctdean: java is more about the huge number of libs than the language I presume. |
| 23:55 | mebaran151 | defn, nah, I'll compile from the source |
| 23:55 | mebaran151 | what dev packages do I need? |
| 23:56 | mebaran151 | ls |
| 23:58 | qbg | Is anyone else unable to build clojure-contrib using the latest master snapshot? |