2011-06-05
| 01:28 | offby1 | "No Dazed and Confused" |
| 01:44 | disappearedng | what is shortest and most practical book for clojure? I am reading the joy of clojure and it's super long winded and I can't stand it |
| 01:45 | disappearedng | !book |
| 01:46 | halfprogrammer` | disappearedng: Right now there are not too many options "Programming clojure" and "Practical clojure" are the others available |
| 01:47 | halfprogrammer` | both are good. Programming clojure is the older of the two |
| 01:47 | disappearedng | which one is more code |
| 01:47 | disappearedng | I can't stand reading theoretical stuff |
| 01:47 | halfprogrammer` | Certainly Programming clojure has more examples |
| 01:48 | halfprogrammer` | Think you will change your mind abt Joy of clojure in a few days |
| 01:48 | disappearedng | ok thx |
| 01:48 | disappearedng | I read 50 pages and haven't even started writing code yet |
| 01:48 | disappearedng | I am literally falling asleep |
| 01:48 | halfprogrammer` | That is probably the best book around. Extremely high quality |
| 01:48 | halfprogrammer` | :) |
| 01:48 | halfprogrammer` | You don't read K&R for C to learn how to code in C from, do you |
| 01:49 | halfprogrammer` | Joy of clojure tells you why certain things work the way they do |
| 01:49 | disappearedng | I read source code |
| 01:49 | disappearedng | and then I read k & r |
| 01:49 | disappearedng | I have ADHD i can't sit still but I can code really focused |
| 01:50 | halfprogrammer` | hmmm |
| 01:50 | halfprogrammer` | IMHO Joy of clojure probably the best one out there. Of course, opinions differ... |
| 01:51 | disappearedng | ok i will try to stick to it till page 60 |
| 01:51 | disappearedng | I am literally not being able to focus cause it's so boring |
| 01:51 | halfprogrammer` | hmmm |
| 06:09 | Night-hacks | hi guys |
| 06:09 | Night-hacks | is there any book about language desing, implementations and .... ? |
| 06:10 | Night-hacks | of course i dont mean end user books |
| 06:11 | Vinzent | maybe SICP will be helpful |
| 06:11 | Night-hacks | SICP stands for ... ? |
| 06:12 | Vinzent | structure and interpretation of computer progrmas |
| 06:12 | Night-hacks | Vinzent: MIT press one ? |
| 06:12 | Vinzent | yep |
| 06:12 | Night-hacks | Vinzent: thanks |
| 06:13 | morphling | Night-hacks: 'lisp in small pieces' might suit you |
| 06:13 | Night-hacks | morphling: yeah thats in my list also |
| 06:15 | Vinzent | In enlive, if I have 2 identical html-pieces excluding one tag. how can I use one snippet to generate both pieces? |
| 06:16 | raek | Vinzent: you can define a var to contain one of them, and then define another var to contain the result of an at-call on the first |
| 06:17 | raek | Night-hacks: book recommendations: Compilers: Principles, Techniques, and Tools ("The Dragon Book" http://dragonbook.stanford.edu/) |
| 06:18 | raek | Night-hacks: and also Semantics with Applications (now available for free: http://www.daimi.au.dk/~bra8130/Wiley_book/wiley.html) |
| 06:19 | Night-hacks | raek: both looks intersting |
| 06:56 | djpowell | I can't get wrap-file to work properly in ring... |
| 06:57 | djpowell | I do (wrap-file "public"), but this seems to map the requests from /public/a.txt to the file public/public/file.txt |
| 06:59 | raek | djpowell: that's strange. the string "public" isn |
| 06:59 | raek | 'n even in the source |
| 07:00 | raek | oh, wait. |
| 07:00 | raek | djpowell: the path you give to wrap-file is the root directory where you will serve files from |
| 07:01 | raek | djpowell: and the url is simply concatenated onto that, hence the double "public" |
| 07:01 | raek | so (wrap-file "public") will serve the URL /a.txt from public/file.txt |
| 07:03 | raek | djpowell: with moustache, you can strip off one segment of the url: (app ["public" &] [(wrap-file "public") not-found-handler]) |
| 07:06 | djpowell | yeah - i guess that is how it is supposed to work. wrap-resource is the same |
| 07:06 | djpowell | seems a bit odd |
| 07:07 | raek | the URL prefix does not have to have the same name as the root directory |
| 07:07 | raek | e.g. you might want to have /static/ in the URL, but call the static root directory public/ |
| 07:08 | djpowell | yeah |
| 07:09 | djpowell | the clojure web stack has quite a learning curve, but it looks like it might be worth it |
| 07:10 | raek | what I really like about Moustache is that it is very simple to arrange ones handlers hierarchially (since the routing middlware can strip off matched segments of the URL) |
| 07:16 | Vinzent | but compojure has the context macro that does the same |
| 07:56 | quizme | I would just like to announce that slime.vim is awesome. It gets CTRL-C CTRL-C to send code from vim to your REPL. |
| 07:56 | quizme | super easy to set up too. |
| 08:19 | Vinzent | is there a built-in fn to get all the permutations of the given seq? e.g. (f [1 2 3 4]) => ([1 2 3 4] [2 3 4 1] [3 1 4 2] etc) |
| 08:21 | gregh | http://richhickey.github.com/clojure-contrib/combinatorics-api.html |
| 08:22 | Vinzent | oh. ok, thanks |
| 10:10 | fliebel | Any math people around who could tell me what would be the name(or any other means of finding guidance to a solution) of a problem similar to the traveling salesman problem. Namely, the cheapest way to connect a set of nodes in a weighted graph. |
| 10:37 | schaf_ | hi all. whats wrong about this: (.isDirectory file)? it get "No matching field found: isDirectory for class [Ljava.io.File;" |
| 10:40 | fliebel | schaf_: Looks like you have a file array |
| 10:42 | schaf_ | thank you fliebel. i just did not see it |
| 11:06 | schaf_ | hmmm. now (.isDirectory file) works but (.getName file) gives me "java.lang.IllegalArgumentException: No matching field found: name for class java.io.File" |
| 11:12 | terom | Hmm, works her3e |
| 11:13 | schaf_ | yes, here too. my mistake... sorry terom |
| 15:53 | JohnnyL | hi |
| 15:57 | offby1 | |
| 15:57 | offby1 | "No Dazed and Confused" |
| 16:05 | JohnnyL | thats nice! |
| 16:08 | offby1 | A "Dazed And Confused"-free zone is indeed nice. |
| 16:33 | JohnnyL | offby1: oh right, that led zep quote. |
| 16:33 | JohnnyL | hahaha, duh, silly me, i had no idea what you were talking about. |
| 16:49 | krumholt | is there a way to print a deftype or a defrecord nicely? like overriding a print mehtod somewhere? |
| 16:52 | dnolen | krumholt: you can implement print-method for your type/record |
| 16:54 | krumholt | dnolen, thanks |
| 18:02 | Moominpapa | I know this is slightly off-topic, but is there really no callback-orientated way to run a JDBC query in Java? |
| 18:03 | Moominpapa | I couldn't figure out why clojure.contrib.sql didn't seem to have the functionality, and then I looked at the Java API... |
| 18:03 | seancorfield | can you give an example of what you're trying to envisage? |
| 18:06 | Moominpapa | Well, in C#, you can call a function asynchronously, and give a function to be called when it's finished |
| 18:06 | Moominpapa | Node has that as the only model. |
| 18:06 | Moominpapa | So |
| 18:07 | Moominpapa | (execute-query connection "select * from Users" do-something-with-users) |
| 18:07 | Moominpapa | (I appreciate that looks like with-query-results.) |
| 18:07 | Moominpapa | But as far as I can tell, with-query-results waits for the DB to return. |
| 18:11 | icey | So you just want to make your db call asynchronously and have a callback handle the response? |
| 18:11 | Moominpapa | Yes, well, in particular, I'd rather not have a thread waiting for the response. |
| 18:12 | Moominpapa | Tbh, it probably doesn't matter, but I've been thinking in node style for a month or two. |
| 18:12 | icey | Eh, I'm a clojure noob, but couldn't you use an agent for that? |
| 18:12 | mrBliss` | ,(doc future) |
| 18:12 | clojurebot | "([& body]); Takes a body of expressions and yields a future object that will invoke the body in another thread, and will cache the result and return it on all subsequent calls to deref/@. If the computation has not yet finished, calls to deref/@ will block." |
| 18:14 | Moominpapa | You can certainly use an agent (future does, for instance), but you're still taking up a thread in a thread pool just to wait for something that's executing on another machine. |
| 18:14 | Moominpapa | Probably doesn't matter for my purposes, but I was surprised that Java didn't seem to have a way to do it. |
| 18:15 | lucian | Moominpapa: that's something you have to live with on the jvm, sometimes |
| 18:15 | Moominpapa | Yeah, I guess :) |
| 18:16 | Moominpapa | I probably overthink resource utilisation anyway. :) |
| 18:16 | lucian | a thread pool just for async io is silly, but it's often something you have to live with, sadly |
| 18:17 | lucian | I hope whoever first thought sync IO is a good idea died a bad death |
| 18:30 | brehaut | Moominpapa: you might find https://github.com/hiredman/die-geister useful? |
| 18:31 | brehaut | Moominpapa: you can make any expression a 'task' that is run async, merge tasks together and declare join points. |
| 19:02 | JohnnyL | ü |
| 19:02 | JohnnyL | :) |
| 20:57 | gstamp | exit |
| 20:57 | gstamp | oops |
| 21:23 | offby1 | passwd offby1 frotz |
| 21:23 | offby1 | oops |
| 21:31 | Ownatik | fail |
| 22:08 | wastrel | i did an ok job |
| 22:39 | lawfulfalafel | I have this weird problem in emacs; for some reason when I create a left paren key, the right one is automatically created right next to it |
| 22:40 | lawfulfalafel | but I don't get how I am supposed to enclose an existing function like (% number 3) and turn it into (eq 0 (% number 3)) |
| 22:41 | lawfulfalafel | I think paredit is causing this, but I'm not sure at all |
| 22:56 | offby1 | lawfulfalafel: you should ask on #emacs |
| 22:56 | offby1 | in the meantime, it sounds like you're using paredit |
| 22:56 | offby1 | ... which just does that |
| 23:26 | TimMc | lawfulfalafel: so you have |(% number 3) where | is the cursor... |
| 23:27 | TimMc | type left-paren and then Ctrl right arrow |
| 23:28 | TimMc | given (eq 0|) (% number 3), Ctrl-right jumps the innermost possible close-paren to the right to enclose another form. |
| 23:30 | zakwilson | Is Postal the One True Way for sending mail from Clojure? |
| 23:37 | lawfulfalafel | TimMC: thanks! I never new that Ctrl-right arrow trick |
| 23:45 | lawfulfalafel | in the clojure repl, how do you go to previous commands? |
| 23:45 | lawfulfalafel | the up arrow just prints the keyboard character |
| 23:45 | lawfulfalafel | ^[[A |
| 23:45 | lawfulfalafel | whatever that is :P |
| 23:48 | zakwilson | lawfulfalafel: most people don't use the ordinary repl; they use lein, or slime/swank or labrepl |
| 23:49 | zakwilson | To directly answer your question, I don't think the basic repl can do that. |
| 23:50 | dnolen | also cake ... best repl. |
| 23:59 | TimMc | lawfulfalafel: Check out the "Paredit cheat sheet", by the way. Lots of tricks. |