2010-01-03
| 00:22 | quizme | Did Rick Hickey use Clojure for the exit polling app? What did he use for persistence? |
| 03:14 | LauJensen | Morning team |
| 03:18 | polypus | hello |
| 03:18 | polypus | 20 past midnight here |
| 03:20 | quizme | hi |
| 03:21 | replaca | hey Lau |
| 03:21 | quizme | how about we make a new company consisting of everybody on this channel |
| 03:21 | replaca | I thought that's what Dysinger was up to :-) |
| 04:10 | noidi | I see that optimizer had problems with xmonad... in case anyone else is getting grey screens with Java apps, this might help http://awesome.naquadah.org/wiki/Problems_with_Java |
| 05:33 | LauJensen | Anyone in here with some flair for design, who can help me out 2 minz? |
| 05:38 | LauJensen | Ok I guess that was a long shot in the forum for Lispniks :) |
| 05:39 | timothypratley | *chuckle* maybe if you were after macro design someone would chime up :P |
| 05:39 | timothypratley | but I'm guessing something more visual? |
| 05:41 | LauJensen | You guessed right |
| 05:42 | _alex | I do design |
| 05:43 | LauJensen | Great ---> Priv :) |
| 07:16 | zakwilson | While trying to build the neman libs with Clojure 1.1, it complains "clojure#clojure;svn1322: not found". I've never built these before so I don't know if this is a version conflict or something else. I also don't really know my way around ant, ivy or other Java-universe tools that well, so a pointer in the right direction would be appreciated. |
| 07:47 | Chousuke | zakwilson: my first guess would be that the build script is horribly outdated. |
| 07:49 | zakwilson | Chousuke: I'm sure it is. I just don't know what to do about it. |
| 08:01 | hoeck | zakwilson: you could simply set your classpath to contain all those clj files, and then search for gen-class to figure those out who need AOT compilation and do it by hand |
| 10:05 | noidi | how might I go about using penumbra in a leiningen project? |
| 10:20 | jamescarr | hi |
| 10:20 | jamescarr | is there a mavenized jar for the clojure jsr-223 implementation? |
| 10:39 | Licenser | mavenized sounds fun .P |
| 10:52 | somnium | urk, what do you do if someones squatting on your group at clojars (with a fork of your project)? |
| 11:20 | mebaran151 | how do I run a zipper on a nested map |
| 11:49 | edbond | how to fix 'java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn'? |
| 11:51 | guru | typically you program contains an error like this |
| 11:51 | guru | ,((lazy-seq '())) |
| 11:51 | clojurebot | java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn |
| 11:51 | edbond | guru: I suppose this is because of map |
| 11:52 | guru | post code snippet |
| 11:52 | guru | plz |
| 11:52 | lisppaste8 | edbond pasted "java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn" at http://paste.lisp.org/display/92961 |
| 11:53 | guru | could you already isolate the error? |
| 11:53 | edbond | its somewhere in row-vals |
| 11:53 | guru | do you know the function it occurs in? |
| 11:53 | edbond | function max-in-row |
| 11:54 | edbond | get-all-variants works |
| 11:54 | edbond | (get-all-variants int-grid 4 4) => ((51 99 64 2) (51 3 67 20) (51 67 63 89) (51 60 14 57)) |
| 11:54 | guru | (get (grid) y0) |
| 11:55 | guru | should be (get grid y0) i guess |
| 11:55 | guru | or just (grid y0) |
| 11:55 | guru | (vectors are functions with the index as their parameter) |
| 11:56 | guru | vectors are functions is a bit misleading |
| 11:56 | edbond | (int-grid 4) doesnt works |
| 11:57 | edbond | but ((int-grid) 4) works |
| 11:57 | guru | if you define a vector, there is a function with the same name |
| 11:57 | guru | yep |
| 11:58 | guru | (get grid y0) should work |
| 11:58 | edbond | thats why I used (get (grid) y0) |
| 11:58 | guru | yeah, just get rid of the get |
| 11:58 | edbond | anyway I still have the same exception |
| 11:58 | guru | ah uh |
| 11:58 | edbond | lazyseq -> ifn |
| 12:01 | edbond | btw (map #(%) (range(4))) throw similar error |
| 12:02 | guru | ,(map (fn [x] x) (range 4)) |
| 12:02 | clojurebot | (0 1 2 3) |
| 12:02 | guru | (map #(%) (range 4)) |
| 12:03 | guru | a #(...) style function must start with an IFn |
| 12:03 | guru | so it tries to execute the %, which is intended as return value |
| 12:03 | edbond | I got it, thanks |
| 12:04 | edbond | ,(map (fn [x] x) (range 4)) |
| 12:04 | clojurebot | (0 1 2 3) |
| 12:04 | guru | and by (range(4)) you say give me the range starting from 0 up to the value that the 'function' 4 returns |
| 12:04 | guru | oh, but i was wrong on that (get (grid) y0) line |
| 12:05 | guru | your version is right |
| 12:05 | guru | since grid is a function, which returns a lazy seq |
| 12:09 | guru | the problem still remains, i guess? |
| 12:09 | edbond | yep |
| 12:11 | guru | did you replace that line |
| 12:11 | guru | row-vals (map #(get-all-variants grid % y0) (range (count row)))] |
| 12:11 | guru | with the (fn [x] ... version? |
| 12:14 | edbond | no |
| 12:14 | guru | well |
| 12:14 | guru | there is no reason too ;-) |
| 12:14 | guru | sry |
| 12:18 | guru | take a look at the last line of max-in-row |
| 12:20 | guru | r u still with me? |
| 12:37 | mebaran151 | do zippers work with nested maps? |
| 12:40 | guru | mebaran: http://clojure.org/other_libraries |
| 12:40 | guru | and there the bottom of the page |
| 12:44 | edbond | guru: sorry, had to leave. |
| 12:44 | guru | wb ;-) |
| 12:45 | guru | so, have a look at the last line of max-in-row |
| 12:45 | edbond | I have fixed the function |
| 12:46 | edbond | did, row-vals (mapcat (fn [x] (get-all-variants grid x y0)) (range (count row)))] |
| 12:46 | guru | nice |
| 12:46 | edbond | and removed () from row-vals at the end |
| 12:47 | guru | that mapping from the re-seq results to bigint might be unneccessary |
| 12:47 | guru | for that (fn [x] (get-all-variants grid x y0)) part, you might as well write #(get-all-va...) |
| 12:47 | guru | i was wrong on this one |
| 12:48 | guru | you are doing a conversion from int to bigint right? |
| 12:50 | edbond | no, from string to bigint, I had problems with this |
| 12:52 | guru | ok, i use sth like (map read-string (re-seq #"\d+" %)) for these things |
| 12:52 | guru | u should know that u donÄt have to worry about overflows |
| 12:53 | guru | if an overflow would occur, clojure converts you number type into one which can hold bigger numbers |
| 12:54 | guru | ,(type ( + 1 1)) |
| 12:54 | clojurebot | java.lang.Integer |
| 12:55 | guru | ,(type 1000000000) |
| 12:55 | clojurebot | java.lang.Integer |
| 12:56 | guru | (type (* 1000000000 1000000000)) |
| 12:56 | guru | ,(type (* 1000000000 1000000000)) |
| 12:56 | clojurebot | java.lang.Long |
| 12:56 | guru | ,(type (* 1000000000 1000000000 1000000000)) |
| 12:56 | clojurebot | java.math.BigInteger |
| 12:57 | edbond | I had to convert string to integer, don't know about read-string |
| 12:57 | guru | yep |
| 12:57 | guru | and bigint isnt that bad here |
| 12:57 | guru | since it "naturally" takes a string |
| 12:57 | guru | but if you dont need big numbers |
| 12:57 | guru | just use read-string |
| 12:57 | guru | which converts about any number |
| 12:58 | guru | i was glad too, that i found that function |
| 12:58 | edbond | ,(max [1 2 4]) |
| 12:58 | clojurebot | [1 2 4] |
| 12:58 | edbond | how to use max function? |
| 12:58 | guru | ,(max 1 2 4) |
| 12:58 | clojurebot | 4 |
| 12:59 | guru | ,(apply max [1 2 4]) |
| 12:59 | clojurebot | 4 |
| 12:59 | edbond | thanks |
| 12:59 | guru | np |
| 13:00 | MenTaLguY | hello |
| 13:01 | MenTaLguY | what's the best option for a persistent queue data structure in Clojure? |
| 13:02 | polypus | do you mean persistent in the clojure sense? |
| 13:03 | edbond | heh, solved :) |
| 13:03 | edbond | (time (solve int-grid)) |
| 13:03 | edbond | "Elapsed time: 8554.364876 msecs" |
| 13:03 | edbond | guru: thanks |
| 13:03 | guru | you're welcome |
| 13:06 | MenTaLguY | polypus: yes. |
| 13:19 | guru | mentalguy: http://markmail.org/message/brvozelsgmr5a3ba |
| 13:19 | MenTaLguY | oh, that's interesting |
| 13:20 | MenTaLguY | Why it isn't exposed as part of the API? |
| 13:20 | lopex | MenTaLguY: it's also use here http://www.bestinclass.dk/index.php/2009/09/scala-vs-clojure-round-2-concurrency/ |
| 13:20 | guru | i dunno, looks pretty useful |
| 13:20 | mebaran151 | how do try and finally interact with lazy-seq? |
| 13:21 | mebaran151 | is finally immediately called or is does it wait until the seq is entire consumed? |
| 13:21 | replaca | MenTaLguY: good question. If you want blocking behavior, also look at clojure.contrib.seq-utils/fill-queue |
| 13:21 | MenTaLguY | don't need blocking, just a simple queue |
| 13:22 | replaca | cool |
| 13:22 | MenTaLguY | thanks |
| 13:31 | Licenser | hmm I've some problems using lein and swank :/ they refuse to see eachother :( |
| 13:31 | the-kenny | PersistentQueue isn't mutable, right? |
| 13:33 | MenTaLguY | correct |
| 13:35 | Licenser | okay I was just stupid :) |
| 13:39 | chouser | mebaran151: if something producing a step of a lazy seq throws an exception, it happens right then when that step is realized. |
| 13:40 | chouser | I'm not sure if that answers your question. |
| 13:40 | MenTaLguY | what happens if that step is subsequently re-requested? |
| 13:41 | mebaran151 | chouser, I was thinking of ensuring that I closed certain iterators |
| 13:42 | mebaran151 | basically I'd like to be able to make a seq, that when it goes to garbage collection, will be closed |
| 13:42 | mebaran151 | how does the usual java idiom of finally work with this |
| 13:44 | Chousuke | hm... it doesn't? |
| 13:44 | Chousuke | finally is for doing cleanup when you get an exception, not when some object is garbage-collected :/ |
| 13:44 | mebaran151 | finally is for making sure something is called no matter what |
| 13:44 | mebaran151 | exception or not |
| 13:45 | Chousuke | well, yeah |
| 13:45 | Chousuke | but it's got nothing to do with GC :) |
| 13:45 | mebaran151 | but if I call seq on the iterator (which could be a pretty big iterator), I might not use all of it |
| 13:45 | mebaran151 | however if it prematurely calls finally, I won't be able to get the next item |
| 13:45 | Chousuke | in that case, you just need to take care of closing the iterator manually somehow. |
| 13:45 | mebaran151 | right now, I'm getting basically first item, then an exception that states everything was closed to early |
| 13:46 | mebaran151 | exactly! |
| 13:46 | mebaran151 | I want to preserve laziness and make sure when I'm done with the lazy thing, it cleans itself up, without my library user having to know anything about transactions or iterators or nothin' |
| 13:47 | Chousuke | I wonder if that's even possible. |
| 13:47 | Chousuke | the seq could keep the iterator open somehow perhaps, but then the problem would be how to ensure it's cleaned up :/ |
| 13:54 | chouser | you can try to use weak references to do some clean-up action when a thing get GC |
| 13:55 | chouser | but this is generally not recommended |
| 13:59 | mebaran151 | so essentially I can't hide the evils of db iteration |
| 13:59 | mebaran151 | is there anyway to be informed when a seq goes out of scope? |
| 14:15 | quizme | does the enclojure plugin work for netbeans 6.8? |
| 14:15 | quizme | i'm on linux ubuntu 9.10. anybody know of a good clojure editor ? |
| 14:16 | guru | enclojure works for 6.8 |
| 14:16 | the-kenny | quizme: Emacs + Slime |
| 14:17 | quizme | ok |
| 15:17 | danlei | I'm looking for a video where rich talked at some kind of lispers metting, where he demonstrated ants (not clojure fore java/lisp programmers) any ideas what that was? |
| 15:17 | danlei | *meeting |
| 15:17 | hiredman | ~blip.tv |
| 15:17 | clojurebot | blip.tv is http://clojure.blip.tv/ |
| 15:17 | danlei | hm |
| 15:18 | danlei | aaah |
| 15:18 | danlei | clojure concurrency ... |
| 15:18 | danlei | thanks hiredman |
| 15:19 | danlei | in a hurry ... see you guys |
| 15:32 | edbond | how to profile clojure programs? |
| 15:36 | pdk | you should be able to profile them with regular java profiling tools |
| 15:36 | pdk | recent jdk versions come with a profiler, let's see if i recall the name |
| 15:37 | pdk | jvisualvm |
| 15:37 | pdk | i think you can run it from the command line if javac is in your path |
| 16:11 | djork | What's the state of Clojure jobs? |
| 16:11 | djork | Is there such a thing yet? :P |
| 16:18 | ohpauleez | djork: There are two companies that use clojure just in the Philadelphia region |
| 16:18 | ohpauleez | one of them is Comcast |
| 16:18 | ska2342 | djork: it probably depends on where you live. Many recruiters will probably honor if you got it under your sleeve, even though the companies dont use Clojure(yet). |
| 16:19 | ordnungswidrig | re |
| 16:19 | djork | DC area. Not really interesting in working in DC though. |
| 16:19 | djork | http://craiglook.com/all.html?q=clojure&m=0 aww, zero listings |
| 16:19 | ohpauleez | The other company rights highly available messaging systems for financial companies |
| 16:19 | djork | interesting |
| 16:19 | ohpauleez | writes* |
| 16:20 | djork | seems like more of an Erlang niche |
| 16:20 | djork | (just saying) |
| 16:20 | djork | (not that I wouldn't try it in Clojure myself) |
| 16:21 | ohpauleez | clojure is one piece of the puzzle |
| 16:21 | ohpauleez | there is some erlang in the solution, as well as RabbitMQ, ruby (on rails) and standard Java |
| 16:22 | ska2342 | Many companies just got to evaluating Clojure which is probably not done in the wide public. It is quite easy to integrate Clojure for internal tools (like testing or command line interfaces) where Java is used. It's probably harder to persuade a customer of this new technology. |
| 16:22 | ohpauleez | One large engineering group in Comcast is using it, and adopting it more extensively |
| 16:23 | ska2342 | Learning Clojure is a bet (besides being fun :-) |
| 16:23 | ohpauleez | a second group (also very large) is going to put it up for trial the beginning of this year for some stuff |
| 16:27 | hiredman | ohpauleez: interesting about comcast |
| 16:36 | ohpauleez | totally |
| 16:36 | pdk | djork if you google lispjobs it covers clojure as well |
| 16:36 | djork | good tip, thanks pdk |
| 16:37 | hiredman | my gui repl starts up 21 threads just to sit idle |
| 16:38 | patrkris | any clever libraries available that makes talking to web services easy in Clojure? |
| 16:38 | hiredman | clojure-json |
| 16:38 | the-kenny | clojure-http-client |
| 16:38 | patrkris | sorry, I mean for SOAP-based web services |
| 16:38 | technomancy | patrkris: clojure.http.client has a "resourcefully" ns that you might like |
| 16:39 | technomancy | eww |
| 16:39 | patrkris | yeah, I don't like SOAP either |
| 16:39 | technomancy | =( |
| 16:39 | patrkris | technomancy: resourcefully is for SOAP stuff? |
| 16:40 | technomancy | no, just for REST |
| 16:40 | hiredman | I think I call future for each evaluation (yaya threadpool!) |
| 16:41 | patrkris | technomancy: stupid question, did you mean clojure-contrib? |
| 16:41 | patrkris | not that it matters much in the case of SOAP |
| 16:42 | technomancy | patrkris: no, this is separate: http://github.com/technomancy/clojure-http-client |
| 16:42 | patrkris | ah |
| 16:48 | hiredman | http://www.thelastcitadel.com/images/Screenshot-Repl.png |
| 17:05 | Immutable7 | are there any libraries for networking? eg like mina? |
| 18:02 | quizme | does enclojure work with netbeans 6.8 ? |
| 18:27 | the-kenny | Why is something like rename-keys in clojure.set? |
| 18:43 | mebaran151 | technomancy, I have a set of unit tests for my library in subfolder test |
| 18:43 | mebaran151 | how do I get lein test to run them |
| 18:43 | mebaran151 | they just use clojure.test |
| 18:45 | ikitat | $ lein test |
| 18:45 | mebaran151 | I use lein test |
| 18:45 | mebaran151 | but it blows up, complaing there's no clojure |
| 18:45 | mebaran151 | but there is! |
| 18:46 | ikitat | clojar.jar in your lib folder? |
| 18:47 | technomancy | mebaran151: did you do lein deps? |
| 18:47 | mebaran151 | yeah |
| 18:49 | mebaran151 | I apologize wrong error |
| 18:49 | mebaran151 | it can't find my test clj files |
| 18:49 | mebaran151 | I keep my tests in test |
| 18:49 | mebaran151 | anyway to add that to the search path |
| 18:51 | technomancy | mebaran151: it should be by default, but you can add a :test key to project.clj |
| 18:51 | mebaran151 | what namespace should my tests live in? |
| 18:51 | technomancy | any namespace is fine |
| 18:51 | technomancy | it will just run all the tests in all the namespaces in the test/ dir of your project |
| 18:52 | technomancy | sorry, the :test-path key in project.clj |
| 18:52 | technomancy | as always, test namespaces need to match the file they're stored in |
| 18:52 | mebaran151 | well mine are in com.bebop.appledelhi.bdb-test |
| 18:52 | mebaran151 | and it picks up that those are tests to run |
| 18:52 | mebaran151 | however it throws a Java IO file exception |
| 18:55 | Licenser | is there something like a default case for multi methods? |
| 18:58 | mebaran151 | still can't find them |
| 18:58 | mebaran151 | I just have 3 simple clj files in test |
| 18:58 | mebaran151 | changed them all to have flat namespaces without the com.bebop prefix, but lein test can't find 'em |
| 19:13 | hoeck | Licenser: yes, :default option in defmulti, defaults to :default, e.g. (defmethod foo :default [] ...) |
| 19:14 | Licenser | hoeck: so whatever I pass if nothing else matches :default will be called? Nice :D thank you hoeck |
| 19:15 | hoeck | Licenser: exactly |
| 19:15 | Licenser | hamza: way thank you! |
| 19:49 | polypus | is there a good writeup anywhere on deftype. i'm especially interested in how it fits into or is used in conjunction with derive and the hierarchy system. any pointers? |
| 20:25 | hoeck | polypus: have you seen http://www.assembla.com/wiki/show/clojure/Datatypes ? |
| 20:30 | mebaran151 | I have a weird issue: I have to mutually reliant clj files |
| 20:30 | mebaran151 | *two |
| 20:31 | mebaran151 | but it seems one can't see the globals that it uses from the other |
| 20:45 | arohner | what do you mean by mutually reliant? |
| 20:45 | arohner | nm, he left |
| 20:46 | ohpauleez | arohner: I bet he meant he has circular dependencies |
| 20:46 | arohner | yeah, that's what I suspected |
| 21:12 | mebaran151 | I have two mutually reliant namespaces |
| 21:12 | mebaran151 | while I somehow get them to load at the repl |
| 21:12 | mebaran151 | all my compiles fail with various var not found messages |
| 21:14 | hiredman | don't do that |
| 21:15 | mebaran151 | I wanted to split out the indexing from the my main wrapping code |
| 21:15 | hiredman | so? |
| 21:15 | hiredman | don't create cyclic dependencies |
| 21:16 | mebaran151 | well I just need one var from the main namespace *neo* |
| 21:16 | Chousuke | if you just want to split the code, you can use load to load plain files. |
| 21:16 | mebaran151 | is there anyway just to copy the var |
| 21:16 | mebaran151 | otherwise I can always just cut and paste it back together |
| 21:18 | mebaran151 | are there no possible declare hacks? |
| 22:22 | mebaran151 | ah well, I just refactored so as to avoid the circular dependencies |
| 22:22 | chouser | mebaran151: good job! |
| 22:23 | mebaran151 | but there's no way to have circularly dependent clj files for the future? |
| 22:24 | chouser | not that I know of. Does it really seem like a good thing to you? |
| 22:40 | mebaran151 | it was just one global variable that would have been nice to have had access to within both |
| 22:41 | mebaran151 | and also I ended up having to cut and paste one small definition that probably should get moved to a utils anyway |
| 22:47 | danlarkin | I want to convert a clojure.lang.Ratio to a BigInteger, do I have to do something like this, (.divide (.numerator 9/4) (.denominator 9/4))? |
| 22:53 | piccolino | Is that gonna be an integer? |
| 22:54 | danlarkin | it's a BigInteger |
| 22:54 | technomancy | danlarkin: will (int my-ratio) cause nasty overflow? it works fine for small values |
| 22:55 | technomancy | to answer my own question: yes, it overflows |
| 22:55 | danlarkin | technomancy: values will be larger than an int can hold :( |
| 22:55 | ikitat | ,(.decimalValue 999999999999999/2) |
| 22:55 | clojurebot | 499999999999999.5M |
| 22:56 | chouser | 'int' means primitive int |
| 22:58 | ikitat | ,(type (.toBigInteger (.decimalValue 9/4))) |
| 22:58 | clojurebot | java.math.BigInteger |
| 22:58 | technomancy | handy |
| 22:58 | danlarkin | Hm! |
| 23:00 | ikitat | or .toBigIntegerExact which will throw an ArithmeticException on ratios that result in remainders |
| 23:00 | technomancy | \ |
| 23:03 | danlarkin | ikitat: thanks, .toBigInteger on the .decimalValue is what I'll use |
| 23:05 | ikitat | ,(bigint (bigdec 9/4)) |
| 23:05 | clojurebot | 2 |
| 23:05 | ikitat | a bit nicer |
| 23:06 | ikitat | ,(bigint 9/4) |
| 23:06 | clojurebot | 2 |
| 23:06 | ikitat | haha... jackpot |
| 23:06 | danlarkin | hey now that's more like it |